build(x64): add an experimental MinGW-w64 x86_64 toolchain and preset - #3250
build(x64): add an experimental MinGW-w64 x86_64 toolchain and preset#3250MeneerHaas wants to merge 1 commit into
Conversation
Adds the toolchain file and preset, lifts the 32-bit-only guard in mingw.cmake, and builds the Miles and Bink stubs on x64. DX8 stays headers-only there: MinGW-w64 x86_64 ships no libd3d8.a and no libd3dx8, so the x64 target compiles but cannot link. Existing presets are untouched. Groundwork for #473. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
PR Summary by QodoAdd experimental MinGW-w64 x86_64 build configuration
AI Description
Diagram
High-Level Assessment
Files changed (5)
|
|
Withdrawing this for now — I want to take more time over the split before asking anyone to review it. I'll reopen the series when it is ready. |
|
| Filename | Overview |
|---|---|
| CMakeLists.txt | Broadens Miles, Bink, and DX8 dependency inclusion from 32-bit Windows to all Windows architectures. |
| CMakePresets.json | Adds a visible release configure preset for the experimental x86_64 MinGW toolchain. |
| cmake/dx8.cmake | Replaces dependency-owned target creation with an architecture-aware local d3d8lib interface target. |
| cmake/mingw.cmake | Enables experimental 64-bit MinGW configuration and restricts unavailable D3D8 libraries and aliases to 32-bit builds. |
| cmake/toolchains/mingw-w64-x86_64.cmake | Adds the x86_64 cross-toolchain and disables MFC tools, but omits the required licensing prologue. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
Preset[mingw-w64-x86_64 preset] --> Toolchain[x86_64 MinGW toolchain]
Toolchain --> Configure[Windows x64 configuration]
Configure --> Dependencies[Miles, Bink, and DX8 setup]
Dependencies --> DX8[d3d8lib interface]
DX8 --> Headers[DX8 headers and definitions]
DX8 -. unavailable x64 libraries .-> Link[Final game link deferred]
Prompt To Fix All With AI
### Issue 1
cmake/toolchains/mingw-w64-x86_64.cmake:1
**Missing required licensing prologue**
The new community-owned toolchain file starts directly with its toolchain description, omitting the repository-required GPL header and TheSuperHackers copyright notice; this leaves the distributed file without the required licensing and ownership metadata.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (1): Last reviewed commit: "build(x64): add an experimental MinGW-w6..." | Re-trigger Greptile
Code Review by Qodo
1. x64 tools are disabled
|
| set(RTS_BUILD_GENERALS_TOOLS OFF CACHE BOOL "Disable MFC-dependent Generals tools for MinGW" FORCE) | ||
| set(RTS_BUILD_ZEROHOUR_TOOLS OFF CACHE BOOL "Disable MFC-dependent Zero Hour tools for MinGW" FORCE) |
There was a problem hiding this comment.
1. X64 tools are disabled 📎 Requirement gap ≡ Correctness
The x64 toolchain forcibly disables both RTS_BUILD_GENERALS_TOOLS and RTS_BUILD_ZEROHOUR_TOOLS. Consequently, two of the four targets required by the compliance rule are not upgraded or built for x64.
Agent Prompt
## Issue description
The x64 toolchain disables the required Generals Tools and Zero Hour Tools targets.
## Issue Context
PR Compliance ID 1 requires both tool suites to support successful x64 builds. Implement the necessary non-MFC or otherwise supported x64 build path instead of forcibly excluding these targets.
## Fix Focus Areas
- cmake/toolchains/mingw-w64-x86_64.cmake[29-32]
- Generals/Code/Tools/CMakeLists.txt[1-10]
- GeneralsMD/Code/Tools/CMakeLists.txt[1-11]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| # MinGW-w64 x86_64 ships no libd3d8.a and no libd3dx8, so on x64 this target | ||
| # carries headers and defines only and cannot link. See issue #473. | ||
| if(CMAKE_SIZEOF_VOID_P EQUAL 4) | ||
| target_link_libraries(d3d8lib INTERFACE d3d8 dinput8 dxguid) |
There was a problem hiding this comment.
2. X64 games cannot link 📎 Requirement gap ≡ Correctness
The new x64 configuration deliberately omits the unavailable DX8 libraries, but both game executables still link directly against d3d8 and d3dx8. Therefore, the Generals and Zero Hour x64 targets cannot produce successfully linked executables as required.
Agent Prompt
## Issue description
The x64 game targets compile but cannot link because required DirectX 8 libraries are omitted while the executables retain direct references to them.
## Issue Context
PR Compliance ID 1 requires successful x64 upgrades for both games, not compile-only targets. Provide compatible x64 implementations or replace/remove the unsupported dependencies throughout the game link configuration.
## Fix Focus Areas
- cmake/dx8.cmake[14-22]
- cmake/mingw.cmake[57-68]
- Generals/Code/Main/CMakeLists.txt[10-16]
- GeneralsMD/Code/Main/CMakeLists.txt[10-16]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| "name": "mingw-w64-x86_64", | ||
| "displayName": "MinGW-w64 64-bit (x86_64) Release", | ||
| "generator": "Unix Makefiles", | ||
| "binaryDir": "${sourceDir}/build/${presetName}", | ||
| "toolchainFile": "${sourceDir}/cmake/toolchains/mingw-w64-x86_64.cmake", |
There was a problem hiding this comment.
3. Build preset missing 🐞 Bug ≡ Correctness
The new mingw-w64-x86_64 configure preset has no matching build preset, so the repository's standard cmake --build --preset mingw-w64-x86_64 invocation fails with an unknown preset error. Every existing non-hidden configure preset has a corresponding build preset, and the generic build workflow invokes presets this way.
Agent Prompt
## Issue description
The new `mingw-w64-x86_64` configure preset lacks a corresponding build preset, causing `cmake --build --preset mingw-w64-x86_64` to fail.
## Issue Context
Existing named configure presets have matching build presets, and the repository's generic build workflow builds using the same preset name.
## Fix Focus Areas
- CMakePresets.json[195-205]
- CMakePresets.json[287-305]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
First of four pieces split out of #3248, per @xezon's suggestion.
Build system only — no C++ changes, so existing builds cannot be affected.
mingw-w64-x86_64preset, alongside the existing i686 one.mingw.cmake: the 32-bit-only guard now covers both architectures;d3d8is gated to 32-bit becauselink_libraries()is directory-scoped and would otherwise hit the Miles/Bink stubs.dx8.cmake: on x64,d3d8libcarries headers and defines only. MinGW-w64 x86_64 ships nolibd3d8.aand nolibd3dx8, so the x64 target compiles but does not link. That is expected at this stage.MFC tools are off for this toolchain — MinGW has no MFC.
Groundwork for #473. Follow-ups will add pointer-sized integer types, persistence identity widths, and the crash-handler ports, one PR at a time.
Testing: clean VC6 builds of both games unchanged (0 errors, all 13 retail
.textdigests reproduce); MinGW i686 unchanged; x64 preset configures and compiles.Code was written with LLM assistance and verified by clean builds and byte-level artifact comparison, per CONTRIBUTING.
🤖 Generated with Claude Code