xmake.lua 1.7 KB

1234567891011121314151617181920212223242526272829
  1. package("vld")
  2. set_homepage("https://github.com/oneiric/vld")
  3. set_description("Visual Leak Detector for Visual C++")
  4. add_urls("https://github.com/oneiric/vld/archive/refs/tags/v$(version).zip")
  5. add_versions("2.7.0", "1bb5695a424b234d29d16acdc6bdb4be79d58501674b6d3765a19f237c5ad0f2")
  6. add_configs("shared", {description = "Download shared binaries.", default = true, type = "boolean", readonly=true})
  7. on_install("windows", function (package)
  8. io.replace("src/tests/basics/Allocs.cpp", "#error Unsupported compiler", '#define CRTDLLNAME _T("ucrtbase.dll")', {plain=true})
  9. io.replace("src/tests/suite/testsuite.cpp", "#error Unsupported compiler", '#define CRTDLLNAME _T("ucrtbase.dll")', {plain=true})
  10. local configs = {"vld_vs16.sln"}
  11. table.insert(configs, "/p:Configuration=" .. (package:debug() and "Debug" or "Release"))
  12. table.insert(configs, "/p:Platform=" .. (package:is_arch("x64") and "x64" or "Win32"))
  13. table.insert(configs, "-t:vld")
  14. import("package.tools.msbuild").build(package, configs)
  15. os.cp("src/*.h", package:installdir("include"))
  16. os.cp("setup/dbghelp/" .. (package:is_arch("x64") and "x64" or "x86") .. "/*", package:installdir("bin"))
  17. local outputdir = path.join("src","bin", package:is_arch("x64") and "x64" or "Win32", (package:debug() and "Debug" or "Release-") .. "*")
  18. os.cp(outputdir .. "/*.lib", package:installdir("lib"))
  19. os.cp(outputdir .. "/*.dll", package:installdir("bin"))
  20. package:addenv("PATH", "bin")
  21. end)
  22. on_test(function (package)
  23. assert(package:has_cfuncs("VLDDisable", {includes = "vld.h", configs = {defines = "VLD_FORCE_ENABLE"}}))
  24. end)