feat : xmake add valgrind

This commit is contained in:
Chanchan
2023-01-05 19:46:15 +08:00
parent 787669af0c
commit 0eed2ba2e4
2 changed files with 9 additions and 0 deletions

View File

@@ -33,4 +33,12 @@ for _, test in ipairs(all_tests()) do
target(test[1])
set_kind("binary")
add_files(test[2])
if has_config("memcheck") then
on_run(function (target)
local argv = {}
table.insert(argv, target:targetfile())
table.insert(argv, "--leak-check=full")
os.execv("valgrind", argv)
end)
end
end

View File

@@ -8,6 +8,7 @@ option("consul", {description = "build consul component", default = true}
option("mysql", {description = "build mysql component", default = true})
option("redis", {description = "build redis component", default = true})
option("upstream", {description = "build upstream component", default = true})
option("memcheck", {description = "valgrind memcheck", default = false})
add_rules("mode.release", "mode.debug")
set_languages("c90", "c++11")