xmake.lua 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. package("memplumber")
  2. set_homepage("https://github.com/seladb/MemPlumber")
  3. set_description("MemPlumber is a library that helps developers with debugging of memory allocations and detection of memory leaks in C++ applications")
  4. set_license("MIT")
  5. add_urls("https://github.com/seladb/MemPlumber.git")
  6. add_versions("2022.01.27", "ff04d339b034c40f72e09653c6a0340c0bb05d3b")
  7. if is_plat("linux", "macosx") then
  8. add_deps("libbacktrace")
  9. end
  10. add_configs("collect_static_var_data", {description = "Collect data also on static variable memory allocation", default = false, type = "boolean"})
  11. on_install("windows", "linux", "macosx", "mingw", function (package)
  12. io.replace("memplumber.cpp", "unsigned long", "uintptr_t")
  13. os.cp(path.join(os.scriptdir(), "port", "xmake.lua"), "xmake.lua")
  14. local configs = {}
  15. configs.collect_static_var_data = package:config("collect_static_var_data")
  16. import("package.tools.xmake").install(package, configs)
  17. end)
  18. on_test(function (package)
  19. assert(package:check_cxxsnippets({test = [[
  20. #include <memplumber.h>
  21. void test() {
  22. MemPlumber::start();
  23. int* num = new int(100);
  24. size_t memLeakCount;
  25. uint64_t memLeakSize;
  26. MemPlumber::memLeakCheck(memLeakCount, memLeakSize, true);
  27. MemPlumber::stopAndFreeAllMemory();
  28. }
  29. ]]}, {configs = {languages = "cxx11"}}))
  30. end)