summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-07-20 08:22:02 +0800
committerruki <[email protected]>2024-07-20 08:22:02 +0800
commit2412ed94e70b00b0c2f3bd8c4553828efd458b1b (patch)
treed0bd699ac0138d504232f9ae5569f6c88172d7fd
parent84d48dc86db6f0968232ce3b9bc2df808f89d046 (diff)
improve tools.cmake
-rw-r--r--xmake/modules/package/tools/cmake.lua29
1 files changed, 13 insertions, 16 deletions
diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua
index fdbf7bb73..6055d813c 100644
--- a/xmake/modules/package/tools/cmake.lua
+++ b/xmake/modules/package/tools/cmake.lua
@@ -879,6 +879,17 @@ function _get_configs(package, configs, opt)
return configs
end
+-- Fix pdb issue, if multiple CL.EXE write to the same .PDB file, please use /FS
+-- @see https://github.com/xmake-io/xmake/issues/5353
+function _fix_pdbdir_for_ninja(package)
+ if package:is_plat("windows") and package:has_tool("cxx", "cl") then
+ local pdbdir = "pdb"
+ if not os.isdir(pdbdir) then
+ os.mkdir(pdbdir)
+ end
+ end
+end
+
-- get build environments
function buildenvs(package, opt)
@@ -979,14 +990,7 @@ end
-- do build for ninja
function _build_for_ninja(package, configs, opt)
opt = opt or {}
- -- Fix pdb issue, if multiple CL.EXE write to the same .PDB file, please use /FS
- -- @see https://github.com/xmake-io/xmake/issues/5353
- if package:is_plat("windows") and package:has_tool("cxx", "cl") then
- local pdbdir = "pdb"
- if not os.isdir(pdbdir) then
- os.mkdir(pdbdir)
- end
- end
+ _fix_pdbdir_for_ninja(package)
ninja.build(package, {}, {envs = opt.envs or buildenvs(package, opt),
jobs = opt.jobs,
target = opt.target})
@@ -1071,14 +1075,7 @@ end
-- do install for ninja
function _install_for_ninja(package, configs, opt)
opt = opt or {}
- -- Fix pdb issue, if multiple CL.EXE write to the same .PDB file, please use /FS
- -- @see https://github.com/xmake-io/xmake/issues/5353
- if package:is_plat("windows") and package:has_tool("cxx", "cl") then
- local pdbdir = "pdb"
- if not os.isdir(pdbdir) then
- os.mkdir(pdbdir)
- end
- end
+ _fix_pdbdir_for_ninja(package)
ninja.install(package, {}, {envs = opt.envs or buildenvs(package, opt),
jobs = opt.jobs,
target = opt.target})