From 98d29c5d83f8d3665e3751bbddca26b65becf495 Mon Sep 17 00:00:00 2001 From: James Le Cuirot Date: Sat, 24 Feb 2024 21:14:26 +0000 Subject: [PATCH] Only require nlohmann_json on Windows and source it from pacman --- .github/workflows/CI.yml | 1 + .gitmodules | 4 ---- cmake/compile_definitions/common.cmake | 3 +-- cmake/compile_definitions/windows.cmake | 1 + cmake/dependencies/common.cmake | 3 --- cmake/dependencies/windows.cmake | 3 +++ docs/source/building/windows.rst | 1 + third-party/nlohmann_json | 1 - 8 files changed, 7 insertions(+), 10 deletions(-) delete mode 160000 third-party/nlohmann_json diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 4b53e3204e9..098905746f7 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -765,6 +765,7 @@ jobs: mingw-w64-x86_64-cmake mingw-w64-x86_64-curl mingw-w64-x86_64-miniupnpc + mingw-w64-x86_64-nlohmann-json mingw-w64-x86_64-nodejs mingw-w64-x86_64-nsis mingw-w64-x86_64-onevpl diff --git a/.gitmodules b/.gitmodules index 67522f450ed..a4231d16f72 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,10 +10,6 @@ path = third-party/nanors url = https://github.com/sleepybishop/nanors.git branch = master -[submodule "third-party/nlohmann_json"] - path = third-party/nlohmann_json - url = https://github.com/nlohmann/json - branch = master [submodule "third-party/nv-codec-headers"] path = third-party/nv-codec-headers url = https://github.com/FFmpeg/nv-codec-headers diff --git a/cmake/compile_definitions/common.cmake b/cmake/compile_definitions/common.cmake index 94f1ac598cc..e254e122234 100644 --- a/cmake/compile_definitions/common.cmake +++ b/cmake/compile_definitions/common.cmake @@ -134,5 +134,4 @@ list(APPEND SUNSHINE_EXTERNAL_LIBRARIES ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} ${CURL_LIBRARIES} - ${PLATFORM_LIBRARIES} - nlohmann_json::nlohmann_json) + ${PLATFORM_LIBRARIES}) diff --git a/cmake/compile_definitions/windows.cmake b/cmake/compile_definitions/windows.cmake index e3729927fc1..3167cefdea8 100644 --- a/cmake/compile_definitions/windows.cmake +++ b/cmake/compile_definitions/windows.cmake @@ -75,6 +75,7 @@ list(PREPEND PLATFORM_LIBRARIES avrt iphlpapi shlwapi + PkgConfig::NLOHMANN_JSON ${CURL_STATIC_LIBRARIES}) if(SUNSHINE_ENABLE_TRAY) diff --git a/cmake/dependencies/common.cmake b/cmake/dependencies/common.cmake index a1f35128005..29bed10e5cd 100644 --- a/cmake/dependencies/common.cmake +++ b/cmake/dependencies/common.cmake @@ -19,9 +19,6 @@ pkg_check_modules(CURL REQUIRED libcurl) pkg_check_modules(MINIUPNP miniupnpc REQUIRED) include_directories(SYSTEM ${MINIUPNP_INCLUDE_DIRS}) -# nlohmann_json -add_subdirectory("${CMAKE_SOURCE_DIR}/third-party/nlohmann_json") - # ffmpeg pre-compiled binaries if(WIN32) if(NOT CMAKE_SYSTEM_PROCESSOR STREQUAL "AMD64") diff --git a/cmake/dependencies/windows.cmake b/cmake/dependencies/windows.cmake index 376c44da65a..a7ecce3963d 100644 --- a/cmake/dependencies/windows.cmake +++ b/cmake/dependencies/windows.cmake @@ -2,3 +2,6 @@ set(Boost_USE_STATIC_LIBS ON) # cmake-lint: disable=C0103 find_package(Boost 1.71.0 COMPONENTS locale log filesystem program_options REQUIRED) + +# nlohmann_json +pkg_check_modules(NLOHMANN_JSON nlohmann_json REQUIRED IMPORTED_TARGET) diff --git a/docs/source/building/windows.rst b/docs/source/building/windows.rst index 8e83c58e99d..f73346ffebf 100644 --- a/docs/source/building/windows.rst +++ b/docs/source/building/windows.rst @@ -26,6 +26,7 @@ Install dependencies: mingw-w64-x86_64-cmake \ mingw-w64-x86_64-curl \ mingw-w64-x86_64-miniupnpc \ + mingw-w64-x86_64-nlohmann-json \ mingw-w64-x86_64-nodejs \ mingw-w64-x86_64-onevpl \ mingw-w64-x86_64-openssl \ diff --git a/third-party/nlohmann_json b/third-party/nlohmann_json deleted file mode 160000 index 9cca280a4d0..00000000000 --- a/third-party/nlohmann_json +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9cca280a4d0ccf0c08f47a99aa71d1b0e52f8d03