xmake.lua 3.8 KB

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