1:1 source port of the engine and game code; Windows build and system layer; docs. No game files or SDK headers.

This commit is contained in:
CRTkafa 2026-10-22 16:30:40 +08:00
parent c3b032a45a
commit 0ecb47e9cb
3871 changed files with 91080 additions and 1640063 deletions

32
port/winbuild.sh Normal file
View file

@ -0,0 +1,32 @@
#!/usr/bin/env bash
# Windows system layer (task 9), not 1:1: configure + build choc3port.exe (32-bit llvm-mingw, CMake + Ninja).
# usage: bash port/winbuild.sh [ninja args...] (build dir: port/build-win, gitignored; at most -j4)
# Tool locations are auto-detected: llvm-mingw from winget (MartinStorsjo.LLVM-MinGW.UCRT) or $LLVM_MINGW_ROOT, and
# CMake + Ninja from a Visual Studio install (or PATH). Nothing here runs the game.
set -e
here="$(cd "$(dirname "$0")" && pwd)"
if [ -z "$LLVM_MINGW_ROOT" ]; then
LLVM_MINGW_ROOT="$(ls -d "$LOCALAPPDATA"/Microsoft/WinGet/Packages/MartinStorsjo.LLVM-MinGW.UCRT*/llvm-mingw-* 2>/dev/null | head -1)"
fi
[ -d "$LLVM_MINGW_ROOT/bin" ] || { echo "llvm-mingw not found: winget install MartinStorsjo.LLVM-MinGW.UCRT"; exit 1; }
LLVM_MINGW_ROOT="$(cygpath -m "$LLVM_MINGW_ROOT" 2>/dev/null || echo "$LLVM_MINGW_ROOT")"
export LLVM_MINGW_ROOT
export PATH="$(cygpath -u "$LLVM_MINGW_ROOT")/bin:$PATH"
if ! command -v cmake >/dev/null || ! command -v ninja >/dev/null; then
for vs in "/c/Program Files/Microsoft Visual Studio"/*/Community/Common7/IDE/CommonExtensions/Microsoft/CMake; do
[ -d "$vs/CMake/bin" ] && export PATH="$vs/CMake/bin:$vs/Ninja:$PATH" && break
done
fi
bash "$here/../tools/port/prepare_thirdparty_win.sh"
# OpenAL Soft (the real OpenAL API on Windows; the ported Apple oalImp classes are not built): one-time DLL build.
oal="$here/../parity-out/thirdparty/win32/openal-build"
if [ ! -f "$oal/OpenAL32.dll" ]; then
cmake -G Ninja -S "$here/../parity-out/thirdparty/src/openal-soft" -B "$oal" -DCMAKE_TOOLCHAIN_FILE="$here/cmake/llvm-mingw-i686.cmake" -DCMAKE_BUILD_TYPE=Release -DLIBTYPE=SHARED -DALSOFT_EXAMPLES=OFF -DALSOFT_UTILS=OFF -DALSOFT_TESTS=OFF -DALSOFT_INSTALL=OFF -DCMAKE_CXX_FLAGS="-include cstdlib" # fmt 11.1.1 in OpenAL Soft lacks <cstdlib> with this libc++
ninja -C "$oal" -j4 OpenAL
fi
build="$here/build-win"
if [ ! -f "$build/build.ninja" ]; then
cmake -G Ninja -S "$here" -B "$build" -DCMAKE_TOOLCHAIN_FILE="$here/cmake/llvm-mingw-i686.cmake" \
-DCMAKE_BUILD_TYPE=Release
fi
ninja -C "$build" -j4 "$@"