xmake.lua 1.4 KB

123456789101112131415161718192021222324252627282930313233
  1. package("snmalloc")
  2. set_homepage("https://github.com/microsoft/snmalloc")
  3. set_description("Message passing based allocator")
  4. set_license("MIT")
  5. add_urls("https://github.com/microsoft/snmalloc/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/microsoft/snmalloc.git")
  7. add_versions("0.6.2", "e0486ccf03eac5dd8acbb66ea8ad33bec289572a51614acdf7117397e4f1af8c")
  8. add_versions("0.6.0", "de1bfb86407d5aac9fdad88319efdd5593ca2f6c61fc13371c4f34aee0b6664f")
  9. add_deps("cmake")
  10. if is_plat("windows") then
  11. add_syslinks("onecore")
  12. end
  13. on_install("windows|x64", "windows|x86", "linux", "macosx", "bsd", function (package)
  14. local configs = {"-DSNMALLOC_BUILD_TESTING=OFF"}
  15. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  16. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  17. local cxflags
  18. if package:is_plat("windows") then
  19. cxflags = "/FS"
  20. end
  21. import("package.tools.cmake").install(package, configs, {cxflags = cxflags})
  22. os.cp("src/snmalloc", package:installdir("include"))
  23. end)
  24. on_test(function (package)
  25. assert(package:has_cxxfuncs("snmalloc::DefaultPal::message(\"\")",
  26. {includes = "snmalloc/snmalloc.h", configs = {languages = "c++20", cxflags = "-mcx16"}}))
  27. end)