xmake.lua 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package("websocketpp")
  2. set_kind("library", {headeronly = true})
  3. set_homepage("http://www.zaphoyd.com/websocketpp")
  4. set_description("C++ websocket client/server library")
  5. add_urls("https://github.com/zaphoyd/websocketpp/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/zaphoyd/websocketpp.git")
  7. add_versions("0.8.2", "6ce889d85ecdc2d8fa07408d6787e7352510750daa66b5ad44aacb47bea76755")
  8. add_configs("asio_standalone", {description = "Use standalone asio", default = true, type = "boolean"})
  9. add_deps("cmake")
  10. on_load(function (package)
  11. if package:config("asio_standalone") then
  12. package:add("defines", "ASIO_STANDALONE", "_WEBSOCKETPP_CPP11_STL_")
  13. package:add("deps", "asio 1.32.0")
  14. package:add("deps", "boost", {configs = {system = true, regex = true, thread = true, type_traits = true}})
  15. else
  16. package:add("deps", "boost", {configs = {system = true, asio = true, regex = true, thread = true}})
  17. -- Compatibility fixes for Boost 1.87 Reference to PR https://github.com/zaphoyd/websocketpp/pull/1164
  18. package:add("patches", "0.8.2", [[https://github.com/zaphoyd/websocketpp/compare/0.8.2%2E%2E%2Eamini-allight%3Awebsocketpp%3Adevelop.diff]], "5396d10ebe593f031580b3c3683f205a8d4c57f2d0942d48c5a4b74e64365f97")
  19. end
  20. end)
  21. on_install("!wasm", function (package)
  22. local configs = {"-DCMAKE_POLICY_DEFAULT_CMP0057=NEW"}
  23. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  24. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  25. import("package.tools.cmake").install(package, configs)
  26. end)
  27. on_test(function (package)
  28. assert(package:check_cxxsnippets({test = [[
  29. #include <websocketpp/config/asio_no_tls.hpp>
  30. #include <websocketpp/server.hpp>
  31. typedef websocketpp::server<websocketpp::config::asio> server;
  32. void test() {
  33. server echo_server;
  34. }
  35. ]]}, {configs = {languages = "c++17"}}))
  36. end)