2
0

xmake.lua 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package("amqp-cpp")
  2. set_homepage("https://github.com/CopernicaMarketingSoftware/AMQP-CPP")
  3. set_description("C++ library for asynchronous non-blocking communication with RabbitMQ")
  4. set_license("Apache-2.0")
  5. add_urls("https://github.com/CopernicaMarketingSoftware/AMQP-CPP/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/CopernicaMarketingSoftware/AMQP-CPP.git")
  7. add_versions("v4.3.27", "af649ef8b14076325387e0a1d2d16dd8395ff3db75d79cc904eb6c179c1982fe")
  8. add_versions("v4.3.26", "2baaab702f3fd9cce40563dc1e23f433cceee7ec3553bd529a98b1d3d7f7911c")
  9. if is_plat("windows", "mingw") then
  10. add_syslinks("ws2_32")
  11. elseif is_plat("linux") then
  12. add_configs("tcp", {description = "Build TCP module.", default = false, type = "boolean"})
  13. add_syslinks("pthread", "dl")
  14. end
  15. add_deps("cmake")
  16. on_install(function (package)
  17. local configs = {}
  18. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  19. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  20. if package:is_plat("windows") then
  21. package:add("defines", "NOMINMAX")
  22. if package:config("shared") and package:version():le("4.3.26") then
  23. table.insert(configs, "-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON")
  24. end
  25. elseif package:is_plat("linux") then
  26. table.insert(configs, "-DAMQP-CPP_LINUX_TCP=" .. (package:config("tcp") and "ON" or "OFF"))
  27. end
  28. import("package.tools.cmake").install(package, configs)
  29. end)
  30. on_test(function (package)
  31. assert(package:check_cxxsnippets({test = [[
  32. #include <amqpcpp.h>
  33. void test() {
  34. AMQP::Connection connection(nullptr, AMQP::Login("guest","guest"), "/");
  35. AMQP::Channel channel(nullptr);
  36. }
  37. ]]}, {configs = {languages = "c++17"}}))
  38. end)