[icey] Devendor nlohmann-json. (#51086)

This commit is contained in:
Billy O'Neal 2026-04-10 15:02:25 -07:00 committed by GitHub
parent b69d0e8dfc
commit 53e313ba35
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 89 additions and 3 deletions

View File

@ -0,0 +1,77 @@
diff --git a/cmake/icey_build_config.cmake.in b/cmake/icey_build_config.cmake.in
index aae2c22c..ccf13c38 100644
--- a/cmake/icey_build_config.cmake.in
+++ b/cmake/icey_build_config.cmake.in
@@ -44,6 +44,9 @@ if(_icey_have_libdatachannel AND DEFINED icey_FIND_COMPONENTS AND "webrtc" IN_LI
endif()
if(@USE_SYSTEM_DEPS@)
+ if("json" IN_LIST _icey_supported_components)
+ find_dependency(nlohmann_json CONFIG)
+ endif()
find_package(libuv CONFIG QUIET)
if(NOT TARGET libuv::uv_a AND NOT TARGET libuv::uv AND NOT TARGET libuv::libuv AND PkgConfig_FOUND)
pkg_check_modules(LIBUV QUIET IMPORTED_TARGET GLOBAL libuv)
diff --git a/cmake/icey_config.cmake.in b/cmake/icey_config.cmake.in
index 447929b9..0e14d025 100644
--- a/cmake/icey_config.cmake.in
+++ b/cmake/icey_config.cmake.in
@@ -59,6 +59,9 @@ if(NOT TARGET llhttp_static)
endif()
if(@USE_SYSTEM_DEPS@)
+ if("json" IN_LIST _icey_supported_components)
+ find_dependency(nlohmann_json CONFIG)
+ endif()
find_dependency(ZLIB)
if("archo" IN_LIST _icey_supported_components OR "pacm" IN_LIST _icey_supported_components)
find_dependency(unofficial-minizip CONFIG QUIET)
diff --git a/icey.cmake b/icey.cmake
index f99c4f7f..0d766619 100644
--- a/icey.cmake
+++ b/icey.cmake
@@ -210,6 +210,9 @@ else()
pkg_check_modules(LIBUV QUIET IMPORTED_TARGET GLOBAL libuv)
endif()
find_package(llhttp CONFIG QUIET)
+ if(BUILD_MODULES AND (NOT DEFINED BUILD_MODULE_json OR BUILD_MODULE_json))
+ find_package(nlohmann_json CONFIG REQUIRED)
+ endif()
find_package(ZLIB REQUIRED)
if(NOT TARGET llhttp_static
AND NOT TARGET llhttp::llhttp_static
diff --git a/src/json/CMakeLists.txt b/src/json/CMakeLists.txt
index 8983ef5c..905c5008 100644
--- a/src/json/CMakeLists.txt
+++ b/src/json/CMakeLists.txt
@@ -1,6 +1,20 @@
-icy_add_module(json
- DEPENDS base
- PRETTY_NAME JSON
-)
-# nlohmann/json.hpp is vendored in include/nlohmann/ (MIT licensed, single-header)
-# so no external dependency is needed - icy_add_module already adds our include dir.
+if(USE_SYSTEM_DEPS)
+ icy_add_module(json
+ DEPENDS base
+ PACKAGES nlohmann_json::nlohmann_json
+ PRETTY_NAME JSON
+ )
+else()
+ icy_add_module(json
+ DEPENDS base
+ PRETTY_NAME JSON
+ )
+ target_include_directories(json
+ PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/vendor>
+ )
+ install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/vendor/"
+ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
+ COMPONENT dev
+ )
+endif()
diff --git a/src/json/include/nlohmann/json.hpp b/src/json/vendor/nlohmann/json.hpp
similarity index 100%
rename from src/json/include/nlohmann/json.hpp
rename to src/json/vendor/nlohmann/json.hpp

View File

@ -1,9 +1,11 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO nilstate/icey
REF "2.4.2"
SHA512 1b56b3c9f082d4d35f9150c75c1c23972c696f853f3f0627787f33882e07c44de843b3896dc4a54f04cefd20dd7b4a6f64a52c5cdabc11d98b5be57c17193dfb
REF 6692243b82e687279ed40f6df54ab93d8964b6a1 # 2.4.2
SHA512 c1956e7035c2f4aef8cd1005fc8f6373d4b90c4409bd1dd104b5f9f415f9e347da7b1c530ac8f1192f7953a076ec21f0a8aed9618e236324e0c5154f12e79dce
HEAD_REF main
PATCHES
001-devendor-nlohmann-json.patch
)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS

View File

@ -1,6 +1,7 @@
{
"name": "icey",
"version": "2.4.2",
"port-version": 1,
"maintainers": "0state OSS <oss@0state.com>",
"description": "C++20 media stack and libwebrtc alternative for real-time video, signalling, TURN, and media servers",
"homepage": "https://0state.com/icey/",
@ -10,6 +11,7 @@
"libuv",
"llhttp",
"minizip",
"nlohmann-json",
"openssl",
{
"name": "vcpkg-cmake",

View File

@ -3894,7 +3894,7 @@
},
"icey": {
"baseline": "2.4.2",
"port-version": 0
"port-version": 1
},
"icu": {
"baseline": "78.2",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "bf0aa15dc2cf655705528a6d4a19a7d1f3d5a6a6",
"version": "2.4.2",
"port-version": 1
},
{
"git-tree": "df041864a584d605aae51c2b8f8cb6f1c3fda56e",
"version": "2.4.2",