add WITH_BOOST option to build with linked Boost

This commit is contained in:
Syping 2023-04-09 21:45:58 +02:00
parent 6e38894bcc
commit 7f7b202df9
3 changed files with 27 additions and 4 deletions

View file

@ -48,7 +48,6 @@ if(APPLE)
endif() endif()
list(APPEND GTA5VIEW_DEFINES list(APPEND GTA5VIEW_DEFINES
-DBOOST_JSON_STANDALONE
-DGTA5SYNC_CMAKE -DGTA5SYNC_CMAKE
-DGTA5SYNC_PROJECT -DGTA5SYNC_PROJECT
) )
@ -140,7 +139,6 @@ set(GTA5VIEW_HEADERS
set(GTA5VIEW_INCLUDEDIR set(GTA5VIEW_INCLUDEDIR
src src
src/anpro src/anpro
src/json/include
src/pcg src/pcg
src/uimod src/uimod
) )
@ -231,6 +229,29 @@ if(RAGEPHOTO_ABI_WRAPPER)
) )
endif() endif()
option(WITH_BOOST "Use linked Boost library" OFF)
if(WITH_BOOST)
find_package(Boost REQUIRED
COMPONENTS json
)
list(APPEND GTA5VIEW_LIBS
Boost::json
)
list(APPEND GTA5VIEW_DEFINES
-DGTA5SYNC_BOOST
)
list(APPEND GTA5VIEW_INCLUDEDIR
${Boost_INCLUDE_DIRS}
)
else()
list(APPEND GTA5VIEW_DEFINES
-DBOOST_JSON_STANDALONE
)
list(APPEND GTA5VIEW_INCLUDEDIR
src/json/include
)
endif()
option(WITH_DONATE "Donate menu option and donation dialog" OFF) option(WITH_DONATE "Donate menu option and donation dialog" OFF)
if(WITH_DONATE) if(WITH_DONATE)
set(DONATE_ADDRESSES "" CACHE STRING "Donation addresses") set(DONATE_ADDRESSES "" CACHE STRING "Donation addresses")

View file

@ -16,9 +16,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/ *****************************************************************************/
#ifndef GTA5SYNC_BOOST
#include <boost/json/src.hpp> #include <boost/json/src.hpp>
#include <sstream> #endif
#include "SnapmaticJson.h" #include "SnapmaticJson.h"
#include <sstream>
void serializer(std::ostream &os, const boost::json::value &jv, std::string *indent, bool do_indent) void serializer(std::ostream &os, const boost::json::value &jv, std::string *indent, bool do_indent)
{ {

@ -1 +1 @@
Subproject commit 933918454f16af118a3cb9e1359a00bca589d7e7 Subproject commit d8c0d7d47031c670443722db13e3c67c9c7f33a9