xmake.lua 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. package("actor-framework")
  2. set_homepage("http://actor-framework.org/")
  3. set_description("An Open Source Implementation of the Actor Model in C++")
  4. set_license("BSD-3-Clause")
  5. add_urls("https://github.com/actor-framework/actor-framework/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/actor-framework/actor-framework.git")
  7. add_versions("1.1.0", "9febd85d3a4f50dac760592043028a36bea62bba50c3ee2fc1eace954dd8ae27")
  8. add_versions("1.0.2", "ef4dd00ca7c59cd61dc336b6a8efbd6150ca85c404d213ecb61f6bcee4094ffc")
  9. add_versions("1.0.1", "635bdd6e3b70886f1d9aa75c48e5bdb4084afae1f159bbfe5ea91f99b0460f6b")
  10. add_versions("1.0.0", "602018239d23a1805d35ebda704fd5c969a0693fc513fcf7459063b628459e5b")
  11. add_versions("0.19.6", "48dc4c4abf5ab5a7c6f84b9259cc8be1b02c601d31893647ab44e143cdc4b6d5")
  12. add_versions("0.19.2", "aa3fcc494424e0e20b177125458a6a6ed39c751a3d3d5193054e88bdf8a146d2")
  13. add_configs("profiler", {description = "Enable experimental profiler API", default = false, type = "boolean"})
  14. add_configs("runtime_checks", {description = "Build CAF with extra runtime assertions", default = false, type = "boolean"})
  15. add_configs("exceptions", {description = "Build CAF with support for exceptions", default = true, type = "boolean"})
  16. add_configs("io", {description = "Build legacy networking I/O module", default = false, type = "boolean"})
  17. add_configs("net", {description = "Build networking I/O module", default = false, type = "boolean"})
  18. add_configs("openssl", {description = "Build OpenSSL module", default = false, type = "boolean"})
  19. if is_plat("windows") then
  20. add_syslinks("iphlpapi")
  21. elseif is_plat("linux", "bsd") then
  22. add_syslinks("pthread")
  23. elseif is_plat("macosx") then
  24. add_extsources("brew::caf")
  25. end
  26. add_deps("cmake")
  27. on_load(function (package)
  28. if package:config("net") or package:config("openssl") then
  29. package:add("deps", "openssl")
  30. end
  31. end)
  32. on_install("windows", "linux", "macosx", "bsd", function (package)
  33. io.replace("CMakeLists.txt", "add_library(libcaf_test)", "", {plain = true})
  34. io.replace("CMakeLists.txt", "add_subdirectory(libcaf_test)", "", {plain = true})
  35. local configs =
  36. {
  37. "-DCAF_ENABLE_EXAMPLES=OFF",
  38. "-DCAF_ENABLE_TESTING=OFF",
  39. "-DCAF_ENABLE_TOOLS=OFF",
  40. }
  41. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  42. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  43. table.insert(configs, "-DCAF_ENABLE_ACTOR_PROFILER=" .. (package:config("profiler") and "ON" or "OFF"))
  44. table.insert(configs, "-DCAF_ENABLE_RUNTIME_CHECKS=" .. (package:config("runtime_checks") and "ON" or "OFF"))
  45. table.insert(configs, "-DCAF_ENABLE_EXCEPTIONS=" .. (package:config("exceptions") and "ON" or "OFF"))
  46. table.insert(configs, "-DCAF_ENABLE_IO_MODULE=" .. (package:config("io") and "ON" or "OFF"))
  47. table.insert(configs, "-DCAF_ENABLE_NET_MODULE=" .. (package:config("net") and "ON" or "OFF"))
  48. table.insert(configs, "-DCAF_ENABLE_OPENSSL_MODULE=" .. (package:config("openssl") and "ON" or "OFF"))
  49. import("package.tools.cmake").install(package, configs)
  50. end)
  51. on_test(function (package)
  52. assert(package:check_cxxsnippets({test = [[
  53. #include <caf/actor_ostream.hpp>
  54. #include <caf/actor_system.hpp>
  55. #include <caf/event_based_actor.hpp>
  56. using namespace caf;
  57. void test(event_based_actor* self, const actor& buddy) {
  58. self->request(buddy, std::chrono::seconds(10), "Hello World!")
  59. .then([=](const std::string& what) {
  60. aout(self) << what << std::endl;
  61. });
  62. }
  63. ]]}, {configs = {languages = "c++17"}}))
  64. end)