xmake.lua 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. package("cpp-rotor")
  2. set_homepage("https://github.com/basiliscos/cpp-rotor")
  3. set_description("Event loop friendly C++ actor micro-framework, supervisable")
  4. set_license("MIT")
  5. add_urls("https://github.com/basiliscos/cpp-rotor/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/basiliscos/cpp-rotor.git", {submodules = false})
  7. add_versions("v0.30", "d143bfce1d18d42ab0f072acfe239d1cc07a495411537579e02260673cbe8121")
  8. add_configs("boost_asio", {description = "Build with boost:asio", default = false, type = "boolean"})
  9. add_configs("libev", {description = "Build with libev", default = false, type = "boolean"})
  10. add_configs("fltk", {description = "Build with fltk", default = false, type = "boolean"})
  11. add_configs("thread", {description = "Build with thread", default = false, type = "boolean"})
  12. add_configs("multithreading", {description = "Build with multithreading", default = false, type = "boolean"})
  13. add_deps("cmake")
  14. add_deps("boost", {configs = {date_time = true, regex = true, system = true}})
  15. on_load(function (package)
  16. if package:config("boost_asio") or package:config("thread") then
  17. if package:is_plat("linux", "bsd") then
  18. package:add("syslinks", "pthread")
  19. end
  20. end
  21. if package:config("libev") then
  22. package:add("deps", "libev")
  23. end
  24. if package:config("fltk") then
  25. package:add("deps", "fltk")
  26. end
  27. if package:config("multithreading") then
  28. package:add("defines", "ROTOR_REFCOUNT_THREADUNSAFE")
  29. end
  30. if not package:config("shared") then
  31. package:add("defines", "ROTOR_STATIC_DEFINE")
  32. end
  33. end)
  34. on_install("windows", "linux", "macosx", "bsd", "mingw", "cross", function (package)
  35. local configs = {"-DBUILD_TESTING=OFF"}
  36. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  37. table.insert(configs, "-DROTOR_DEBUG_DELIVERY=" .. (package:is_debug() and "ON" or "OFF"))
  38. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  39. if package:is_plat("windows") then
  40. table.insert(configs, "-DBoost_USE_STATIC_RUNTIME=" .. (package:has_runtime("MT", "MTd") and "ON" or "OFF"))
  41. end
  42. table.insert(configs, "-DBUILD_BOOST_ASIO=" .. (package:config("boost_asio") and "ON" or "OFF"))
  43. table.insert(configs, "-DBUILD_EV=" .. (package:config("libev") and "ON" or "OFF"))
  44. table.insert(configs, "-DBUILD_FLTK=" .. (package:config("fltk") and "ON" or "OFF"))
  45. table.insert(configs, "-DBUILD_THREAD=" .. (package:config("thread") and "ON" or "OFF"))
  46. table.insert(configs, "-DBUILD_THREAD_UNSAFE=" .. (package:config("multithreading") and "ON" or "OFF"))
  47. import("package.tools.cmake").install(package, configs)
  48. end)
  49. on_test(function (package)
  50. assert(package:check_cxxsnippets({test = [[
  51. void test() {
  52. rotor::system_context_t ctx{};
  53. }
  54. ]]}, {configs = {languages = "c++17"}, includes = "rotor.hpp"}))
  55. end)