-
Notifications
You must be signed in to change notification settings - Fork 248
build(x64): add an experimental MinGW-w64 x86_64 toolchain and preset #3250
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,4 +4,47 @@ FetchContent_Declare( | |
| GIT_TAG 7bddff8c01f5fb931c3cb73d4aa8e66d303d97bc | ||
| ) | ||
|
|
||
| FetchContent_MakeAvailable(dx8) | ||
| # Populate only: the fetched repo's CMakeLists.txt has no architecture condition, | ||
| # so d3d8lib is defined here, where it can diverge by CMAKE_SIZEOF_VOID_P. | ||
| FetchContent_GetProperties(dx8) | ||
| if(NOT dx8_POPULATED) | ||
| FetchContent_Populate(dx8) | ||
| endif() | ||
|
|
||
| add_library(d3d8lib INTERFACE) | ||
|
|
||
| # 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) | ||
|
Comment on lines
+16
to
+19
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 2. X64 games cannot link 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
|
||
| else() | ||
| message(STATUS "DX8: x64 build — headers only, no D3D8 link libraries available") | ||
| endif() | ||
|
|
||
| # MSVC-specific configuration | ||
| if(MSVC) | ||
| # Use bundled MSVC-compiled .lib files | ||
| target_link_libraries(d3d8lib INTERFACE d3dx8) | ||
| target_link_directories(d3d8lib BEFORE INTERFACE ${dx8_SOURCE_DIR}) | ||
| target_link_options(d3d8lib INTERFACE /NODEFAULTLIB:libci.lib) | ||
|
|
||
| if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "12.0.8804") | ||
| # Modern MSVC (VS 2013+) has complete DirectX headers in Windows SDK | ||
| target_link_libraries(d3d8lib INTERFACE legacy_stdio_definitions) | ||
| target_link_options(d3d8lib INTERFACE /SAFESEH:NO) | ||
| else() | ||
| # VC6 and older MSVC need extra headers - their DirectX SDK is missing newer definitions | ||
| target_include_directories(d3d8lib INTERFACE ${dx8_SOURCE_DIR}/extra) | ||
| endif() | ||
| endif() | ||
|
|
||
| # MinGW-specific configuration | ||
| if(MINGW) | ||
| # i686 ships libd3d8.a and libd3dx8d.a; x86_64 ships neither. | ||
| if(CMAKE_SIZEOF_VOID_P EQUAL 4) | ||
| target_link_libraries(d3d8lib INTERFACE d3dx8d) | ||
| endif() | ||
| endif() | ||
|
|
||
| target_compile_definitions(d3d8lib INTERFACE -DBUILD_WITH_D3D8) | ||
| target_include_directories(d3d8lib INTERFACE ${dx8_SOURCE_DIR}) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # MinGW-w64 64-bit (x86_64) Toolchain File | ||
| # Use with: cmake -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/mingw-w64-x86_64.cmake | ||
|
|
||
| set(CMAKE_SYSTEM_NAME Windows) | ||
| set(CMAKE_SYSTEM_PROCESSOR x86_64) | ||
|
|
||
| # Specify the cross compiler | ||
| set(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc) | ||
| set(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++) | ||
| set(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres) | ||
| set(CMAKE_AR x86_64-w64-mingw32-ar) | ||
| set(CMAKE_RANLIB x86_64-w64-mingw32-ranlib) | ||
| set(CMAKE_DLLTOOL x86_64-w64-mingw32-dlltool) | ||
|
|
||
| # Target environment | ||
| set(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32) | ||
|
|
||
| # Adjust the default behavior of the FIND_XXX() commands: | ||
| # search programs in the host environment | ||
| set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) | ||
|
|
||
| # search headers and libraries in the target environment | ||
| set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) | ||
| set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) | ||
|
|
||
| # Force 64-bit pointer size | ||
| set(CMAKE_SIZEOF_VOID_P 8) | ||
|
|
||
| # Disable MFC-dependent tools (not compatible with MinGW-w64) | ||
| set(RTS_BUILD_CORE_TOOLS OFF CACHE BOOL "Disable MFC-dependent core tools for MinGW" FORCE) | ||
| 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) | ||
|
Comment on lines
+31
to
+32
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 1. X64 tools are disabled 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
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3. Build preset missing
🐞 Bug≡ CorrectnessAgent Prompt
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools