| vcpkg_from_github( |
| OUT_SOURCE_PATH SOURCE_PATH |
| REPO getml/reflect-cpp |
| REF "v${VERSION}" |
| SHA512 4be84fc69efd6f4ce766d38cedc8b1d0fd0fa8170e69293383f7dbd59c6bce45797f0e7cf653ef9c839b15fd7da702c9daf30efd34c779555fe4e5bd5eb29481 |
| HEAD_REF main |
| ) |
| |
| if(VCPKG_TARGET_IS_WINDOWS) |
| vcpkg_check_linkage(ONLY_STATIC_LIBRARY) |
| endif() |
| string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" REFLECTCPP_BUILD_SHARED) |
| |
| # Overlay of the upstream vcpkg port: adds the "avro" feature (REFLECTCPP_AVRO + |
| # avro-c), which the registry port does not expose yet. Drop this overlay once the |
| # upstream port grows the feature. |
| vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS |
| FEATURES |
| avro REFLECTCPP_AVRO |
| bson REFLECTCPP_BSON |
| capnproto REFLECTCPP_CAPNPROTO |
| cbor REFLECTCPP_CBOR |
| csv REFLECTCPP_CSV |
| flexbuffers REFLECTCPP_FLEXBUFFERS |
| msgpack REFLECTCPP_MSGPACK |
| parquet REFLECTCPP_PARQUET |
| toml REFLECTCPP_TOML |
| ubjson REFLECTCPP_UBJSON |
| xml REFLECTCPP_XML |
| yaml REFLECTCPP_YAML |
| ) |
| |
| vcpkg_cmake_configure( |
| SOURCE_PATH ${SOURCE_PATH} |
| OPTIONS |
| ${FEATURE_OPTIONS} |
| -DREFLECTCPP_BUILD_TESTS=OFF |
| -DREFLECTCPP_BUILD_SHARED=${REFLECTCPP_BUILD_SHARED} |
| -DREFLECTCPP_USE_BUNDLED_DEPENDENCIES=OFF |
| ) |
| |
| vcpkg_cmake_install() |
| |
| vcpkg_cmake_config_fixup( |
| CONFIG_PATH "lib/cmake/${PORT}" |
| ) |
| |
| if("avro" IN_LIST FEATURES) |
| # The Avro backend links the static avro-c archive, whose link interface |
| # carries jansson::jansson — but the upstream config has no Avro |
| # find_dependency block, so consumers fail at generate time with |
| # "the target was not found". Define it before the exports are included. |
| vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/${PORT}/${PORT}-config.cmake" |
| "include(\${CMAKE_CURRENT_LIST_DIR}/reflectcpp-exports.cmake)" |
| "include(CMakeFindDependencyMacro)\nfind_dependency(jansson CONFIG)\ninclude(\${CMAKE_CURRENT_LIST_DIR}/reflectcpp-exports.cmake)") |
| endif() |
| |
| file(REMOVE_RECURSE |
| "${CURRENT_PACKAGES_DIR}/debug/include" |
| "${CURRENT_PACKAGES_DIR}/debug/share" |
| ) |
| |
| vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") |
| configure_file("${CMAKE_CURRENT_LIST_DIR}/usage" "${CURRENT_PACKAGES_DIR}/share/${PORT}/usage" COPYONLY) |