diff --git a/CMakeLists.txt b/CMakeLists.txt index 8956cdad..1150c53d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,7 @@ option(BUILD_UNIVERSAL "Builds the shared or framework as a universal (fat, 32- option(BUILD_OSX_I386 "Builds the shared or framework as a 32-bit binary, even on a 64-bit platform" OFF) option(USE_LIBCXX "Uses libc++ instead of libstdc++" ON) option(USE_CUSTOM_LIBCXX "Uses a custom libc++" OFF) +option(USE_SYSTEM_JSONCPP "Uses the system installed jsoncpp." OFF) add_definitions( -DVR_API_PUBLIC ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 29b69c5c..ebfb8b24 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -34,8 +34,14 @@ endif() # Set the source group and files. set(CORE_FILES openvr_api_public.cpp - jsoncpp.cpp ) + +if(NOT USE_SYSTEM_JSONCPP) + set(JSON_CPP_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../thirdparty/jsoncpp) + include_directories(${JSON_CPP_DIR}) + list(APPEND CORE_FILES ${JSON_CPP_DIR}/jsoncpp.cpp) +endif() + set(VRCOMMON_FILES vrcommon/dirtools_public.cpp vrcommon/envvartools_public.cpp @@ -98,6 +104,10 @@ if(USE_CUSTOM_LIBCXX) set(EXTRA_LIBS ${EXTRA_LIBS} c++ c++abi) endif() +if(USE_SYSTEM_JSONCPP) + list(APPEND EXTRA_LIBS jsoncpp) +endif() + target_link_libraries(${LIBNAME} ${EXTRA_LIBS} ${CMAKE_DL_LIBS}) target_include_directories(${LIBNAME} PUBLIC ${OPENVR_HEADER_DIR}) diff --git a/src/json/json-forwards.h b/thirdparty/jsoncpp/json/json-forwards.h similarity index 100% rename from src/json/json-forwards.h rename to thirdparty/jsoncpp/json/json-forwards.h diff --git a/src/json/json.h b/thirdparty/jsoncpp/json/json.h similarity index 100% rename from src/json/json.h rename to thirdparty/jsoncpp/json/json.h diff --git a/src/jsoncpp.cpp b/thirdparty/jsoncpp/jsoncpp.cpp similarity index 100% rename from src/jsoncpp.cpp rename to thirdparty/jsoncpp/jsoncpp.cpp