2019-05-30 05:24:41 +08:00
|
|
|
vcpkg_from_github(
|
|
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
|
|
REPO DaveGamble/cJSON
|
2023-09-26 14:37:00 +08:00
|
|
|
REF "v${VERSION}"
|
2024-09-04 03:25:32 +08:00
|
|
|
SHA512 2accb507c6b97222eb5f0232c015b356cf6d248d1247049928731aa8e897378245e62395c232b1ec57d28d1e53ac72c849be85e59c33616a382d40473649f66b
|
2019-05-30 05:24:41 +08:00
|
|
|
HEAD_REF master
|
|
|
|
)
|
|
|
|
|
2019-12-03 02:39:21 +08:00
|
|
|
vcpkg_check_features(
|
|
|
|
OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
2021-07-21 01:24:58 +08:00
|
|
|
FEATURES
|
|
|
|
utils ENABLE_CJSON_UTILS
|
2019-12-03 02:39:21 +08:00
|
|
|
)
|
2019-05-30 05:24:41 +08:00
|
|
|
|
|
|
|
if(CMAKE_HOST_WIN32)
|
|
|
|
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" ENABLE_PUBLIC_SYMBOLS)
|
2020-06-24 04:01:52 +08:00
|
|
|
string(COMPARE NOTEQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" DENABLE_HIDDEN_SYMBOLS)
|
2019-05-30 05:24:41 +08:00
|
|
|
else()
|
|
|
|
set(ENABLE_PUBLIC_SYMBOLS OFF)
|
2020-06-24 04:01:52 +08:00
|
|
|
set(DENABLE_HIDDEN_SYMBOLS OFF)
|
2019-05-30 05:24:41 +08:00
|
|
|
endif()
|
|
|
|
|
2021-09-24 08:50:47 +08:00
|
|
|
vcpkg_cmake_configure(
|
|
|
|
SOURCE_PATH "${SOURCE_PATH}"
|
2019-05-30 05:24:41 +08:00
|
|
|
OPTIONS
|
|
|
|
-DBUILD_SHARED_AND_STATIC_LIBS=OFF
|
|
|
|
-DCJSON_OVERRIDE_BUILD_SHARED_LIBS=OFF
|
|
|
|
-DENABLE_PUBLIC_SYMBOLS=${ENABLE_PUBLIC_SYMBOLS}
|
2020-06-24 04:01:52 +08:00
|
|
|
-DENABLE_HIDDEN_SYMBOLS=${DENABLE_HIDDEN_SYMBOLS}
|
2019-05-30 05:24:41 +08:00
|
|
|
-DENABLE_TARGET_EXPORT=ON # Export CMake config files
|
|
|
|
-DENABLE_CJSON_TEST=OFF
|
2022-08-03 14:21:20 +08:00
|
|
|
-DENABLE_CUSTOM_COMPILER_FLAGS=OFF
|
2019-05-30 05:24:41 +08:00
|
|
|
-DENABLE_FUZZING=OFF
|
2024-09-04 03:25:32 +08:00
|
|
|
-DCMAKE_POLICY_DEFAULT_CMP0057=NEW
|
2019-12-03 02:39:21 +08:00
|
|
|
${FEATURE_OPTIONS}
|
2019-05-30 05:24:41 +08:00
|
|
|
)
|
|
|
|
|
2021-09-24 08:50:47 +08:00
|
|
|
vcpkg_cmake_install()
|
2019-05-30 05:24:41 +08:00
|
|
|
|
|
|
|
vcpkg_copy_pdbs()
|
|
|
|
|
2021-09-24 08:50:47 +08:00
|
|
|
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/cJSON)
|
2019-05-30 05:24:41 +08:00
|
|
|
|
|
|
|
file(REMOVE_RECURSE
|
2021-09-24 08:50:47 +08:00
|
|
|
"${CURRENT_PACKAGES_DIR}/debug/include"
|
|
|
|
"${CURRENT_PACKAGES_DIR}/debug/share"
|
2019-05-30 05:24:41 +08:00
|
|
|
)
|
|
|
|
|
2021-09-24 08:50:47 +08:00
|
|
|
file(READ "${CURRENT_PACKAGES_DIR}/include/cjson/cJSON.h" _contents)
|
2019-05-30 05:24:41 +08:00
|
|
|
if(ENABLE_PUBLIC_SYMBOLS)
|
|
|
|
string(REPLACE "defined(CJSON_HIDE_SYMBOLS)" "0 /* defined(CJSON_HIDE_SYMBOLS) */" _contents "${_contents}")
|
|
|
|
string(REPLACE "defined(CJSON_EXPORT_SYMBOLS)" "0 /* defined(CJSON_EXPORT_SYMBOLS) */" _contents "${_contents}")
|
|
|
|
string(REPLACE "defined(CJSON_IMPORT_SYMBOLS)" "1 /* defined(CJSON_IMPORT_SYMBOLS) */" _contents "${_contents}")
|
|
|
|
else()
|
|
|
|
string(REPLACE "defined(CJSON_HIDE_SYMBOLS)" "1 /* defined(CJSON_HIDE_SYMBOLS) */" _contents "${_contents}")
|
|
|
|
endif()
|
2021-09-24 08:50:47 +08:00
|
|
|
file(WRITE "${CURRENT_PACKAGES_DIR}/include/cjson/cJSON.h" "${_contents}")
|
2019-05-30 05:24:41 +08:00
|
|
|
|
|
|
|
# Handle copyright
|
2021-09-24 08:50:47 +08:00
|
|
|
configure_file("${SOURCE_PATH}/LICENSE" "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" COPYONLY)
|
2023-09-26 14:37:00 +08:00
|
|
|
|
|
|
|
vcpkg_fixup_pkgconfig()
|