From cc5c0036e9810b32cab78cbf5b9cd4638e80d68d Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 20 Jul 2024 00:59:27 +0800 Subject: [PATCH 1/2] improve tools.cmake for ninja --- xmake/modules/package/tools/cmake.lua | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua index d2fa362c610..3e798cbc27f 100644 --- a/xmake/modules/package/tools/cmake.lua +++ b/xmake/modules/package/tools/cmake.lua @@ -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}) @@ -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}) From b94cb84a5f6bb49e933618a7a1394a057257047c Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 20 Jul 2024 00:14:05 +0800 Subject: [PATCH 2/2] fix pdb dir --- xmake/modules/package/tools/cmake.lua | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua index 3e798cbc27f..fdbf7bb7359 100644 --- a/xmake/modules/package/tools/cmake.lua +++ b/xmake/modules/package/tools/cmake.lua @@ -982,8 +982,7 @@ function _build_for_ninja(package, configs, opt) -- 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") + local pdbdir = "pdb" if not os.isdir(pdbdir) then os.mkdir(pdbdir) end @@ -1075,8 +1074,7 @@ function _install_for_ninja(package, configs, opt) -- 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") + local pdbdir = "pdb" if not os.isdir(pdbdir) then os.mkdir(pdbdir) end