vcpkg/ports/librdkafka/portfile.cmake
Alexander Smyslov b8d922991f
[librdkafka] Upgrade up to 1.7 (#17937)
* Add files via upload

* [new port] avro-cpp

* add boost-format

* remove comments

* remove comments

* Upgrade librdkafka17

* Upgrade librdkafka17

* Fix remarks

* Fix remarks

Co-authored-by: Alexander Smyslov <aleksandr.smyslov@libertexgroup.com>
Co-authored-by: Smyslov Alexander Nikolayevich <aleksandr.smyslov@fxclub.com>
2021-05-18 00:45:48 -07:00

78 lines
2.2 KiB
CMake

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO edenhill/librdkafka
REF 77a013b7a2611f7bdc091afa1e56b1a46d1c52f5 #v1.7.0
SHA512 3eedfe2dcca90a392b82aa512989cdf5ecde2c7c9779aecdd619375da4e04071fdc868ce37c01948346cfa48cd6f7395cbc074edd6e36c678193791ffe7a9ed1
HEAD_REF master
)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" RDKAFKA_BUILD_STATIC)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
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)