xmake.lua 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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.0.0", "602018239d23a1805d35ebda704fd5c969a0693fc513fcf7459063b628459e5b")
  8. add_versions("0.19.6", "48dc4c4abf5ab5a7c6f84b9259cc8be1b02c601d31893647ab44e143cdc4b6d5")
  9. add_versions("0.19.2", "aa3fcc494424e0e20b177125458a6a6ed39c751a3d3d5193054e88bdf8a146d2")
  10. add_configs("profiler", {description = "Enable experimental profiler API", default = false, type = "boolean"})
  11. add_configs("runtime_checks", {description = "Build CAF with extra runtime assertions", default = false, type = "boolean"})
  12. add_configs("exceptions", {description = "Build CAF with support for exceptions", default = false, type = "boolean"})
  13. add_configs("io", {description = "Build legacy networking I/O module", default = false, type = "boolean"})
  14. add_configs("net", {description = "Build networking I/O module", default = false, type = "boolean"})
  15. add_configs("openssl", {description = "Build OpenSSL module", default = false, type = "boolean"})
  16. if is_plat("windows") then
  17. add_syslinks("iphlpapi")
  18. elseif is_plat("linux", "bsd") then
  19. add_syslinks("pthread")
  20. elseif is_plat("macosx") then
  21. add_extsources("brew::caf")
  22. end
  23. add_deps("cmake")
  24. on_load(function (package)
  25. if package:config("net") or package:config("openssl") then
  26. package:add("deps", "openssl")
  27. end
  28. end)
  29. on_install("windows", "linux", "macosx", "bsd", function (package)
  30. local configs =
  31. {
  32. "-DCAF_ENABLE_EXAMPLES=OFF",
  33. "-DCAF_ENABLE_TESTING=OFF",
  34. "-DCAF_ENABLE_TOOLS=OFF",
  35. }
  36. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  37. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  38. table.insert(configs, "-DCAF_ENABLE_ACTOR_PROFILER=" .. (package:config("profiler") and "ON" or "OFF"))
  39. table.insert(configs, "-DCAF_ENABLE_RUNTIME_CHECKS=" .. (package:config("runtime_checks") and "ON" or "OFF"))
  40. table.insert(configs, "-DCAF_ENABLE_EXCEPTIONS=" .. (package:config("exceptions") and "ON" or "OFF"))
  41. table.insert(configs, "-DCAF_ENABLE_IO_MODULE=" .. (package:config("io") and "ON" or "OFF"))
  42. table.insert(configs, "-DCAF_ENABLE_NET_MODULE=" .. (package:config("net") and "ON" or "OFF"))
  43. table.insert(configs, "-DCAF_ENABLE_OPENSSL_MODULE=" .. (package:config("openssl") and "ON" or "OFF"))
  44. import("package.tools.cmake").install(package, configs)
  45. end)
  46. on_test(function (package)
  47. assert(package:check_cxxsnippets({test = [[
  48. #include <caf/actor_ostream.hpp>
  49. #include <caf/actor_system.hpp>
  50. #include <caf/event_based_actor.hpp>
  51. using namespace caf;
  52. void test(event_based_actor* self, const actor& buddy) {
  53. self->request(buddy, std::chrono::seconds(10), "Hello World!")
  54. .then([=](const std::string& what) {
  55. aout(self) << what << std::endl;
  56. });
  57. }
  58. ]]}, {configs = {languages = "c++17"}}))
  59. end)