xmake.lua 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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.34", "8c59a36b3b2917c91650fb91e57f8e116e0dd7f88b70d95e2e92bde4f9395202")
  8. add_versions("v0.33", "0a57af1018e2ca89c9cd95ae134c4b2af2c8e803c81ebee5433495776830eea6")
  9. add_versions("v0.32", "b0b7a294704f1ab779b95ab433eb5f4a2859db3539108a0e08709fc97f6bccee")
  10. add_versions("v0.31", "c8d9b28083c7a9c32af2cbff1d90fe1e62def989f0f89baba1244c44fb8ec9e4")
  11. add_versions("v0.30", "d143bfce1d18d42ab0f072acfe239d1cc07a495411537579e02260673cbe8121")
  12. add_configs("boost_asio", {description = "Build with boost:asio", default = false, type = "boolean"})
  13. add_configs("libev", {description = "Build with libev", default = false, type = "boolean"})
  14. add_configs("fltk", {description = "Build with fltk", default = false, type = "boolean"})
  15. add_configs("thread", {description = "Build with thread", default = false, type = "boolean"})
  16. add_configs("multithreading", {description = "Build with multithreading", default = false, type = "boolean"})
  17. add_deps("cmake")
  18. add_deps("boost", {configs = {date_time = true, regex = true, system = true}})
  19. on_load(function (package)
  20. if package:config("boost_asio") or package:config("thread") then
  21. if package:is_plat("linux", "bsd") then
  22. package:add("syslinks", "pthread")
  23. end
  24. end
  25. if package:config("libev") then
  26. package:add("deps", "libev")
  27. end
  28. if package:config("fltk") then
  29. package:add("deps", "fltk")
  30. end
  31. if package:config("multithreading") then
  32. package:add("defines", "ROTOR_REFCOUNT_THREADUNSAFE")
  33. end
  34. if not package:config("shared") then
  35. package:add("defines", "ROTOR_STATIC_DEFINE")
  36. end
  37. end)
  38. on_install("windows", "linux", "macosx", "bsd", "mingw", "cross", function (package)
  39. local configs = {"-DBUILD_TESTING=OFF"}
  40. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  41. table.insert(configs, "-DROTOR_DEBUG_DELIVERY=" .. (package:is_debug() and "ON" or "OFF"))
  42. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  43. if package:is_plat("windows") then
  44. table.insert(configs, "-DBoost_USE_STATIC_RUNTIME=" .. (package:has_runtime("MT", "MTd") and "ON" or "OFF"))
  45. end
  46. table.insert(configs, "-DBUILD_BOOST_ASIO=" .. (package:config("boost_asio") and "ON" or "OFF"))
  47. table.insert(configs, "-DBUILD_EV=" .. (package:config("libev") and "ON" or "OFF"))
  48. table.insert(configs, "-DBUILD_FLTK=" .. (package:config("fltk") and "ON" or "OFF"))
  49. table.insert(configs, "-DBUILD_THREAD=" .. (package:config("thread") and "ON" or "OFF"))
  50. table.insert(configs, "-DBUILD_THREAD_UNSAFE=" .. (package:config("multithreading") and "ON" or "OFF"))
  51. import("package.tools.cmake").install(package, configs)
  52. end)
  53. on_test(function (package)
  54. assert(package:check_cxxsnippets({test = [[
  55. void test() {
  56. rotor::system_context_t ctx{};
  57. }
  58. ]]}, {configs = {languages = "c++17"}, includes = "rotor.hpp"}))
  59. end)