xmake.lua 3.2 KB

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