From 87c6ecb20d469e4431cd7b908c8bf51bae5bb25d Mon Sep 17 00:00:00 2001 From: Nick D'Ademo Date: Wed, 3 Dec 2025 07:39:47 +0800 Subject: [PATCH] [simpleamqpclient] new port (#48609) --- ports/simpleamqpclient/portfile.cmake | 33 ++++++++++++++ .../rabbitmqc-use-find-package-config.patch | 40 +++++++++++++++++ ports/simpleamqpclient/vcpkg.json | 43 +++++++++++++++++++ versions/baseline.json | 4 ++ versions/s-/simpleamqpclient.json | 9 ++++ 5 files changed, 129 insertions(+) create mode 100644 ports/simpleamqpclient/portfile.cmake create mode 100644 ports/simpleamqpclient/rabbitmqc-use-find-package-config.patch create mode 100644 ports/simpleamqpclient/vcpkg.json create mode 100644 versions/s-/simpleamqpclient.json diff --git a/ports/simpleamqpclient/portfile.cmake b/ports/simpleamqpclient/portfile.cmake new file mode 100644 index 0000000000..462b184328 --- /dev/null +++ b/ports/simpleamqpclient/portfile.cmake @@ -0,0 +1,33 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO alanxz/SimpleAmqpClient + REF "v${VERSION}" + SHA512 f561a45774da55e7b846e6cab7fbcdabb0a6deb462450ca9e8a0e37acccb33957daeb29f31b24671934139f29f8c02c14ba53ce5fdf05b5349f7d6c041e4a6ab + HEAD_REF master + PATCHES + rabbitmqc-use-find-package-config.patch +) + +vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY) + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + ssl ENABLE_SSL_SUPPORT +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + ${FEATURE_OPTIONS} + -DBUILD_SHARED_LIBS=ON + -DENABLE_TESTING=OFF +) + +vcpkg_cmake_install() +vcpkg_copy_pdbs() + +vcpkg_fixup_pkgconfig() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") + +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE-MIT") \ No newline at end of file diff --git a/ports/simpleamqpclient/rabbitmqc-use-find-package-config.patch b/ports/simpleamqpclient/rabbitmqc-use-find-package-config.patch new file mode 100644 index 0000000000..b25c4580bf --- /dev/null +++ b/ports/simpleamqpclient/rabbitmqc-use-find-package-config.patch @@ -0,0 +1,40 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index efefbfc..ae4b1fc 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -52,11 +52,32 @@ find_package(Boost 1.47.0 COMPONENTS chrono system REQUIRED) + include_directories(SYSTEM ${Boost_INCLUDE_DIRS}) + link_directories(${Boost_LIBRARY_DIRS}) + +-set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Modules) +-find_package(Rabbitmqc REQUIRED) +-INCLUDE_DIRECTORIES(SYSTEM ${Rabbitmqc_INCLUDE_DIRS}) ++find_package(rabbitmq-c CONFIG REQUIRED) ++if (TARGET rabbitmq::rabbitmq) ++ set(Rabbitmqc_LIBRARY rabbitmq::rabbitmq) ++elseif (TARGET rabbitmq::rabbitmq-static) ++ set(Rabbitmqc_LIBRARY rabbitmq::rabbitmq-static) ++else() ++ message(FATAL_ERROR "Failed to find rabbitmq-c target") ++endif() ++get_target_property(Rabbitmqc_INCLUDE_DIRS ${Rabbitmqc_LIBRARY} INTERFACE_INCLUDE_DIRECTORIES) ++include_directories(SYSTEM ${Rabbitmqc_INCLUDE_DIRS}) ++find_file(_Rabbitmqc_SSL_HEADER ++ NAMES amqp_ssl_socket.h ++ PATHS ${Rabbitmqc_INCLUDE_DIRS} ++ NO_DEFAULT_PATH ++) ++if (_Rabbitmqc_SSL_HEADER) ++ set(_ssl_enabled TRUE) ++else() ++ set(_ssl_enabled FALSE) ++endif() ++set(Rabbitmqc_SSL_ENABLED ${_ssl_enabled} CACHE BOOL "Rabbitmqc is SSL Enabled" FORCE) + + option(ENABLE_SSL_SUPPORT "Enable SSL support." ${Rabbitmqc_SSL_ENABLED}) ++if (ENABLE_SSL_SUPPORT AND NOT Rabbitmqc_SSL_ENABLED) ++ message(FATAL_ERROR "SSL support requested but rabbitmq-c was not built with SSL") ++endif() + + if (ENABLE_SSL_SUPPORT) + add_definitions(-DSAC_SSL_SUPPORT_ENABLED) diff --git a/ports/simpleamqpclient/vcpkg.json b/ports/simpleamqpclient/vcpkg.json new file mode 100644 index 0000000000..1dc16674d8 --- /dev/null +++ b/ports/simpleamqpclient/vcpkg.json @@ -0,0 +1,43 @@ +{ + "name": "simpleamqpclient", + "version": "2.5.1", + "description": "Simple C++ Interface to rabbitmq-c", + "homepage": "https://github.com/alanxz/SimpleAmqpClient", + "license": "MIT", + "supports": "!static", + "dependencies": [ + "boost-algorithm", + "boost-chrono", + "boost-foreach", + "boost-lexical-cast", + "boost-optional", + "boost-smart-ptr", + "boost-variant", + { + "name": "librabbitmq", + "default-features": false + }, + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "features": { + "ssl": { + "description": "Enable SSL support", + "dependencies": [ + { + "name": "librabbitmq", + "default-features": false, + "features": [ + "ssl" + ] + } + ] + } + } +} diff --git a/versions/baseline.json b/versions/baseline.json index d407eeb41a..aafbaf716b 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -9072,6 +9072,10 @@ "baseline": "2020-06-14", "port-version": 2 }, + "simpleamqpclient": { + "baseline": "2.5.1", + "port-version": 0 + }, "simpleble": { "baseline": "0.8.1", "port-version": 1 diff --git a/versions/s-/simpleamqpclient.json b/versions/s-/simpleamqpclient.json new file mode 100644 index 0000000000..b14940a7ee --- /dev/null +++ b/versions/s-/simpleamqpclient.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "9c25f58a60e5cbb2aa678a53587478a61a406398", + "version": "2.5.1", + "port-version": 0 + } + ] +}