diff options
Diffstat (limited to 'vcpkg/ports/pulsar-client-cpp')
| -rw-r--r-- | vcpkg/ports/pulsar-client-cpp/disable-warnings.patch | 12 | ||||
| -rw-r--r-- | vcpkg/ports/pulsar-client-cpp/portfile.cmake | 42 | ||||
| -rw-r--r-- | vcpkg/ports/pulsar-client-cpp/unofficial-pulsar-config.cmake | 84 | ||||
| -rw-r--r-- | vcpkg/ports/pulsar-client-cpp/usage | 4 | ||||
| -rw-r--r-- | vcpkg/ports/pulsar-client-cpp/vcpkg.json | 49 |
5 files changed, 191 insertions, 0 deletions
diff --git a/vcpkg/ports/pulsar-client-cpp/disable-warnings.patch b/vcpkg/ports/pulsar-client-cpp/disable-warnings.patch new file mode 100644 index 0000000..644015e --- /dev/null +++ b/vcpkg/ports/pulsar-client-cpp/disable-warnings.patch @@ -0,0 +1,12 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b004653..4b7abd9 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -88,7 +88,6 @@ elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + # ?? Don't have this to test with + else() # GCC or Clang are mostly compatible: + # Turn on warnings and enable warnings-as-errors: +- add_compile_options(-Wall -Wformat-security -Wvla -Werror) + # Turn off certain warnings that are too much pain for too little gain: + add_compile_options(-Wno-sign-compare -Wno-deprecated-declarations -Wno-error=cpp) + if (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" OR APPLE) diff --git a/vcpkg/ports/pulsar-client-cpp/portfile.cmake b/vcpkg/ports/pulsar-client-cpp/portfile.cmake new file mode 100644 index 0000000..47541d6 --- /dev/null +++ b/vcpkg/ports/pulsar-client-cpp/portfile.cmake @@ -0,0 +1,42 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO apache/pulsar-client-cpp + REF "v${VERSION}" + SHA512 28c828529cc59ace8b9da97a724191a3314c5cfc36a9cf9a91b25b99b70ca2875bc9f8780f26770dc426a2641ad465bb2a47ba501921442fd712fa76edcbc5aa + HEAD_REF main + PATCHES + disable-warnings.patch +) + +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" BUILD_STATIC_LIB) +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" BUILD_DYNAMIC_LIB) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DINTEGRATE_VCPKG=ON + -DBUILD_TESTS=OFF + -DBUILD_PERF_TOOLS=OFF + -DBUILD_DYNAMIC_LIB=${BUILD_DYNAMIC_LIB} + -DBUILD_STATIC_LIB=${BUILD_STATIC_LIB} +) + +vcpkg_cmake_install() + +if (BUILD_STATIC_LIB) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/pulsar/defines.h" + "#ifdef PULSAR_STATIC" + "#if 1") +endif () + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin") +endif() + +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") +configure_file("${CMAKE_CURRENT_LIST_DIR}/usage" "${CURRENT_PACKAGES_DIR}/share/${PORT}/usage" COPYONLY) + +configure_file("${CMAKE_CURRENT_LIST_DIR}/unofficial-pulsar-config.cmake" "${CURRENT_PACKAGES_DIR}/share/unofficial-pulsar/unofficial-pulsar-config.cmake" @ONLY) + +vcpkg_copy_pdbs() diff --git a/vcpkg/ports/pulsar-client-cpp/unofficial-pulsar-config.cmake b/vcpkg/ports/pulsar-client-cpp/unofficial-pulsar-config.cmake new file mode 100644 index 0000000..3ae79af --- /dev/null +++ b/vcpkg/ports/pulsar-client-cpp/unofficial-pulsar-config.cmake @@ -0,0 +1,84 @@ +if (NOT TARGET unofficial::pulsar::pulsar) + get_filename_component(VCPKG_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH) + get_filename_component(VCPKG_IMPORT_PREFIX "${VCPKG_IMPORT_PREFIX}" PATH) + get_filename_component(VCPKG_IMPORT_PREFIX "${VCPKG_IMPORT_PREFIX}" PATH) + + find_path(_pulsar_include_dir NAMES "pulsar/Client.h" PATHS "${VCPKG_IMPORT_PREFIX}/include" NO_DEFAULT_PATH) + find_library(_pulsar_library_release NAMES pulsar pulsar-static PATHS "${VCPKG_IMPORT_PREFIX}/lib" NO_DEFAULT_PATH) + find_library(_pulsar_library_debug NAMES pulsar pulsar-static PATHS "${VCPKG_IMPORT_PREFIX}/debug/lib" NO_DEFAULT_PATH) + message(STATUS "Found _pulsar_library_release: ${_pulsar_library_release}") + message(STATUS "Found _pulsar_library_debug: ${_pulsar_library_debug}") + if (NOT _pulsar_include_dir OR NOT _pulsar_library_release) + message(FATAL_ERROR "Broken installation of vcpkg port pulsar-client-cpp") + endif () + + if (MSVC AND "@VCPKG_LIBRARY_LINKAGE@" STREQUAL "dynamic") + find_file(_pulsar_release_dll NAMES "pulsar.dll" PATHS "${VCPKG_IMPORT_PREFIX}/bin" NO_DEFAULT_PATH) + find_file(_pulsar_debug_dll NAMES "pulsar.dll" PATHS "${VCPKG_IMPORT_PREFIX}/debug/bin" NO_DEFAULT_PATH) + if (NOT _pulsar_release_dll) + message(FATAL_ERROR "No pulsar.dll found") + endif () + message(STATUS "Found _pulsar_release_dll: ${_pulsar_release_dll}") + message(STATUS "Found _pulsar_debug_dll: ${_pulsar_debug_dll}") + endif () + + # When CMAKE_BUILD_TYPE is not specified, debug libraries will be found for dependencies except ZLIB. + # So set it with Debug here to link debug ZLIB library by default. + if (NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Debug) + endif () + + include(CMakeFindDependencyMacro) + find_dependency(OpenSSL) + find_dependency(ZLIB) + find_dependency(protobuf CONFIG) + find_dependency(CURL CONFIG) + find_dependency(zstd CONFIG) + find_dependency(Snappy CONFIG) + if (MSVC) + find_dependency(dlfcn-win32 CONFIG) + endif () + + if (_pulsar_release_dll) + add_library(unofficial::pulsar::pulsar SHARED IMPORTED) + set_target_properties(unofficial::pulsar::pulsar PROPERTIES + IMPORTED_CONFIGURATIONS "RELEASE" + IMPORTED_IMPLIB_RELEASE "${_pulsar_library_release}" + IMPORTED_LOCATION_RELEASE "${_pulsar_release_dll}") + if (_pulsar_debug_dll) + set_target_properties(unofficial::pulsar::pulsar PROPERTIES + IMPORTED_CONFIGURATIONS "DEBUG;RELEASE" + IMPORTED_IMPLIB_DEBUG "${_pulsar_library_debug}" + IMPORTED_LOCATION_DEBUG "${_pulsar_debug_dll}") + unset(_pulsar_debug_dll CACHE) + endif () + unset(_pulsar_release_dll CACHE) + else () + add_library(unofficial::pulsar::pulsar UNKNOWN IMPORTED) + set_target_properties(unofficial::pulsar::pulsar PROPERTIES + IMPORTED_CONFIGURATIONS "RELEASE" + IMPORTED_LOCATION_RELEASE "${_pulsar_library_release}") + if (_pulsar_library_debug) + set_target_properties(unofficial::pulsar::pulsar PROPERTIES + IMPORTED_CONFIGURATIONS "DEBUG;RELEASE" + IMPORTED_LOCATION_DEBUG "${_pulsar_library_debug}") + unset(_pulsar_library_debug CACHE) + endif () + endif () + set_target_properties(unofficial::pulsar::pulsar PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${_pulsar_include_dir}") + target_link_libraries(unofficial::pulsar::pulsar INTERFACE + OpenSSL::SSL + OpenSSL::Crypto + ZLIB::ZLIB + protobuf::libprotobuf + CURL::libcurl + $<IF:$<TARGET_EXISTS:zstd::libzstd_shared>,zstd::libzstd_shared,zstd::libzstd_static> + Snappy::snappy + ) + if (MSVC) + target_link_libraries(unofficial::pulsar::pulsar INTERFACE dlfcn-win32::dl) + endif () + unset(_pulsar_library_release CACHE) + unset(_pulsar_include_dir CACHE) +endif () diff --git a/vcpkg/ports/pulsar-client-cpp/usage b/vcpkg/ports/pulsar-client-cpp/usage new file mode 100644 index 0000000..474d73f --- /dev/null +++ b/vcpkg/ports/pulsar-client-cpp/usage @@ -0,0 +1,4 @@ +pulsar-client-cpp provides CMake targets: + + find_package(unofficial-pulsar CONFIG REQUIRED) + target_link_libraries(main PRIVATE unofficial::pulsar::pulsar) diff --git a/vcpkg/ports/pulsar-client-cpp/vcpkg.json b/vcpkg/ports/pulsar-client-cpp/vcpkg.json new file mode 100644 index 0000000..c4aa911 --- /dev/null +++ b/vcpkg/ports/pulsar-client-cpp/vcpkg.json @@ -0,0 +1,49 @@ +{ + "name": "pulsar-client-cpp", + "version": "3.7.0", + "description": "The Apache Pulsar C++ library", + "homepage": "https://github.com/apache/pulsar-client-cpp", + "license": "Apache-2.0", + "supports": "!(arm & windows) & !android", + "dependencies": [ + "asio", + "boost-accumulators", + "boost-algorithm", + "boost-any", + "boost-circular-buffer", + "boost-date-time", + "boost-format", + "boost-predef", + "boost-property-tree", + "boost-random", + "boost-serialization", + "boost-xpressive", + { + "name": "curl", + "default-features": false, + "features": [ + "openssl" + ] + }, + { + "name": "dlfcn-win32", + "platform": "windows" + }, + "openssl", + { + "name": "protobuf", + "version>=": "3.21.12" + }, + "snappy", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + }, + "zlib", + "zstd" + ] +} |