xmake.lua 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. package("hpx")
  2. set_homepage("https://hpx.stellar-group.org")
  3. set_description("The C++ Standard Library for Parallelism and Concurrency")
  4. set_license("BSL-1.0")
  5. add_urls("https://github.com/STEllAR-GROUP/hpx/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/STEllAR-GROUP/hpx.git")
  7. add_versions("v1.9.1", "1adae9d408388a723277290ddb33c699aa9ea72defadf3f12d4acc913a0ff22d")
  8. add_configs("malloc", {description = "Use a custom allocator", default = "system", values = {"system", "tcmalloc", "jemalloc", "mimalloc"}})
  9. add_configs("cuda", {description = "Enable support for CUDA", default = false})
  10. add_configs("mpi", {description = "Enable the MPI parcelport", default = false})
  11. add_configs("tcp", {description = "Enable the TCP parcelport", default = false})
  12. add_configs("lci", {description = "Enable the LCI parcelport", default = false})
  13. add_configs("apex", {description = "Enable APEX integration", default = false})
  14. add_configs("context", {description = "Enable Boost. Context for task context switching", default = false})
  15. add_configs("cpu_count", {description = "Set the maximum CPU count supported by HPX", default = "64"})
  16. if is_plat("linux") then
  17. add_syslinks("pthread")
  18. end
  19. add_deps("cmake", "hwloc", "asio >=1.12.0")
  20. on_load("windows|x64", "linux|x86_64", "macosx|x86_64", function (package)
  21. local malloc = package:config("malloc")
  22. if malloc ~= "system" then
  23. package:add("deps", malloc)
  24. end
  25. if package:config("context") then
  26. package:add("deps", "boost >=1.71.0", {configs = {context = true}})
  27. else
  28. package:add("deps", "boost >=1.71.0")
  29. end
  30. end)
  31. on_install("windows|x64", function (package)
  32. local configs = {"-DHPX_WITH_EXAMPLES=OFF", "-DHPX_WITH_TESTS=OFF", "-DHPX_WITH_UNITY_BUILD=OFF"}
  33. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  34. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  35. table.insert(configs, "-DHPX_WITH_MALLOC=" .. package:config("malloc"))
  36. table.insert(configs, "-DHPX_WITH_CUDA=" .. (package:config("cuda") and "ON" or "OFF"))
  37. table.insert(configs, "-DHPX_WITH_PARCELPORT_MPI=" .. (package:config("mpi") and "ON" or "OFF"))
  38. table.insert(configs, "-DHPX_WITH_PARCELPORT_TCP=" .. (package:config("tcp") and "ON" or "OFF"))
  39. table.insert(configs, "-DHPX_WITH_PARCELPORT_LCI=" .. (package:config("lci") and "ON" or "OFF"))
  40. table.insert(configs, "-DHPX_WITH_APEX=" .. (package:config("apex") and "ON" or "OFF"))
  41. table.insert(configs, "-DHPX_WITH_GENERIC_CONTEXT_COROUTINES=" .. (package:config("context") and "ON" or "OFF"))
  42. table.insert(configs, "-DHPX_WITH_MAX_CPU_COUNT=" .. package:config("cpu_count"))
  43. import("package.tools.cmake").install(package, configs)
  44. end)
  45. on_test(function (package)
  46. assert(package:check_cxxsnippets({test = [[
  47. #include <hpx/iostream.hpp>
  48. void test() {
  49. hpx::cout << "Hello World!\n" << std::flush;
  50. }
  51. ]]}, {configs = {languages = "c++17"}}))
  52. end)