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

cmake tool generate smaller pdb on windows #5031

Closed
wants to merge 6 commits into from
Closed
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
14 changes: 14 additions & 0 deletions xmake/modules/package/tools/cmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -392,9 +392,23 @@ function _get_configs_for_windows(package, configs, opt)
elseif package:has_runtime("MDd") then
table.insert(configs, "-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebugDLL")
end

-- config about PDB
if not opt._configs_str:find("CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY") then
table.insert(configs, "-DCMAKE_COMPILE_PDB_OUTPUT_DIRECTORY=pdb")
end
-- shrink PDB file
-- ref: https://devblogs.microsoft.com/cppblog/shrink-my-program-database-pdb-file/
if not opt._configs_str:find("CMAKE_EXE_LINKER_FLAGS") then
table.insert(configs, "-DCMAKE_EXE_LINKER_FLAGS=/opt:ref /opt:icf /pdbcompress")
c8ef marked this conversation as resolved.
Show resolved Hide resolved
end
if not opt._configs_str:find("CMAKE_SHARED_LINKER_FLAGS") then
table.insert(configs, "-DCMAKE_SHARED_LINKER_FLAGS=/opt:ref /opt:icf /pdbcompress")
end
if not opt._configs_str:find("CMAKE_STATIC_LINKER_FLAGS") then
table.insert(configs, "-DCMAKE_STATIC_LINKER_FLAGS=/opt:ref /opt:icf /pdbcompress")
end

_get_configs_for_generic(package, configs, opt)
end

Expand Down
Loading