diff --git a/xmake.lua b/xmake.lua index 8128552..6f04855 100644 --- a/xmake.lua +++ b/xmake.lua @@ -13,6 +13,8 @@ if is_mode("release") then set_warnings("all", "error") end +option("valgrind", {description = "Run binary with valgrind", default = false}) + target("Tower-Defense2") add_includedirs("include", {public = true}) set_kind("binary") @@ -21,6 +23,11 @@ target("Tower-Defense2") set_rundir(".") add_defines("TD_GL_LOADER_GLEW") + if has_config("valgrind") then + on_run(function (target) + os.execv("valgrind", {"-s", "--leak-check=full", target:targetfile()}) + end) + end -- Tests