Skip to content

Remove explicit /Zi and /DEBUG, use CMAKE_MSVC_DEBUG_INFORMATION_FORMAT#316

Open
shbhamid-amd wants to merge 1 commit into
Xilinx:main-gefrom
shbhamid-amd:fix/remove-explicit-Zi-debug-flags
Open

Remove explicit /Zi and /DEBUG, use CMAKE_MSVC_DEBUG_INFORMATION_FORMAT#316
shbhamid-amd wants to merge 1 commit into
Xilinx:main-gefrom
shbhamid-amd:fix/remove-explicit-Zi-debug-flags

Conversation

@shbhamid-amd

Copy link
Copy Markdown

Summary

  • Remove unconditional /Zi compiler flag from add_compile_options in cmake/windows.cmake
  • Remove unconditional /DEBUG linker flag from add_link_options
  • Add CMAKE_MSVC_DEBUG_INFORMATION_FORMAT set to ProgramDatabase only for Debug and RelWithDebInfo configurations

Why

The current setup forces PDB generation (/Zi) and debug linking (/DEBUG) unconditionally across all build configurations including Release. This increases binary size and build time for release builds unnecessarily.

By using CMAKE_MSVC_DEBUG_INFORMATION_FORMAT with a generator expression, PDBs are only generated for Debug and RelWithDebInfo where they are actually needed.

This upstreams the xmc monorepo patch (aiebu_no_explicit_Zi.patch).

Changes

  • cmake/windows.cmake: Removed /Zi from compile options, removed /DEBUG from link options, added CMAKE_MSVC_DEBUG_INFORMATION_FORMAT with config-conditional generator expression

Test plan

  • Verify aiebu builds successfully on Windows (MSVC) in Release configuration
  • Verify aiebu builds successfully on Windows (MSVC) in Debug configuration
  • Confirm PDB files are generated for Debug/RelWithDebInfo but not Release
  • Once merged, retire aiebu_no_explicit_Zi.patch from xmc patches/ and bin/xmc/vcs/patch.sh

Signed-off-by: Shiva Shanker Bhamidipati [email protected]

Remove unconditional /Zi compiler flag and /DEBUG linker flag that forced
PDB generation across all build configurations including Release. Replace
with CMAKE_MSVC_DEBUG_INFORMATION_FORMAT using a generator expression so
PDBs are only generated for Debug and RelWithDebInfo.

This reduces binary size and build time for Release builds.

Signed-off-by: Shiva Shanker Bhamidipati <[email protected]>
@sonals

sonals commented Jul 10, 2026

Copy link
Copy Markdown
Member

@xingy16-amd, how much binary size reduction are we talking about? I would imagine all debug information is going into a separate PDB file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants