memplumber: add package (#3385)

* memplumber: add package

* memplumber: use port file & try io.replace

* memplumber: android can add libbacktrace

* memplumber: add limits

* memplumber: update is_plat for mingw
pull/3393/head
Chi Huu Huynh 9 months ago committed by GitHub
parent 82994f6f59
commit e41c2c411b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 24
      packages/m/memplumber/port/xmake.lua
  2. 37
      packages/m/memplumber/xmake.lua

@ -0,0 +1,24 @@
add_rules("mode.debug", "mode.release")
option("collect_static_var_data", {description = "Collect data also on static variable memory allocation", default = false, type = "boolean"})
if is_plat("linux", "macosx") then
add_requires("libbacktrace")
end
target("memplumber")
set_kind("$(kind)")
set_languages("cxx11")
add_files("memplumber.cpp")
add_headerfiles("(memplumber.h)", "memplumber-internals.h")
if is_plat("linux", "macosx") then
add_packages("libbacktrace")
elseif is_plat("windows", "mingw") then
add_defines("_WIN32")
end
if has_config("collect_static_var_data") then
add_defines("COLLECT_STATIC_VAR_DATA")
end

@ -0,0 +1,37 @@
package("memplumber")
set_homepage("https://github.com/seladb/MemPlumber")
set_description("MemPlumber is a library that helps developers with debugging of memory allocations and detection of memory leaks in C++ applications")
set_license("MIT")
add_urls("https://github.com/seladb/MemPlumber.git")
add_versions("2022.01.27", "ff04d339b034c40f72e09653c6a0340c0bb05d3b")
if is_plat("linux", "macosx") then
add_deps("libbacktrace")
end
add_configs("collect_static_var_data", {description = "Collect data also on static variable memory allocation", default = false, type = "boolean"})
on_install("windows", "linux", "macosx", "mingw", function (package)
io.replace("memplumber.cpp", "unsigned long", "uintptr_t")
os.cp(path.join(os.scriptdir(), "port", "xmake.lua"), "xmake.lua")
local configs = {}
configs.collect_static_var_data = package:config("collect_static_var_data")
import("package.tools.xmake").install(package, configs)
end)
on_test(function (package)
assert(package:check_cxxsnippets({test = [[
#include <memplumber.h>
void test() {
MemPlumber::start();
int* num = new int(100);
size_t memLeakCount;
uint64_t memLeakSize;
MemPlumber::memLeakCheck(memLeakCount, memLeakSize, true);
MemPlumber::stopAndFreeAllMemory();
}
]]}, {configs = {languages = "cxx11"}}))
end)
Loading…
Cancel
Save