vcpkg/ports/librdkafka/portfile.cmake

78 lines
2.2 KiB
CMake
Raw Normal View History

2019-03-11 17:59:31 +08:00
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO edenhill/librdkafka
REF "v${VERSION}"
SHA512 a68b7382ec5a9afc0eb8513e97d8563c599021d774f7790a61af80565600678a497e4957dcdd823f8b9a426a19b9c5392cacd42d02d70493d993319f3343fe96
2019-03-11 17:59:31 +08:00
HEAD_REF master
PATCHES
lz4.patch
2019-03-11 17:59:31 +08:00
)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" RDKAFKA_BUILD_STATIC)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
ssl WITH_SSL
ssl WITH_SASL_OAUTHBEARER
ssl WITH_SASL_SCRAM
zlib WITH_ZLIB
zstd WITH_ZSTD
snappy WITH_SNAPPY
curl WITH_CURL
curl WITH_OAUTHBEARER_OIDC
)
2019-04-30 18:28:17 +08:00
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
2019-03-11 17:59:31 +08:00
OPTIONS
-DRDKAFKA_BUILD_STATIC=${RDKAFKA_BUILD_STATIC}
-DRDKAFKA_BUILD_EXAMPLES=OFF
2019-05-28 08:21:20 +08:00
-DRDKAFKA_BUILD_TESTS=OFF
-DWITH_BUNDLED_SSL=OFF
${FEATURE_OPTIONS}
2019-03-11 17:59:31 +08:00
OPTIONS_DEBUG
-DENABLE_SHAREDPTR_DEBUG=ON
2019-03-11 17:59:31 +08:00
-DENABLE_DEVEL=ON
2022-03-17 05:32:59 +08:00
-DENABLE_REFCNT_DEBUG=OFF
2019-03-11 17:59:31 +08:00
-DENABLE_SHAREDPTR_DEBUG=ON
2019-04-03 18:50:39 +08:00
-DWITHOUT_OPTIMIZATION=ON
2019-03-11 17:59:31 +08:00
OPTIONS_RELEASE
-DENABLE_SHAREDPTR_DEBUG=OFF
2019-03-11 17:59:31 +08:00
-DENABLE_DEVEL=OFF
-DENABLE_REFCNT_DEBUG=OFF
-DENABLE_SHAREDPTR_DEBUG=OFF
2019-04-03 18:50:39 +08:00
-DWITHOUT_OPTIMIZATION=OFF
2019-03-11 17:59:31 +08:00
)
vcpkg_cmake_install()
2019-03-11 17:59:31 +08:00
vcpkg_copy_pdbs()
vcpkg_cmake_config_fixup(
PACKAGE_NAME RdKafka
CONFIG_PATH lib/cmake/RdKafka
)
2019-03-11 17:59:31 +08:00
file(REMOVE_RECURSE
2022-03-17 05:32:59 +08:00
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/share"
2019-03-11 17:59:31 +08:00
)
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
foreach(hdr rdkafka.h rdkafkacpp.h)
vcpkg_replace_string(
2022-03-17 05:32:59 +08:00
"${CURRENT_PACKAGES_DIR}/include/librdkafka/${hdr}"
2019-03-11 17:59:31 +08:00
"#ifdef LIBRDKAFKA_STATICLIB"
"#if 1 // #ifdef LIBRDKAFKA_STATICLIB"
)
endforeach()
endif()
# Handle copyright
2022-03-17 05:32:59 +08:00
configure_file("${SOURCE_PATH}/LICENSES.txt" "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" COPYONLY)
2019-05-07 08:13:10 +08:00
# Install usage
2022-03-17 05:32:59 +08:00
configure_file("${CMAKE_CURRENT_LIST_DIR}/usage" "${CURRENT_PACKAGES_DIR}/share/${PORT}/usage" @ONLY)
vcpkg_fixup_pkgconfig()