name: Build binaries on: push: branches: - "**" pull_request: types: - opened - reopened - synchronize workflow_dispatch: permissions: contents: read env: CONFIG_WIN: RelWithDebInfo CONFIG_LINUX: Release jobs: # ============================================================ # Windows / Clang (GNU driver, MSVC ABI) # ============================================================ windows: name: Windows x64 / Clang runs-on: windows-2022 steps: - name: Checkout repository uses: actions/checkout@v6 with: fetch-depth: 0 submodules: recursive - name: Setup Python 3.14 id: python uses: actions/setup-python@v6 with: python-version: "3.14" architecture: "x64" # clang++ with its GNU driver, not clang-cl: CMake only wires up C++20 # module scanning for the GNU frontend variant, and refuses to generate # otherwise. The default target on Windows is still x86_64-pc-windows-msvc, # so the ABI, the Windows SDK, the vcpkg packages and D3D12 are unchanged. # Pinned to the version the Linux job uses. - name: Install LLVM and Ninja shell: pwsh run: | choco install llvm --version=22.1.8 -y --no-progress choco install ninja -y --no-progress - name: Show environment shell: pwsh run: | python --version cmake --version ninja --version & "$env:ProgramFiles\LLVM\bin\clang++.exe" --version & "$env:ProgramFiles\LLVM\bin\clang-scan-deps.exe" --version Write-Host "Python:" Get-Command python Write-Host "Visual Studio (for the SDK and the MSVC STL):" & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" ` -latest ` -products * ` -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 ` -property installationPath # README: bootstrap vcpkg + install DirectX DXC - name: Prepare Windows dependencies shell: cmd run: | call setup.bat # Ninja, not MSBuild: CMake's module dependency scanning is best supported # there. # # Deliberately not inside vcvars64. clang finds the MSVC toolchain and the # Windows SDK by itself; letting vcvars also put them in INCLUDE gives the # same directory two spellings, one of them with doubled separators, and # #pragma once then fails to recognise the file - the SDK headers get # parsed twice and every COM interface looks like a uuid mismatch. - name: Configure shell: cmd run: | for %%p in ("${{ steps.python.outputs.python-path }}") do set "PYROOT=%%~dpp" rem CMake writes these paths verbatim into its own .cmake files, where a rem backslash starts an escape: "C:\Program Files" would be read as \P. set "LLVMBIN=%ProgramFiles:\=/%/LLVM/bin" set "PYROOT=%PYROOT:\=/%" cmake -S . -B build ^ -G Ninja ^ -DCMAKE_BUILD_TYPE=%CONFIG_WIN% ^ -DCMAKE_C_COMPILER="%LLVMBIN%/clang.exe" ^ -DCMAKE_CXX_COMPILER="%LLVMBIN%/clang++.exe" ^ -DCMAKE_RC_COMPILER="%LLVMBIN%/llvm-rc.exe" ^ -DPython3_ROOT_DIR="%PYROOT%" - name: Build shell: cmd run: | cmake --build build --parallel - name: Copy shaders shell: pwsh run: | $output = "build/bin" New-Item ` -ItemType Directory ` -Force ` -Path "$output/shaders" | Out-Null Copy-Item ` -Path "shaders/*" ` -Destination "$output/shaders" ` -Recurse ` -Force - name: Upload Windows build uses: actions/upload-artifact@v4 with: name: maszyna-windows-x64-${{ env.CONFIG_WIN }} path: | build/bin/ if-no-files-found: error retention-days: 14 - name: Upload Windows debug symbols uses: actions/upload-artifact@v4 with: name: maszyna-windows-x64-symbols-${{ env.CONFIG_WIN }} path: | build/pdb/*.pdb build/bin/*.map if-no-files-found: warn retention-days: 14 # ============================================================ # Linux / Clang # ============================================================ linux: name: Linux x64 / Clang runs-on: ubuntu-24.04 steps: - name: Checkout repository uses: actions/checkout@v6 with: fetch-depth: 0 submodules: recursive - name: Setup Python 3.14 id: python uses: actions/setup-python@v6 with: python-version: "3.14" - name: Install Linux dependencies run: | sudo apt-get update sudo apt-get install -y \ build-essential ninja-build wget lsb-release software-properties-common gnupg \ libgl1-mesa-dev \ libglew-dev \ libglfw3-dev \ libpng-dev \ libopenal-dev \ libluajit-5.1-dev \ libserialport-dev \ libsndfile1-dev \ xorg-dev \ libxkbcommon-dev \ libwayland-dev \ wayland-protocols - name: Install LLVM/Clang 22 run: | # Noble ships Clang 18, whose C++20 module support is not good enough # for this tree; apt.llvm.org has current releases. wget -qO /tmp/llvm.sh https://apt.llvm.org/llvm.sh chmod +x /tmp/llvm.sh sudo /tmp/llvm.sh 22 sudo apt-get install -y clang-tools-22 # clang-scan-deps, needed to scan modules # # Existing MaSzyna CI already builds OpenAL Soft 1.24.2, # so retain that instead of relying only on Ubuntu's package. # - name: Build OpenAL Soft run: | git clone \ --depth 1 \ --branch 1.24.2 \ https://github.com/kcat/openal-soft.git \ /tmp/openal-soft cmake \ -S /tmp/openal-soft \ -B /tmp/openal-soft/build \ -DCMAKE_BUILD_TYPE=Release \ -DALSOFT_EXAMPLES=OFF \ -DALSOFT_UTILS=OFF cmake \ --build /tmp/openal-soft/build \ --parallel "$(nproc)" sudo cmake \ --install /tmp/openal-soft/build sudo ldconfig - name: Show environment run: | clang-22 --version clang-scan-deps-22 --version ninja --version cmake --version python --version - name: Configure env: CC: clang-22 CXX: clang++-22 run: | cmake \ -S . \ -B build \ -G Ninja \ -DCMAKE_BUILD_TYPE="${CONFIG_LINUX}" \ -DWITH_BETTER_RENDERER=OFF \ -DWITH_ZMQ=OFF \ -DWITH_OPENVR=OFF \ -DUSE_LTO=OFF \ -DPython3_EXECUTABLE="${{ steps.python.outputs.python-path }}" \ -DCMAKE_CXX_FLAGS="-Wno-attributes" - name: Build run: | cmake \ --build build \ --parallel "$(nproc)" - name: Prepare Linux Python environment run: | PYTHON_ROOT="$(python -c 'import sys; print(sys.base_prefix)')" PYTHON_VERSION="$(python -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')" PYTHON_HOME="$GITHUB_WORKSPACE/build/bin/linuxpython64" echo "Python root: $PYTHON_ROOT" echo "Python version: $PYTHON_VERSION" echo "Embedded Python home: $PYTHON_HOME" python -m venv --copies "$PYTHON_HOME" cp -a \ "$PYTHON_ROOT/lib/python${PYTHON_VERSION}/." \ "$PYTHON_HOME/lib/python${PYTHON_VERSION}/" "$PYTHON_HOME/bin/python" -m pip install --upgrade pip "$PYTHON_HOME/bin/python" -m pip install --no-cache-dir Pillow "$PYTHON_HOME/bin/python" -c "from PIL import Image; print('Pillow:', Image.__version__)" - name: Copy shaders run: | mkdir -p build/bin/shaders cp -R shaders/. build/bin/shaders/ - name: Upload Linux build uses: actions/upload-artifact@v4 with: name: maszyna-linux-x64-${{ env.CONFIG_LINUX }} path: | build/bin/ if-no-files-found: error retention-days: 14