xmake.lua 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package("metall")
  2. set_homepage("https://github.com/LLNL/metall")
  3. set_description("Persistent memory allocator for data-centric analytics")
  4. set_license("Apache-2.0")
  5. add_urls("https://github.com/LLNL/metall/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/LLNL/metall.git")
  7. add_versions("v0.31", "d7e1c3d953a31e2fe3adddd7553264e0dc61020d300fa0f0ba409859a68420f3")
  8. add_versions("v0.30", "d241f45978fceeb83a4b2eda7513466341c45452fa26ec224c5235d00d279d37")
  9. add_configs("c_api", {description = "Build C API", default = false, type = "boolean"})
  10. add_configs("tools", {description = "Build tools", default = false, type = "boolean"})
  11. if is_plat("linux", "bsd") then
  12. add_syslinks("pthread")
  13. end
  14. add_deps("cmake")
  15. add_deps("boost", {configs = {cmake = false}})
  16. on_load(function (package)
  17. if not package:config("c_api") then
  18. package:set("kind", "library", {headeronly = true})
  19. end
  20. end)
  21. on_install("macosx", "linux", function (package)
  22. local configs = {"-DJUST_INSTALL_METALL_HEADER=ON"}
  23. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  24. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  25. table.insert(configs, "-DBUILD_C=" .. (package:config("c_api") and "ON" or "OFF"))
  26. table.insert(configs, "-DBUILD_UTILITY=" .. (package:config("tools") and "ON" or "OFF"))
  27. import("package.tools.cmake").install(package, configs)
  28. end)
  29. on_test(function (package)
  30. assert(package:check_cxxsnippets({test = [[
  31. #include <metall/metall.hpp>
  32. #include <boost/container/vector.hpp>
  33. using vector_t = boost::container::vector<int, metall::manager::allocator_type<int>>;
  34. void test() {
  35. metall::manager manager(metall::open_only, "/tmp/dir");
  36. auto pvec = manager.find<vector_t>("vec").first;
  37. pvec->push_back(10);
  38. }
  39. ]]}, {configs = {languages = "c++17"}}))
  40. if package:config("c_api") then
  41. assert(package:has_cfuncs("metall_create", {includes = "metall/c_api/metall.h"}))
  42. end
  43. end)