Skip to content

Commit

Permalink
[cppkafka] bumped to 0.4.0 (#31182)
Browse files Browse the repository at this point in the history
In this version some of the issues were solved:
1. No need for dynamic fix patch as it was solved inside the project.
2. CMake configs are installed
  • Loading branch information
krjakbrjak authored May 2, 2023
1 parent 845b321 commit fbec0d7
Show file tree
Hide file tree
Showing 7 changed files with 96 additions and 20 deletions.
38 changes: 38 additions & 0 deletions ports/cppkafka/0001-Fix-static-lib.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
From fb7cbb0648948b51f71aefaa6b2354846f72439f Mon Sep 17 00:00:00 2001
From: Nikita Vakula <programmistov.programmist@gmail.com>
Date: Mon, 1 May 2023 23:12:09 +0200
Subject: [PATCH 1/2] Use correct rdkafka .pc

Signed-off-by: Nikita Vakula <programmistov.programmist@gmail.com>
---
CMakeLists.txt | 1 +
cmake/cppkafka.pc.in | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c4e44e6..e34c071 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -92,6 +92,7 @@ endif()

if (CPPKAFKA_RDKAFKA_STATIC_LIB)
add_definitions("-DLIBRDKAFKA_STATICLIB")
+ set(RDKAFKA_STATIC "-static")
endif()

if (NOT CPPKAFKA_CONFIG_DIR)
diff --git a/cmake/cppkafka.pc.in b/cmake/cppkafka.pc.in
index b5d432c..4e50860 100644
--- a/cmake/cppkafka.pc.in
+++ b/cmake/cppkafka.pc.in
@@ -9,6 +9,6 @@ Url: https://github.com/mfontanini/cppkafka
Description: C++ wrapper library on top of RdKafka
Version: @CPPKAFKA_VERSION@
Requires:
-Requires.private: rdkafka >= 0.9.4
+Requires.private: rdkafka@RDKAFKA_STATIC@ >= 0.9.4
Libs: -L${libdir} -L${sharedlibdir} -lcppkafka
Cflags: -I${includedir} -I${includedir}/cppkafka -I@Boost_INCLUDE_DIRS@
--
2.37.1 (Apple Git-137.1)

27 changes: 27 additions & 0 deletions ports/cppkafka/0002-Remove-min-max-macros.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
From e2c9c0a1cee07c6cacedd682d3506b447c2c561b Mon Sep 17 00:00:00 2001
From: Nikita Vakula <programmistov.programmist@gmail.com>
Date: Mon, 1 May 2023 23:11:19 +0200
Subject: [PATCH 2/2] Remove min/max macros

Signed-off-by: Nikita Vakula <programmistov.programmist@gmail.com>
---
src/CMakeLists.txt | 3 +++
1 file changed, 3 insertions(+)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 5b8649b..5c818ee 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -36,6 +36,9 @@ set(NAMESPACE "${PROJECT_NAME}::")
set(TARGET_EXPORT_NAME ${PROJECT_NAME}Targets)

add_library(${TARGET_NAME} ${CPPKAFKA_LIBRARY_TYPE} ${SOURCES})
+if (MSVC)
+ target_compile_definitions(${TARGET_NAME} PRIVATE NOMINMAX)
+endif ()
target_include_directories(${TARGET_NAME} PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include/cppkafka>)
set_target_properties(${TARGET_NAME} PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_INSTALL_LIBDIR}"
--
2.37.1 (Apple Git-137.1)

12 changes: 0 additions & 12 deletions ports/cppkafka/fix-dynamic.patch

This file was deleted.

23 changes: 19 additions & 4 deletions ports/cppkafka/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,32 +1,47 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO mfontanini/cppkafka
REF "v${VERSION}"
SHA512 60d01ce1dd9bd9119676be939ed5ab03539abb1f945c1b31e432edfe0f06542778f7fef37696f5ff19c53024f44d5cbd8aeddbbb231c38b098e05285d3ff0cab
REF "${VERSION}"
SHA512 86ac1500bdf6746a5e44e9ca4a4063eabcacec68b26c6846f7e7d47fe947309fc98a47986ab060d793096665d1cdc24044334267eb579cdb191f539bf96a3294
HEAD_REF master
PATCHES fix-dynamic.patch
PATCHES
0001-Fix-static-lib.patch
0002-Remove-min-max-macros.patch
)

if (VCPKG_LIBRARY_LINKAGE STREQUAL "static")
set(CPPKAFKA_BUILD_SHARED OFF)
set(CPPKAFKA_RDKAFKA_STATIC_LIB ON)
else()
set(CPPKAFKA_BUILD_SHARED ON)
set(CPPKAFKA_RDKAFKA_STATIC_LIB OFF)
endif()

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
DISABLE_PARALLEL_CONFIGURE
OPTIONS
-DCMAKE_CXX_STANDARD=11
-DCPPKAFKA_BUILD_SHARED=${CPPKAFKA_BUILD_SHARED}
-DCPPKAFKA_DISABLE_TESTS=ON
-DCPPKAFKA_DISABLE_EXAMPLES=ON
-DCPPKAFKA_PKGCONFIG_DIR=lib/pkgconfig
-DCPPKAFKA_RDKAFKA_STATIC_LIB=${CPPKAFKA_RDKAFKA_STATIC_LIB}
)

vcpkg_cmake_install()

vcpkg_copy_pdbs()

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
vcpkg_cmake_config_fixup(
CONFIG_PATH lib/cmake/CppKafka
)

file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/share"
)

# Handle copyright
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
vcpkg_fixup_pkgconfig()
7 changes: 5 additions & 2 deletions ports/cppkafka/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "cppkafka",
"version": "0.3.1",
"port-version": 5,
"version": "0.4.0",
"description": "cppkafka allows C++ applications to consume and produce messages using the Apache Kafka protocol. The library is built on top of librdkafka, and provides a high level API that uses modern C++ features to make it easier to write code while keeping the wrapper's performance overhead to a minimum.",
"homepage": "https://github.com/mfontanini/cppkafka",
"license": "BSD-2-Clause",
Expand All @@ -11,6 +10,10 @@
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}
4 changes: 2 additions & 2 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -1785,8 +1785,8 @@
"port-version": 3
},
"cppkafka": {
"baseline": "0.3.1",
"port-version": 5
"baseline": "0.4.0",
"port-version": 0
},
"cppmicroservices": {
"baseline": "3.6.0",
Expand Down
5 changes: 5 additions & 0 deletions versions/c-/cppkafka.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "708cf007605104bc59394d47c9937b203c155b37",
"version": "0.4.0",
"port-version": 0
},
{
"git-tree": "a33f71df221cb16bb2f7b1ce5d9cd0043a525e00",
"version": "0.3.1",
Expand Down

0 comments on commit fbec0d7

Please sign in to comment.