Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
2be368e
build(cmake): Add MinGW-w64 toolchain and base configuration (#2067)
JohnsterID Jan 5, 2026
8213b93
build(cmake): Add widl integration for COM interface generation (#2067)
JohnsterID Jan 5, 2026
83cde2b
build(cmake): Add ReactOS ATL and PSEH compatibility layer (#2067)
JohnsterID Jan 5, 2026
c8e7b4e
build(cmake): Add ReactOS COM support utilities (comsupp) (#2067)
JohnsterID Jan 5, 2026
8f2bf0a
build(deps): Update external dependencies for MinGW-w64 support (#2067)
JohnsterID Jan 5, 2026
7fc16b0
build(cmake): Configure MinGW-specific compiler and linker settings (…
JohnsterID Jan 5, 2026
b8eb81b
build(cmake): Add MinGW CMake presets for i686 (#2067)
JohnsterID Jan 5, 2026
ebc51f5
fix(precompiled): Add ATL compatibility to precompiled headers (#2067)
JohnsterID Jan 5, 2026
f4771e3
fix(cmake): Fix CMake dependencies and library linking for MinGW (#2067)
JohnsterID Jan 5, 2026
e28663d
fix(core): Add MinGW-w64 compatibility fixes to Core libraries (#2067)
JohnsterID Jan 5, 2026
8c24b2d
fix(headers): Add missing forward declarations for MinGW (#2067)
JohnsterID Jan 5, 2026
52fa995
fix(linkage): Fix static/extern linkage mismatches for MinGW (#2067)
JohnsterID Jan 5, 2026
7cf48ac
fix(calling-convention): Standardize calling conventions and variadic…
JohnsterID Jan 5, 2026
cbaa310
fix(compatibility): Add compiler guards and GCC inline assembly for S…
JohnsterID Jan 5, 2026
34035dc
fix(casts): Add explicit void* casts for function pointers (#2067)
JohnsterID Jan 5, 2026
d26ebe5
fix(debug): Simplify unconditional DEBUG_ASSERTCRASH to DEBUG_CRASH (…
JohnsterID Jan 16, 2026
fe12301
feat(cmake): Add debug symbol stripping for MinGW Release builds (#2067)
JohnsterID Jan 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,18 @@ project(genzh LANGUAGES C CXX)
# This file handles extra settings wanted/needed for different compilers.
include(cmake/compilers.cmake)

# Debug symbol stripping for Release builds (MinGW)
include(cmake/debug_strip.cmake)

include(FetchContent)

# MinGW-w64 specific configuration
if(MINGW)
include(cmake/mingw.cmake)
include(cmake/reactos-atl.cmake)
include(cmake/widl.cmake)
endif()

# Find/Add build dependencies and stubs shared by all projects
if((WIN32 OR "${CMAKE_SYSTEM}" MATCHES "Windows") AND ${CMAKE_SIZEOF_VOID_P} EQUAL 4)
include(cmake/miles.cmake)
Expand Down
88 changes: 88 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,37 @@
"inherits": "default-vcpkg",
"hidden": false,
"displayName": "Unix 32bit VCPKG Release"
},
{
"name": "mingw-w64-i686",
"displayName": "MinGW-w64 32-bit (i686) Release",
"generator": "Unix Makefiles",
"hidden": false,
"binaryDir": "${sourceDir}/build/${presetName}",
"toolchainFile": "${sourceDir}/cmake/toolchains/mingw-w64-i686.cmake",
"cacheVariables": {
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "mingw-w64-i686-debug",
"displayName": "MinGW-w64 32-bit (i686) Debug",
"hidden": false,
"inherits": "mingw-w64-i686",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"RTS_BUILD_OPTION_DEBUG": "ON"
}
},
{
"name": "mingw-w64-i686-profile",
"displayName": "MinGW-w64 32-bit (i686) Profile",
"hidden": false,
"inherits": "mingw-w64-i686",
"cacheVariables": {
"RTS_BUILD_OPTION_PROFILE": "ON"
}
}
],
"buildPresets": [
Expand Down Expand Up @@ -240,6 +271,24 @@
"displayName": "Build Unix 32bit VCPKG Release",
"description": "Build Unix 32bit VCPKG Release",
"configuration": "Release"
},
{
"name": "mingw-w64-i686",
"configurePreset": "mingw-w64-i686",
"displayName": "Build MinGW-w64 32-bit (i686) Release",
"description": "Build MinGW-w64 32-bit (i686) Release"
},
{
"name": "mingw-w64-i686-debug",
"configurePreset": "mingw-w64-i686-debug",
"displayName": "Build MinGW-w64 32-bit (i686) Debug",
"description": "Build MinGW-w64 32-bit (i686) Debug"
},
{
"name": "mingw-w64-i686-profile",
"configurePreset": "mingw-w64-i686-profile",
"displayName": "Build MinGW-w64 32-bit (i686) Profile",
"description": "Build MinGW-w64 32-bit (i686) Profile"
}
],
"workflowPresets": [
Expand Down Expand Up @@ -398,6 +447,45 @@
"name": "unix"
}
]
},
{
"name": "mingw-w64-i686",
"steps": [
{
"type": "configure",
"name": "mingw-w64-i686"
},
{
"type": "build",
"name": "mingw-w64-i686"
}
]
},
{
"name": "mingw-w64-i686-debug",
"steps": [
{
"type": "configure",
"name": "mingw-w64-i686-debug"
},
{
"type": "build",
"name": "mingw-w64-i686-debug"
}
]
},
{
"name": "mingw-w64-i686-profile",
"steps": [
{
"type": "configure",
"name": "mingw-w64-i686-profile"
},
{
"type": "build",
"name": "mingw-w64-i686-profile"
}
]
}
]
}
5 changes: 5 additions & 0 deletions Core/GameEngine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1198,3 +1198,8 @@ target_link_libraries(corei_gameengine_public INTERFACE
gamespy::gamespy
stlport
)

# ReactOS ATL for MinGW-w64 only (MSVC uses native ATL)
if(MINGW)
target_link_libraries(corei_gameengine_public INTERFACE reactos_atl)
endif()
5 changes: 5 additions & 0 deletions Core/GameEngine/Include/GameNetwork/WOLBrowser/FEBDispatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@

#pragma once

#if defined __MINGW32__
#include "Utility/atl_compat.h"
#include "Utility/comsupp_compat.h"
#endif

#include <atlbase.h>
extern CComModule _Module;
#include <atlcom.h>
Expand Down
9 changes: 9 additions & 0 deletions Core/GameEngine/Source/Common/System/MiniDumper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ void MiniDumper::TriggerMiniDump(DumpType dumpType)
return;
}

#if defined(_MSC_VER)
// MSVC supports structured exception handling (__try/__except)
__try
{
// Use DebugBreak to raise an exception that can be caught in the __except block
Expand All @@ -102,6 +104,13 @@ void MiniDumper::TriggerMiniDump(DumpType dumpType)
{
TriggerMiniDumpForException(g_dumpException, dumpType);
}
#elif defined(__GNUC__) && defined(_WIN32)
// GCC/MinGW-w64 doesn't support MSVC's __try/__except syntax
// Trigger dump directly without SEH support
DEBUG_LOG(("MiniDumper::TriggerMiniDump: SEH not supported on this compiler, skipping manual dump trigger."));
#else
#error "MiniDumper::TriggerMiniDump: Unsupported compiler. This code requires MSVC or GCC/MinGW-w64 targeting Windows."
#endif
}

void MiniDumper::TriggerMiniDumpForException(_EXCEPTION_POINTERS* e_info, DumpType dumpType)
Expand Down
2 changes: 1 addition & 1 deletion Core/GameEngine/Source/Common/System/XferCRC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include "Common/XferDeepCRC.h"
#include "Common/crc.h"
#include "Common/Snapshot.h"
#include "utility/endian_compat.h"
#include "Utility/endian_compat.h"

//-------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ class InputStream;
class OutputStream;
class DataChunkInput;
struct DataChunkInfo;
class TerrainTextureClass;
class AlphaTerrainTextureClass;
class AlphaEdgeTextureClass;

#define NUM_ALPHA_TILES 12
Expand Down
4 changes: 2 additions & 2 deletions Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ void drawDebugCircle( const Coord3D & center, Real radius, Real width, Color col
}
}

void drawDrawableExtents( Drawable *draw, void *userData ); // FORWARD DECLARATION
static void drawDrawableExtents( Drawable *draw, void *userData ); // FORWARD DECLARATION
// ------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------
static void drawContainedDrawable( Object *obj, void *userData )
Expand Down Expand Up @@ -867,7 +867,7 @@ static void drawDrawableExtents( Drawable *draw, void *userData )
}


void drawAudioLocations( Drawable *draw, void *userData );
static void drawAudioLocations( Drawable *draw, void *userData );
// ------------------------------------------------------------------------------------------------
// Helper for drawAudioLocations
// ------------------------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1083,7 +1083,7 @@ extern HWND ApplicationHWnd;
//TODO: Fix editor so it actually draws the wave segment instead of line while editing
//Could freeze all the water while editing? Or keep setting elapsed time on current segment.
//Have to make it so seamless merge of segments at final position.
static void TestWaterUpdate(void)
void TestWaterUpdate(void)
{
static Int doInit=1;
static WaterTracksObj *track=nullptr,*track2=nullptr;
Expand Down
8 changes: 4 additions & 4 deletions Core/Libraries/Include/Lib/BaseTypeCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@
//#define abs(x) (((x) < 0) ? -(x) : (x))
//#endif

#ifndef min
#define min(x,y) (((x)<(y)) ? (x) : (y))
#ifndef MIN
#define MIN(x,y) (((x)<(y)) ? (x) : (y))
Comment thread
JohnsterID marked this conversation as resolved.
#endif

#ifndef max
#define max(x,y) (((x)>(y)) ? (x) : (y))
#ifndef MAX
#define MAX(x,y) (((x)>(y)) ? (x) : (y))
#endif

#ifndef TRUE
Expand Down
4 changes: 2 additions & 2 deletions Core/Libraries/Source/Compression/LZHCompress/NoxCompress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ Bool CompressFile (char *infile, char *outfile)
compressor = LZHLCreateCompressor();
for ( i = 0; i < rawSize; i += BLOCKSIZE )
{
blocklen = min((UnsignedInt)BLOCKSIZE, rawSize - i);
blocklen = MIN((UnsignedInt)BLOCKSIZE, rawSize - i);
compressed = LZHLCompress(compressor, outBlock + compressedSize, inBlock + i, blocklen);
compressedSize += compressed;
}
Expand Down Expand Up @@ -282,7 +282,7 @@ Bool CompressMemory (void *inBufferVoid, Int inSize, void *outBufferVoid, Int&
compressor = LZHLCreateCompressor();
for ( i = 0; i < rawSize; i += BLOCKSIZE )
{
blocklen = min((UnsignedInt)BLOCKSIZE, rawSize - i);
blocklen = MIN((UnsignedInt)BLOCKSIZE, rawSize - i);
compressed = LZHLCompress(compressor, outBuffer + compressedSize, inBuffer + i, blocklen);
compressedSize += compressed;
}
Expand Down
36 changes: 26 additions & 10 deletions Core/Libraries/Source/EABrowserDispatch/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,32 @@
add_library(core_browserdispatch INTERFACE)

if(WIN32 OR "${CMAKE_SYSTEM}" MATCHES "Windows")
add_custom_command(
OUTPUT BrowserDispatch_i.c BrowserDispatch.h
COMMAND midl.exe "${CMAKE_CURRENT_LIST_DIR}\\BrowserDispatch.idl" /header BrowserDispatch.h
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS "${CMAKE_CURRENT_LIST_DIR}/BrowserDispatch.idl"
VERBATIM
)
add_library(core_browserdispatchwin STATIC BrowserDispatch_i.c)
set_target_properties(core_browserdispatchwin PROPERTIES OUTPUT_NAME browserdispatchwin)
target_link_libraries(core_browserdispatch INTERFACE core_browserdispatchwin)
if(MINGW AND IDL_COMPILER_FOUND)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Does the browser engine stuff actually work and do anything useful these days? Maybe just strip it out as it isn't cross platform anyhow? Porbably not something to address in this PR though.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yes, it looks like the browser engine stuff is legacy and non-functional. It embeds Internet Explorer into DirectX 8 textures for WOL (Westwood Online) Terms of Service and Message Board display. We can leave it for now since it compiles with widl. Future PR remove/replace WOL.

WOLLoginMenu.cpp - Terms of Service display
WOLLadderScreen.cpp - Message Board display

# Use widl for MinGW builds
add_idl_file(browserdispatch_idl "${CMAKE_CURRENT_LIST_DIR}/BrowserDispatch.idl")
add_library(core_browserdispatchwin STATIC ${browserdispatch_idl_IID} ${browserdispatch_idl_HEADER})
elseif(MSVC)
# Use midl for MSVC builds
add_custom_command(
OUTPUT BrowserDispatch_i.c BrowserDispatch.h
COMMAND midl.exe "${CMAKE_CURRENT_LIST_DIR}\\BrowserDispatch.idl" /header BrowserDispatch.h /iid BrowserDispatch_i.c
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS "${CMAKE_CURRENT_LIST_DIR}/BrowserDispatch.idl"
VERBATIM
)
add_library(core_browserdispatchwin STATIC BrowserDispatch_i.c)
else()
message(FATAL_ERROR
"EABrowserDispatch requires an IDL compiler for Windows builds:\n"
" - For MinGW: Install widl (apt-get install wine-stable-dev)\n"
" - For MSVC: midl.exe should be in PATH\n"
" - For other compilers: Not currently supported")
endif()

if(TARGET core_browserdispatchwin)
set_target_properties(core_browserdispatchwin PROPERTIES OUTPUT_NAME browserdispatchwin)
target_link_libraries(core_browserdispatch INTERFACE core_browserdispatchwin)
endif()
endif()

target_include_directories(core_browserdispatch INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/..)
36 changes: 26 additions & 10 deletions Core/Libraries/Source/EABrowserEngine/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,32 @@
add_library(core_browserengine INTERFACE)

if(WIN32 OR "${CMAKE_SYSTEM}" MATCHES "Windows")
add_custom_command(
OUTPUT BrowserEngine_i.c BrowserEngine.h
COMMAND midl.exe "${CMAKE_CURRENT_LIST_DIR}\\BrowserEngine.idl" /header BrowserEngine.h
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS "${CMAKE_CURRENT_LIST_DIR}/BrowserEngine.idl"
VERBATIM
)
add_library(core_browserenginewin STATIC BrowserEngine_i.c)
set_target_properties(core_browserenginewin PROPERTIES OUTPUT_NAME browserenginewin)
target_link_libraries(core_browserengine INTERFACE core_browserenginewin)
if(MINGW AND IDL_COMPILER_FOUND)
# Use widl for MinGW builds
add_idl_file(browserengine_idl "${CMAKE_CURRENT_LIST_DIR}/BrowserEngine.idl")
add_library(core_browserenginewin STATIC ${browserengine_idl_IID} ${browserengine_idl_HEADER})
elseif(MSVC)
# Use midl for MSVC builds
add_custom_command(
OUTPUT BrowserEngine_i.c BrowserEngine.h
COMMAND midl.exe "${CMAKE_CURRENT_LIST_DIR}\\BrowserEngine.idl" /header BrowserEngine.h /iid BrowserEngine_i.c
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS "${CMAKE_CURRENT_LIST_DIR}/BrowserEngine.idl"
VERBATIM
)
add_library(core_browserenginewin STATIC BrowserEngine_i.c)
else()
message(FATAL_ERROR
"EABrowserEngine requires an IDL compiler for Windows builds:\n"
" - For MinGW: Install widl (apt-get install wine-stable-dev)\n"
" - For MSVC: midl.exe should be in PATH\n"
" - For other compilers: Not currently supported")
endif()

if(TARGET core_browserenginewin)
set_target_properties(core_browserenginewin PROPERTIES OUTPUT_NAME browserenginewin)
target_link_libraries(core_browserengine INTERFACE core_browserenginewin)
endif()
endif()

target_include_directories(core_browserengine INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/..)
4 changes: 3 additions & 1 deletion Core/Libraries/Source/WWVegas/WW3D2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -237,12 +237,14 @@ add_library(corei_ww3d2 INTERFACE)

target_sources(corei_ww3d2 INTERFACE ${WW3D2_SRC})

if (NOT IS_VS6_BUILD)
if (MSVC AND NOT IS_VS6_BUILD)
target_link_libraries(corei_ww3d2 INTERFACE
comsuppw
)
endif()

target_link_libraries(corei_ww3d2 INTERFACE
core_browserengine
core_wwlib
core_wwmath
)
3 changes: 3 additions & 0 deletions Core/Libraries/Source/WWVegas/WW3D2/dx8webbrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@

#else

#ifdef __MINGW32__
#include "Utility/comsupp_compat.h" // MinGW COM support compatibility
#endif
#include <comutil.h>
#include <comip.h>

Expand Down
4 changes: 2 additions & 2 deletions Core/Libraries/Source/WWVegas/WW3D2/missingtexture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ void MissingTexture::_Deinit()
_MissingTexture=nullptr;
}

static unsigned int missing_image_palette[]={
unsigned int missing_image_palette[]={
0x7F040204,0x7F048AC4,0x7F84829C,0x7FFC0204,0x7F0442AB,0x7FFCFE04,0x7F444244,0x7F0462FC,
0x7F84CEE4,0x7FC4C6CF,0x7F9CA6B2,0x7FC4E6F4,0x7F04FE04,0x7F4C82D4,0x7F2452A1,0x7F0442D4,
0x7F446AB0,0x7FA4A6B6,0x7F2C62C2,0x7FE4E6E9,0x7F646264,0x7F0402FC,0x7FC4D6E1,0x7F44B6DC,
Expand Down Expand Up @@ -196,7 +196,7 @@ static unsigned int missing_image_palette[]={
0x7FACDEEC,0x7F2CA6D4,0x7F0452E4,0x7FD4D6E4,0x7F849ED4,0x7FB4B6CC,0x7F4C7ACC,0x7FACC6FC,
0x7F9496B4,0x7F042AA4,0x7F1C62E4,0x7F74A6EC,0x7FE4EEFC,0x7F1C72FC,0x7FD4DEEC,0x7F2C5ABC};

static unsigned int missing_image_pixels[]={
unsigned int missing_image_pixels[]={
0x03030303,0x03030303,0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7,
0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7,
0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7,
Expand Down
1 change: 1 addition & 0 deletions Core/Libraries/Source/WWVegas/WW3D2/texture.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class DX8Wrapper;
class TextureLoader;
class LoaderThreadClass;
class TextureLoadTaskClass;
class TextureClass;
class CubeTextureClass;
class VolumeTextureClass;

Expand Down
1 change: 1 addition & 0 deletions Core/Libraries/Source/WWVegas/WW3D2/textureloader.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
class StringClass;
struct IDirect3DTexture8;
class TextureLoadTaskClass;
class TextureLoadTaskListClass;

class TextureLoader
{
Expand Down
Loading
Loading