diff options
Diffstat (limited to 'repo/packages/m/mimalloc/xmake.lua')
| -rw-r--r-- | repo/packages/m/mimalloc/xmake.lua | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/repo/packages/m/mimalloc/xmake.lua b/repo/packages/m/mimalloc/xmake.lua index 49492542f..cc6561325 100644 --- a/repo/packages/m/mimalloc/xmake.lua +++ b/repo/packages/m/mimalloc/xmake.lua @@ -49,6 +49,7 @@ package("mimalloc") add_configs("secure", {description = "Use a secured version of mimalloc", default = false, type = "boolean"}) add_configs("rltgenrandom", {description = "Use a RtlGenRandom instead of BCrypt", default = false, type = "boolean"}) + add_configs("embed_debug_info", {description = "Use /Z7 to embed debug info for linker merging", default = true, type = "boolean"}) add_deps("cmake") @@ -71,16 +72,17 @@ package("mimalloc") if package:version():le("2.0.1") and package:config("shared") and package:is_plat("windows") and package:is_arch("x86") then io.replace("CMakeLists.txt", "-redirect.", "-redirect32.", {plain = true}) end - local cxflags + local cxflags = {} if package:config("rltgenrandom") then - if xmake:version():ge("2.5.1") then - cxflags = "-DMI_USE_RTLGENRANDOM" - else - -- it will be deprecated after xmake/v2.5.1 - package:configs().cxflags = "-DMI_USE_RTLGENRANDOM" - end + table.insert(cxflags, "-DMI_USE_RTLGENRANDOM") end - import("package.tools.cmake").build(package, configs, {buildir = "build", cxflags = cxflags}) + -- Use /Z7 on Windows so debug info is embedded in the .obj files and + -- merged into the final PDB by the linker, rather than living in a + -- separate PDB in the xmake package cache. + if package:is_plat("windows") and package:config("embed_debug_info") then + table.insert(cxflags, "/Z7") + end + import("package.tools.cmake").build(package, configs, {buildir = "build", cxflags = #cxflags > 0 and table.concat(cxflags, " ") or nil}) if package:is_plat("windows") then os.trycp("build/**.dll", package:installdir("bin")) |