xmake.lua 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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.4", "09ebbec6bdafa4298c146056aef2070f0a3e56781a5dda1d7deece546c5b2b72")
  8. add_versions("5.8.0", "de2b4ae0e817a108dae6d6787c79ed84c33bd447842b5fdcb780f6697b4c2d49")
  9. if is_plat("linux", "bsd") then
  10. add_syslinks("pthread", "m")
  11. end
  12. add_deps("cmake")
  13. on_install(function (package)
  14. local configs = {"-DBUILD_ALL=OFF", "-DBUILD_EXAMPLES=OFF", "-DBUILD_TESTS=OFF"}
  15. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  16. if package:config("shared") then
  17. table.insert(configs, "-DSOBJECTIZER_BUILD_STATIC=OFF")
  18. table.insert(configs, "-DSOBJECTIZER_BUILD_SHARED=ON")
  19. else
  20. package:add("defines", "SO_5_STATIC_LIB")
  21. table.insert(configs, "-DSOBJECTIZER_BUILD_STATIC=ON")
  22. table.insert(configs, "-DSOBJECTIZER_BUILD_SHARED=OFF")
  23. end
  24. os.cd("dev")
  25. import("package.tools.cmake").install(package, configs)
  26. end)
  27. on_test(function (package)
  28. assert(package:check_cxxsnippets({test = [[
  29. #include <so_5/all.hpp>
  30. class hello_actor final : public so_5::agent_t {
  31. public:
  32. using so_5::agent_t::agent_t;
  33. void so_evt_start() override {
  34. std::cout << "Hello, World!" << std::endl;
  35. so_deregister_agent_coop_normally();
  36. }
  37. };
  38. void test() {
  39. so_5::launch([](so_5::environment_t & env) {
  40. env.register_agent_as_coop( env.make_agent<hello_actor>() );
  41. });
  42. }
  43. ]]}, {configs = {languages = "c++17"}}))
  44. end)