xmake.lua 1.5 KB

1234567891011121314151617181920212223242526272829
  1. package("vld")
  2. set_homepage("https://github.com/oneiric/vld")
  3. set_description("Visual Leak Detector for Visual C++")
  4. set_license("LGPL-2.1")
  5. add_urls("https://github.com/oneiric/vld/archive/refs/tags/$(version).zip",
  6. "https://github.com/oneiric/vld.git")
  7. add_versions("v2.7.0", "1bb5695a424b234d29d16acdc6bdb4be79d58501674b6d3765a19f237c5ad0f2")
  8. add_configs("shared", {description = "Build shared binaries.", default = true, type = "boolean", readonly = true})
  9. on_install("windows|!arm64", function (package)
  10. local configs = {"vld_vs16.sln", "-t:vld"}
  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. import("package.tools.msbuild").build(package, configs)
  14. os.cp("src/*.h", package:installdir("include"))
  15. os.cp("setup/dbghelp/" .. (package:is_arch("x64") and "x64" or "x86") .. "/*", package:installdir("bin"))
  16. local outputdir = path.join("src","bin", package:is_arch("x64") and "x64" or "Win32", (package:debug() and "Debug" or "Release-") .. "*")
  17. os.cp(outputdir .. "/*.lib", package:installdir("lib"))
  18. os.cp(outputdir .. "/*.dll", package:installdir("bin"))
  19. package:addenv("PATH", "bin")
  20. end)
  21. on_test(function (package)
  22. assert(package:has_cfuncs("VLDDisable", {includes = "vld.h", configs = {defines = "VLD_FORCE_ENABLE"}}))
  23. end)