mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-22 15:55:39 +08:00
a3a6530631
* [vcpkg_check_features] Set OUT_EXPAND_OPTIONS explicitly * [vcpkg_check_features] Allow reverse logic for features * [vcpkg_check_features] Document new parameters * [vcpkg_check_features] Remove unnecessary logging * Do not create variables for each feature only set OUT_FEATURE_OPTIONS * Improve documentation * Update ports that use vcpkg_check_features() * Missing documentation updates * [pcl] Fix tools feature * [opencv,opencv4] Fix usage of vcpkg_check_features() * [opencv4] Fix typo
84 lines
2.3 KiB
CMake
84 lines
2.3 KiB
CMake
include(vcpkg_common_functions)
|
|
|
|
vcpkg_from_github(
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
REPO edenhill/librdkafka
|
|
REF v1.1.0
|
|
SHA512 35561399b07278a09a51245c5503c86eb0cc8971692b4e65a332144bfb71e2e86d4ceaf1804534b6a416bcace74cef493b6465c20b32c14de97f45f2854359c6
|
|
HEAD_REF master
|
|
PATCHES
|
|
fix-arm64.patch
|
|
)
|
|
|
|
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" RDKAFKA_BUILD_STATIC)
|
|
|
|
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
|
lz4 ENABLE_LZ4_EXT
|
|
ssl WITH_SSL
|
|
zlib WITH_ZLIB
|
|
zstd WITH_ZSTD
|
|
snappy WITH_SNAPPY
|
|
)
|
|
|
|
vcpkg_configure_cmake(
|
|
SOURCE_PATH ${SOURCE_PATH}
|
|
PREFER_NINJA
|
|
OPTIONS
|
|
-DRDKAFKA_BUILD_STATIC=${RDKAFKA_BUILD_STATIC}
|
|
-DRDKAFKA_BUILD_EXAMPLES=OFF
|
|
-DRDKAFKA_BUILD_TESTS=OFF
|
|
-DWITH_BUNDLED_SSL=OFF
|
|
${FEATURE_OPTIONS}
|
|
OPTIONS_DEBUG
|
|
-DENABLE_DEVEL=ON
|
|
-DENABLE_REFCNT_DEBUG=ON
|
|
-DENABLE_SHAREDPTR_DEBUG=ON
|
|
-DWITHOUT_OPTIMIZATION=ON
|
|
OPTIONS_RELEASE
|
|
-DENABLE_DEVEL=OFF
|
|
-DENABLE_REFCNT_DEBUG=OFF
|
|
-DENABLE_SHAREDPTR_DEBUG=OFF
|
|
-DWITHOUT_OPTIMIZATION=OFF
|
|
)
|
|
|
|
vcpkg_install_cmake()
|
|
|
|
vcpkg_copy_pdbs()
|
|
|
|
vcpkg_fixup_cmake_targets(
|
|
CONFIG_PATH lib/cmake/RdKafka
|
|
TARGET_PATH share/rdkafka
|
|
)
|
|
|
|
if("lz4" IN_LIST FEATURES)
|
|
vcpkg_replace_string(
|
|
${CURRENT_PACKAGES_DIR}/share/rdkafka/RdKafkaConfig.cmake
|
|
"find_dependency(LZ4)"
|
|
"include(\"\${CMAKE_CURRENT_LIST_DIR}/FindLZ4.cmake\")\n find_dependency(LZ4)"
|
|
)
|
|
endif()
|
|
|
|
file(REMOVE_RECURSE
|
|
${CURRENT_PACKAGES_DIR}/debug/include
|
|
${CURRENT_PACKAGES_DIR}/debug/share
|
|
)
|
|
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
|
|
foreach(hdr rdkafka.h rdkafkacpp.h)
|
|
vcpkg_replace_string(
|
|
${CURRENT_PACKAGES_DIR}/include/librdkafka/${hdr}
|
|
"#ifdef LIBRDKAFKA_STATICLIB"
|
|
"#if 1 // #ifdef LIBRDKAFKA_STATICLIB"
|
|
)
|
|
endforeach()
|
|
endif()
|
|
|
|
# Handle copyright
|
|
configure_file(${SOURCE_PATH}/LICENSES.txt ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY)
|
|
|
|
# Install usage
|
|
configure_file(${CMAKE_CURRENT_LIST_DIR}/usage ${CURRENT_PACKAGES_DIR}/share/${PORT}/usage @ONLY)
|
|
|
|
# CMake integration test
|
|
vcpkg_test_cmake(PACKAGE_NAME RdKafka)
|