Summary
Add native Linux compilation support alongside existing Windows builds. Currently, the Docker-based build produces Windows executables (.exe) that run via Wine — this proposal adds true native Linux binaries.
Problem
Current State
- Docker build (
scripts/docker-build.sh) exists but produces Windows .exe files
- Linux users must run the game through Wine/Proton
- No way to compile native Linux binaries directly
- Scripts don't clearly indicate they produce Windows executables, not native Linux
Why Native Linux?
- Better performance (no Wine overhead)
- Easier debugging with native tools (gdb, valgrind)
- Simpler CI/CD without Docker containers
- First-class Linux support for the community
Solution
Core Approach: DXVK
Use DXVK to translate DirectX 8 calls to Vulkan at runtime. This allows the existing DirectX rendering code to work on Linux with minimal source code changes.
DirectX 8 Code (unchanged) → DXVK Library → Vulkan → GPU
Key Changes
-
CMake Feature Toggles
option(RTS_USE_DXVK "Use DXVK (DirectX->Vulkan)" OFF)
option(RTS_USE_FFMPEG "Use FFmpeg for video" ON)
option(RTS_USE_OPENAL "Use OpenAL for audio" OFF)
cmake_dependent_option(RTS_USE_DX8 "Use DirectX 8" ON "WIN32" OFF)
cmake_dependent_option(RTS_USE_DXVK "Use DXVK" ON "NOT WIN32" OFF)
-
Linux CMake Presets
{
"name": "linux",
"displayName": "Linux x64 Release",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/linux",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"RTS_USE_DXVK": "ON",
"RTS_USE_FFMPEG": "ON"
}
}
-
Platform Detection
if(WIN32)
target_compile_definitions(core_config INTERFACE _WINDOWS)
elseif(UNIX AND NOT APPLE)
target_compile_definitions(core_config INTERFACE _LINUX _UNIX)
endif()
Dependency Matrix
| Component |
Windows |
Linux (Native) |
| Graphics |
DirectX 8 |
DXVK (DX8→Vulkan) |
| Video |
Bink |
FFmpeg |
| Audio |
Miles |
Miles*/OpenAL |
| Fonts |
GDI |
FreeType + FontConfig |
| File I/O |
Win32 API |
std::filesystem (StdDevice) |
| Windowing |
Win32 |
SDL3 or X11 |
| Input |
DirectInput |
SDL3 or libevdev |
*Miles may work via compatibility layer
Existing Infrastructure
The codebase already has cross-platform foundations:
- StdLocalFileSystem - Uses
std::filesystem, handles path separators and case-insensitivity
- Compatibility headers in
Dependencies/Utility/Utility/:
compat.h, thread_compat.h, endian_compat.h, intrin_compat.h
- FFmpeg video backend - Already exists in
Core/GameEngineDevice/Source/VideoDevice/FFmpeg/
Reference Implementation
Fighter19's fork (develop branch) demonstrates a working approach with:
- DXVK integration
- SDL3 support
- CMake feature toggles
- Linux CI builds
Tasks
Phase 1: CMake Restructuring
Phase 2: DXVK Integration
Phase 3: Dependency Management
Phase 4: Compiler Compatibility
Phase 5: Build Scripts
Phase 6: CI/CD
Phase 7: Documentation
Open Questions
- SDL3 - Required or optional for windowing/input?
- Audio - Miles via compatibility layer vs native OpenAL?
- Priority - Zero Hour first, then Generals?
- Minimum requirements - Vulkan 1.1+, glibc version?
- Tools - Include WorldBuilder, W3DView in Linux build?
Files to Create
cmake/dxvk.cmake
cmake/ffmpeg.cmake
cmake/openal.cmake
cmake/freetype.cmake
cmake/platform-deps.cmake
cmake/game-install.cmake
scripts/linux-native-build.sh
scripts/install-linux-deps.sh
scripts/run-generals-linux.sh
.github/workflows/linux-native.yml
Files to Modify
CMakeLists.txt
CMakePresets.json
cmake/config.cmake
cmake/compilers.cmake
vcpkg.json
README.md
scripts/docker-build.sh
Related
/cc @xezon @feliwir
Summary
Add native Linux compilation support alongside existing Windows builds. Currently, the Docker-based build produces Windows executables (.exe) that run via Wine — this proposal adds true native Linux binaries.
Problem
Current State
scripts/docker-build.sh) exists but produces Windows .exe filesWhy Native Linux?
Solution
Core Approach: DXVK
Use DXVK to translate DirectX 8 calls to Vulkan at runtime. This allows the existing DirectX rendering code to work on Linux with minimal source code changes.
Key Changes
CMake Feature Toggles
Linux CMake Presets
{ "name": "linux", "displayName": "Linux x64 Release", "generator": "Ninja", "binaryDir": "${sourceDir}/build/linux", "cacheVariables": { "CMAKE_BUILD_TYPE": "Release", "RTS_USE_DXVK": "ON", "RTS_USE_FFMPEG": "ON" } }Platform Detection
Dependency Matrix
*Miles may work via compatibility layer
Existing Infrastructure
The codebase already has cross-platform foundations:
std::filesystem, handles path separators and case-insensitivityDependencies/Utility/Utility/:compat.h,thread_compat.h,endian_compat.h,intrin_compat.hCore/GameEngineDevice/Source/VideoDevice/FFmpeg/Reference Implementation
Fighter19's fork (develop branch) demonstrates a working approach with:
Tasks
Phase 1: CMake Restructuring
RTS_USE_DXVK,RTS_USE_FFMPEG,RTS_USE_OPENAL, etc.)_LINUX,_UNIX)linuxandlinux-debugpresets toCMakePresets.jsoncmake/platform-deps.cmakefor centralized dependency handlingcmake/game-install.cmakehelper to reduce CMake duplicationPhase 2: DXVK Integration
cmake/dxvk.cmaketo fetch DXVK native librariesPhase 3: Dependency Management
cmake/ffmpeg.cmakefor Linux video playbackcmake/freetype.cmakefor font renderingcmake/openal.cmakefor audio (if needed)vcpkg.jsonwith Linux dependenciesPhase 4: Compiler Compatibility
cmake/compilers.cmakehash_map→unordered_map(MSVC extension)Phase 5: Build Scripts
scripts/linux-native-build.shscripts/install-linux-deps.sh(distro detection)scripts/run-generals-linux.sh(game launcher)scripts/docker-build.shheader to clarify it produces Windows .exePhase 6: CI/CD
.github/workflows/linux-native.ymlPhase 7: Documentation
README.mdwith Linux build instructionsOpen Questions
Files to Create
Files to Modify
Related
tmp/native-linux.txtin this repo/cc @xezon @feliwir