Skip to content

Commit

Permalink
improve tools.cmake for ninja
Browse files Browse the repository at this point in the history
  • Loading branch information
waruqi committed Jul 19, 2024
1 parent 87308fe commit cc5c003
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions xmake/modules/package/tools/cmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -979,6 +979,15 @@ 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 buildir = opt.buildir or package:buildir()
local pdbdir = path.join(package:buildir(), "pdb")
if not os.isdir(pdbdir) then
os.mkdir(pdbdir)
end
end
ninja.build(package, {}, {envs = opt.envs or buildenvs(package, opt),
jobs = opt.jobs,
target = opt.target})
Expand Down Expand Up @@ -1063,6 +1072,15 @@ 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 buildir = opt.buildir or package:buildir()
local pdbdir = path.join(package:buildir(), "pdb")
if not os.isdir(pdbdir) then
os.mkdir(pdbdir)
end
end
ninja.install(package, {}, {envs = opt.envs or buildenvs(package, opt),
jobs = opt.jobs,
target = opt.target})
Expand Down

0 comments on commit cc5c003

Please sign in to comment.