xmake.lua 1.3 KB

12345678910111213141516171819202122232425262728293031323334
  1. package("rpmalloc")
  2. set_homepage("https://github.com/mjansson/rpmalloc")
  3. set_description("Public domain cross platform lock free thread caching 16-byte aligned memory allocator implemented in C")
  4. add_urls("https://github.com/mjansson/rpmalloc/archive/refs/tags/$(version).tar.gz",
  5. "https://github.com/mjansson/rpmalloc.git")
  6. add_versions("1.4.4", "3859620c03e6473f0b3f16a4e965e7c049594253f70e8370fb9caa0e4118accb")
  7. if is_plat("windows") then
  8. add_syslinks("advapi32")
  9. end
  10. on_install(function (package)
  11. local configs = {}
  12. io.writefile("xmake.lua", [[
  13. add_rules("mode.release", "mode.debug")
  14. target("rpmalloc")
  15. set_kind("$(kind)")
  16. add_files("rpmalloc/rpmalloc.c")
  17. add_headerfiles("rpmalloc/(*.h)")
  18. if is_plat("windows") and is_kind("shared") then
  19. add_rules("utils.symbols.export_all")
  20. add_syslinks("advapi32")
  21. end
  22. ]])
  23. if package:config("shared") then
  24. configs.kind = "shared"
  25. end
  26. import("package.tools.xmake").install(package, configs)
  27. end)
  28. on_test(function (package)
  29. assert(package:has_cfuncs("rpmalloc", {includes = "rpmalloc.h"}))
  30. end)