Skip to content

CMake updates for MinGW - #9081

Closed
Raed Rizqie (raedrizqie) wants to merge 7 commits into
microsoft:mainfrom
raedrizqie:cmake-mingw
Closed

Raed Rizqie (raedrizqie) wants to merge 7 commits into
microsoft:mainfrom
raedrizqie:cmake-mingw

Conversation

@raedrizqie

@raedrizqie Raed Rizqie (raedrizqie) commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

This PR updates CMake related files for MinGW, after the dxil updates.

Copilot AI balanced review requested due to automatic review settings October 29, 2026 01:47
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@github-actions

Copy link
Copy Markdown
Contributor

PR description is empty, please add some valid description

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.

🟡 Changes recommended

The changes break clean MinGW builds by removing a required tracing-header generator and cause valid HLSL shaders to fail compilation because required language options are left disabled.

3 open issues
What changed in this PR

This PR adjusts DXC’s CMake configuration for MinGW, separating executable startup options from library settings and refining platform-specific build conditions.

Changes:

  • Move MinGW console and Unicode linker options to executable targets.
  • Restrict selected Windows dependencies to MSVC and adjust resource include flags.
  • Update architecture checks, runtime linking, warning suppression, and language-option configuration.
File Description
tools/​clang/​tools/​dxr/​CMakeLists.txt Add MinGW executable linker options.
tools/​clang/​tools/​dxl/​CMakeLists.txt Add MinGW executable linker options.
tools/​clang/​tools/​dxildll/​CMakeLists.txt Narrow dependency guards to MSVC and adjust resource flags.
tools/​clang/​tools/​dxcvalidator/​CMakeLists.txt Remove MinGW linker options and version linkage.
tools/​clang/​tools/​dxclib/​CMakeLists.txt Remove propagated executable linker options.
tools/​clang/​tools/​dxc/​CMakeLists.txt Add MinGW executable linker options.
tools/​clang/​CMakeLists.txt Enable variable language options for MinGW.
projects/​CMakeLists.txt Restrict tracing and DXIL conversion projects to MSVC.
CMakeLists.txt Guard control-flow protection by architecture and limit Unix RPATH setup.
cmake/​modules/​HandleLLVMOptions.cmake Adjust MinGW static runtime linking and warning suppression.

Review effort: Balanced

Comment thread projects/CMakeLists.txt Resolved
Comment thread tools/clang/CMakeLists.txt Resolved
Comment thread CMakeLists.txt Resolved
Copilot AI balanced review requested due to automatic review settings October 29, 2026 09:33

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.

🔵 Needs a closer look

Replacing -static with -static-libstdc++ can leave LLVM_BUILD_STATIC=ON executables dependent on a MinGW libgcc DLL, causing startup failures on systems without that runtime.

1 open issue
1 previously missed issue

In code that hasn't changed since last review

Medium severity LLVM static builds may depend on missing MinGW libgcc DLL

cmake/​modules/​HandleLLVMOptions.cmake:242

With a MinGW toolchain that links libgcc dynamically by default, replacing -static with -static-libstdc++ makes LLVM_BUILD_STATIC=ON executables depend on a MinGW libgcc DLL, so they can fail to start on systems without that runtime. Retain -static for executables independently of the new shared-library flags, or explicitly cover the remaining runtime libraries.

2 resolved since last review

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 29, 2026 10:00

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.

🟡 Changes recommended

Unresolved build blockers can leave MinGW's dxildll without its generated ETW header and enable unsupported -fcf-protection on native Windows ARM64.

1 open issue
1 previously missed issue

In code that hasn't changed since last review

High severity Normalize processor name before ARM64 protection check

CMakeLists.txt:114

Native Windows CMake can report CMAKE_SYSTEM_PROCESSOR as ARM64. Since MATCHES is case-sensitive, that value still enables -fcf-protection, which is unsupported for the ARM64 target, so this configuration continues to fail. Normalize the processor name to lowercase before matching so the guard handles native Windows ARM64 as well as aarch64/arm64 toolchains.

1 resolved since last review

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 29, 2026 10:21
@raedrizqie

Copy link
Copy Markdown
Contributor Author

🔵 Needs a closer look

Replacing -static with -static-libstdc++ can leave LLVM_BUILD_STATIC=ON executables dependent on a MinGW libgcc DLL, causing startup failures on systems without that runtime.

1 open issue

1 previously missed issue
In code that hasn't changed since last review

Medium severity LLVM static builds may depend on missing MinGW libgcc DLL
cmake/​modules/​HandleLLVMOptions.cmake:242

With a MinGW toolchain that links libgcc dynamically by default, replacing -static with -static-libstdc++ makes LLVM_BUILD_STATIC=ON executables depend on a MinGW libgcc DLL, so they can fail to start on systems without that runtime. Retain -static for executables independently of the new shared-library flags, or explicitly cover the remaining runtime libraries.

2 resolved since last review

Review effort: Balanced

added -static-libgcc

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.

🔵 Needs a closer look

Human assessment is needed because case-sensitive processor detection can incorrectly enable an x86-only compiler flag on Windows ARM64, breaking MinGW Clang builds.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 29, 2026 10:25

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.

🔵 Needs a closer look

Human assessment is needed because an unpublished finding identifies a case-sensitive processor check that can leave an unsupported compiler flag enabled and break Windows ARM64 MinGW builds.

No open issues 🎉

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 30, 2026 07:20

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.

🟡 Changes recommended

Fork PR checks fail with comment-permission errors, while manual runs crash because the checker receives no PR number.

2 open issues

Review effort: Balanced

name: 'PR description checker'
on:
pull_request_target:
pull_request:
- reopened
- labeled
- unlabeled
workflow_dispatch:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants