From 49d51b5202c955170d055ec720db73ebce161fde Mon Sep 17 00:00:00 2001 From: James Le Cuirot Date: Sat, 24 Feb 2024 10:09:09 +0000 Subject: [PATCH 1/2] Split MacPorts Portfile dependencies into lib and build Some dependencies are only needed at build time. --- packaging/macos/Portfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packaging/macos/Portfile b/packaging/macos/Portfile index 2ef8098f15..ba4815e25d 100644 --- a/packaging/macos/Portfile +++ b/packaging/macos/Portfile @@ -31,12 +31,13 @@ post-fetch { system -W ${worksrcpath} "${git.cmd} submodule update --init --recursive" } +depends_build-append port:npm9 \ + port:pkgconfig + depends_lib port:avahi \ port:curl \ port:libopus \ - port:miniupnpc \ - port:npm9 \ - port:pkgconfig + port:miniupnpc boost.version 1.81 From 00d0746b2a187d6f46c5c5c1d94e35aea1a07b2a Mon Sep 17 00:00:00 2001 From: James Le Cuirot Date: Sat, 24 Feb 2024 21:14:26 +0000 Subject: [PATCH 2/2] 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 f1005458c9..60f555c216 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -769,6 +769,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 67522f450e..a4231d16f7 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 ca6ddcbb0f..646e1298e4 100644 --- a/cmake/compile_definitions/common.cmake +++ b/cmake/compile_definitions/common.cmake @@ -152,5 +152,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 2095cc5baa..699a84c184 100644 --- a/cmake/compile_definitions/windows.cmake +++ b/cmake/compile_definitions/windows.cmake @@ -84,6 +84,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 a1f3512800..29bed10e5c 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 376c44da65..a7ecce3963 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 8e83c58e99..f73346ffeb 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 9cca280a4d..0000000000 --- a/third-party/nlohmann_json +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9cca280a4d0ccf0c08f47a99aa71d1b0e52f8d03