From 0f51cca07b3cfe2ec0647b20b060853449ea7b53 Mon Sep 17 00:00:00 2001 From: edward zhu Date: Mon, 3 Apr 2023 17:21:28 +0800 Subject: [PATCH] add pulsar (#1965) * add pulsar * use `check_cxxsnippets` in `on_test` * add dep zstd --------- Co-authored-by: zhuhaisheng --- packages/p/pulsar/xmake.lua | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 packages/p/pulsar/xmake.lua diff --git a/packages/p/pulsar/xmake.lua b/packages/p/pulsar/xmake.lua new file mode 100644 index 000000000..51692a64b --- /dev/null +++ b/packages/p/pulsar/xmake.lua @@ -0,0 +1,34 @@ +package("pulsar") + set_homepage("https://github.com/apache/pulsar-client-cpp") + set_description("Pulsar C++ client library") + + add_urls("https://github.com/apache/pulsar-client-cpp/archive/refs/tags/v$(version).tar.gz") + + add_versions("3.1.2", "802792e8dd48f21dea0cb9cee7afe20f2598d333d2e484a362504763d1e3d49a") + + add_deps("boost 1.81.0", "protobuf-cpp", "libcurl", "openssl", "zlib", "zstd", "snappy") + + on_install("linux", function (package) + local configs = {"-DBUILD_TESTS=OFF"} + if package:config("shared") then + configs = table.join(configs, {"-DBUILD_STATIC_LIB=OFF", "-DBUILD_DYNAMIC_LIB=ON"}) + else + configs = table.join(configs, {"-DBUILD_STATIC_LIB=ON", "-DBUILD_DYNAMIC_LIB=OFF"}) + end + import("package.tools.cmake").install(package, configs, {packagedeps = {"zstd", "snappy"}}) + end) + + on_test(function (package) + assert(package:check_cxxsnippets({test = [[ + #include + #include + + void test(int argc, char** argv) { + try { + pulsar::Client client {"some_invalid_svc_url"}; + } catch (std::invalid_argument) { + std::cout << "invalid argument" << std::endl; + } + } + ]]}, {configs = {languages = "cxx11"}})) + end)