feat(build): Add Docker-based Linux build using Wine and MSVC 2022#389
Merged
x64-dev merged 1 commit intoGeneralsOnlineDevelopmentTeam:mainfrom Mar 20, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a Docker build system that compiles the game on Linux using Wine and
MSVC Build Tools, producing Windows executables equivalent to native
VS2022 builds.
Currently builds Zero Hour only (
z_generals/ GeneralsMD). Theoriginal Generals (
g_generals) was skipped because sharedCore/headers which include Zero Hour-specific files.
Files
scripts/docker-build-msvc.sh— Host-side build script with--target, --clean, --cmake, and --interactive options
resources/dockerbuild-msvc/Dockerfile— Container image with Wine,MSVC 2022 (via msvc-wine), Windows CMake, Ninja, and Git
resources/dockerbuild-msvc/entrypoint.sh— Build orchestrationinside the container
CMakePresets.json— Newmsvc-winepreset for the Wine buildGeneralsMD/Code/Main/RTS.RC— Replaceafxres.hwithwinresrc.hWhy some of this looks hacky
sed path fixups on build.ninja (entrypoint.sh lines 89-103):
CMake runs as a Windows executable under Wine and generates Unix-style
paths (
/build/cnc/...) for MSVC flags like/FI,/Yc,/Fp, andsource file arguments. MSVC executables running under Wine need
Z:drive-prefixed paths to resolve correctly. CMake has no built-in
mechanism to add drive letter prefixes in a cross-Wine scenario, so
post-processing
build.ninjawith sed is the most reliable approach.An alternative would be a compiler wrapper script that translates paths
at invocation time, but that adds per-compilation overhead and is harder
to debug. The CMake regeneration rule is also removed so Ninja doesn't
overwrite the fixed paths on incremental builds.
WindowsKits symlink (entrypoint.sh lines 38-44):
The Windows SDK installs to a directory named
Windows Kits(with aspace). When CMake under Wine resolves this path, the Windows API
returns 8.3 short filenames (e.g.
WIND~2DP) because of the space.Wine's
Z:drive maps directly to the Linux filesystem, which has no8.3 short name support, so these paths fail to resolve at build time.
A symlink (
WindowsKits→Windows Kits) eliminates the space so 8.3conversion never occurs. Renaming the directory was considered but could
break msvc-wine's own tooling that expects the canonical path.
RC compiler flags (entrypoint.sh lines 47-48, cmake line 82):
CMake doesn't automatically pass Windows SDK include paths to
rc.exein this cross-compilation scenario.
CMAKE_RC_FLAGSadds the necessary-Iflags so the resource compiler can find system headers.afxres.h→winresrc.h(RTS.RC):The original
afxres.his an MFC header that requires the MFCcomponent of Visual Studio. The game itself does not use MFC — only
standalone editor tools (ParticleEditor, W3DView) do. The
afxres.hinclude was a default from Microsoft Developer Studio's auto-generated
RC template.
winresrc.his part of the standard Windows SDK andprovides the same resource compiler defines needed here.
Hardcoded MSVC/SDK versions (entrypoint.sh lines 14-15):
The MSVC toolset version (
14.50.35717) and SDK version(
10.0.26100.0) are hardcoded to match whatmsvc-wine/vsdownload.pycurrently installs. A future improvement would be to auto-detect these
from the installed directory structure.