Skip to content

Replace hardcoded MSVC debug flags with CMAKE_MSVC_DEBUG_INFORMATION_FORMAT - #1113

Closed
zichguan-amd wants to merge 2 commits into
developfrom
users/zichguan/msvc
Closed

zichguan-amd wants to merge 2 commits into
developfrom
users/zichguan/msvc

Conversation

@zichguan-amd

@zichguan-amd zichguan-amd commented Sep 24, 2025 •

Copy link
Copy Markdown
Contributor

Motivation

Update the way /Zi flag is set to use CMAKE_MSVC_DEBUG_INFORMATION_FORMAT available since CMake 3.25. This allows better building experience for TheRock with caching enabled such as ccache or sccache. ccache and sccache only supports /Z7, using CMAKE_MSVC_DEBUG_INFORMATION_FORMAT makes it easy to change the debug format to /Z7.

fixes ROCm/TheRock#748

Technical Details

Bump up CMake minimum version to 3.25. This implies CMAKE_POLICY_CMP0141=NEW.
https://cmake.org/cmake/help/latest/policy/CMP0141.html

Can also remove the linker flag since /Zi implies /DEBUG and /DEBUG with no extra arguments is equivalent to specifying /DEBUG:FULL.
https://learn.microsoft.com/en-us/cpp/build/reference/z7-zi-zi-debug-information-format?view=msvc-170
https://learn.microsoft.com/en-us/cpp/build/reference/debug-generate-debug-info?view=msvc-170

Test Plan

Test build with TheRock

Test Result

TheRock builds clr with no errors using ccache and sccache with -DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded.

Submission Checklist

…FORMAT

Signed-off-by: zichguan-amd <zichuan.guan@amd.com>

@ScottTodd ScottTodd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, will let others weigh in on whether this CMake min version update is okay for CLR (there are ongoing discussions about the minimum version across all ROCm projects, FYI)

@zichguan-amd

Copy link
Copy Markdown
Contributor Author

Would also need CI to update CMake version so that Azure pipelines run

@zichguan-amd zichguan-amd self-assigned this Oct 29, 2025
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been inactive for 25 days and will be marked as stale.

If you would like to keep this PR open, please:

  • Add new commits
  • Add a comment explaining why it should remain open

This PR will be automatically closed in 5 days if no further activity occurs.

@github-actions github-actions Bot added the Stale PR has no activity for 25+ days label May 14, 2026
Copilot AI review requested due to automatic review settings May 14, 2026 17:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR modernizes MSVC debug info handling in the CLR subprojects by switching from hardcoded /Zi (and linker debug flags) to CMake’s CMAKE_MSVC_DEBUG_INFORMATION_FORMAT (introduced with CMake 3.25 / CMP0141), primarily to improve compatibility with compilation caches like ccache/sccache.

Changes:

  • Bump projects/clr to require CMake 3.25 (to enable CMP0141 behavior).
  • Replace hardcoded MSVC /Zi (and /DEBUG:FULL) flags with CMAKE_MSVC_DEBUG_INFORMATION_FORMAT in opencl and hipamd.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
projects/clr/CMakeLists.txt Raises the CLR project’s minimum CMake version to 3.25 to support CMP0141/MSVC debug format selection.
projects/clr/opencl/CMakeLists.txt Uses CMAKE_MSVC_DEBUG_INFORMATION_FORMAT instead of hardcoded MSVC debug flags.
projects/clr/hipamd/CMakeLists.txt Uses CMAKE_MSVC_DEBUG_INFORMATION_FORMAT instead of hardcoded MSVC debug flags.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 19 to 22
# Add flags to generate PDB files with full symbolic information
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zi")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DEBUG:FULL")
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<$<CONFIG:Release,Debug,RelWithDebInfo>:ProgramDatabase>")
endif()
Comment on lines 34 to 38
ON)

if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zi")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DEBUG:FULL")
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<$<CONFIG:Release,Debug,RelWithDebInfo>:ProgramDatabase>")
endif()
@github-actions github-actions Bot removed the Stale PR has no activity for 25+ days label May 15, 2026
@Apophis3158

Copy link
Copy Markdown
Contributor

This really helps building with sccache, can we push further?

@zichguan-amd

Copy link
Copy Markdown
Contributor Author

@ROCm/clr-reviewers @ROCm/lrt-build-infra can anyone help with review? Thanks

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been inactive for 25 days and will be marked as stale.

If you would like to keep this PR open, please:

  • Add new commits
  • Add a comment explaining why it should remain open

This PR will be automatically closed in 5 days if no further activity occurs.

@github-actions github-actions Bot added the Stale PR has no activity for 25+ days label Jun 27, 2026
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

This pull request has been automatically closed due to inactivity (30 days with no updates).

If you'd like to continue working on this, feel free to reopen the PR or create a new one.

@github-actions github-actions Bot closed this Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

organization: ROCm project: clr Stale PR has no activity for 25+ days

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Issue]: Linker Error: Duplicate symbol __hip_cuid_... in rocSOLVER when building with ccache on Windows

4 participants