Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve cmake.install for ninja #5365

Merged
merged 2 commits into from
Jul 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions xmake/modules/package/tools/cmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -979,6 +979,14 @@ end
-- do build for ninja
function _build_for_ninja(package, configs, opt)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_install_for_ninja 也要加,或者在 package/tools/ninja.lua 里抽象出一个函数给 install/build 都加上

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

install 加了的

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这是cmake的bug,不应该在 tools.ninja里面处理

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
ninja.build(package, {}, {envs = opt.envs or buildenvs(package, opt),
jobs = opt.jobs,
target = opt.target})
Expand Down Expand Up @@ -1063,6 +1071,14 @@ 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
ninja.install(package, {}, {envs = opt.envs or buildenvs(package, opt),
jobs = opt.jobs,
target = opt.target})
Expand Down
Loading