2019-05-30 05:24:41 +08:00
|
|
|
vcpkg_from_github(
|
|
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
|
|
REPO DaveGamble/cJSON
|
2021-09-24 08:50:47 +08:00
|
|
|
REF v1.7.15
|
|
|
|
SHA512 0b32a758c597fcc90c8ed0af493c9bccd611b9d4f9a03e87de3f7337bb9a28990b810befd44bc321a0cb42cbcd0b026d45761f9bab7bd798f920b7b6975fb124
|
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
|
|
|
|
-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)
|