xmake.lua 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package("sobjectizer")
  2. set_homepage("https://stiffstream.com/en/products/sobjectizer.html")
  3. set_description("An implementation of Actor, Publish-Subscribe, and CSP models in one rather small C++ framework. With performance, quality, and stability proved by years in the production.")
  4. add_urls("https://github.com/Stiffstream/sobjectizer/archive/refs/tags/$(version).tar.gz",
  5. {version = function (version) return "v." .. version end})
  6. add_urls("https://github.com/Stiffstream/sobjectizer.git")
  7. add_versions("5.8.0", "de2b4ae0e817a108dae6d6787c79ed84c33bd447842b5fdcb780f6697b4c2d49")
  8. if is_plat("linux", "bsd") then
  9. add_syslinks("pthread", "m")
  10. end
  11. add_deps("cmake")
  12. on_install(function (package)
  13. local configs = {"-DBUILD_ALL=OFF", "-DBUILD_EXAMPLES=OFF", "-DBUILD_TESTS=OFF"}
  14. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  15. if package:config("shared") then
  16. table.insert(configs, "-DSOBJECTIZER_BUILD_STATIC=OFF")
  17. table.insert(configs, "-DSOBJECTIZER_BUILD_SHARED=ON")
  18. else
  19. package:add("defines", "SO_5_STATIC_LIB")
  20. table.insert(configs, "-DSOBJECTIZER_BUILD_STATIC=ON")
  21. table.insert(configs, "-DSOBJECTIZER_BUILD_SHARED=OFF")
  22. end
  23. os.cd("dev")
  24. import("package.tools.cmake").install(package, configs)
  25. end)
  26. on_test(function (package)
  27. assert(package:check_cxxsnippets({test = [[
  28. #include <so_5/all.hpp>
  29. class hello_actor final : public so_5::agent_t {
  30. public:
  31. using so_5::agent_t::agent_t;
  32. void so_evt_start() override {
  33. std::cout << "Hello, World!" << std::endl;
  34. so_deregister_agent_coop_normally();
  35. }
  36. };
  37. void test() {
  38. so_5::launch([](so_5::environment_t & env) {
  39. env.register_agent_as_coop( env.make_agent<hello_actor>() );
  40. });
  41. }
  42. ]]}, {configs = {languages = "c++17"}}))
  43. end)