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-01-23 02:59:48 +08:00
|
|
|
SHA512 4feebafa5225297fa3e6a7bf23f8d31b5c3e172f437078c5a07528522ad58ca2e9c72dd9e8611241d2b8321e9aa0a1a9af7743689d1c2001d1d9cb624aae6fa8
|
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
|
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()
|