75 lines
2.3 KiB
YAML
75 lines
2.3 KiB
YAML
name: Windows Build (Cross-compile)
|
|
|
|
on:
|
|
push:
|
|
branches: [ "main", "release-**"]
|
|
pull_request:
|
|
branches: [ "main", "dev" ]
|
|
workflow_call:
|
|
inputs:
|
|
build_name:
|
|
required: true
|
|
type: string
|
|
description: 'Build name passed as VC_BUILD_NAME define'
|
|
|
|
jobs:
|
|
build-windows:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: 'true'
|
|
|
|
- name: Install cross-compilation tools
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y mingw-w64 cmake wget git zip
|
|
|
|
- name: Install CMake >= 3.26
|
|
run: |
|
|
wget https://github.com/Kitware/CMake/releases/download/v3.27.9/cmake-3.27.9-linux-x86_64.sh
|
|
chmod +x cmake-3.27.9-linux-x86_64.sh
|
|
sudo ./cmake-3.27.9-linux-x86_64.sh --skip-license --prefix=/usr/local
|
|
rm cmake-3.27.9-linux-x86_64.sh
|
|
|
|
- name: Set up vcpkg
|
|
run: |
|
|
git clone https://github.com/microsoft/vcpkg.git
|
|
cd vcpkg
|
|
./bootstrap-vcpkg.sh
|
|
cd ..
|
|
|
|
- name: Configure and build project
|
|
env:
|
|
VCPKG_DEFAULT_TRIPLET: x64-mingw-static
|
|
VCPKG_DEFAULT_HOST_TRIPLET: x64-linux
|
|
run: |
|
|
export VCPKG_ROOT=$(pwd)/vcpkg
|
|
mkdir build
|
|
cd build
|
|
cmake -DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake \
|
|
-DVCPKG_TARGET_TRIPLET=x64-mingw-static \
|
|
-DCMAKE_SYSTEM_NAME=Windows \
|
|
-DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc \
|
|
-DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++ \
|
|
-DCMAKE_RC_COMPILER=x86_64-w64-mingw32-windres \
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
-DVC_BUILD_NAME="${{ inputs.build_name }}" \
|
|
..
|
|
cmake --build . --config Release
|
|
|
|
- name: Package for Windows
|
|
run: |
|
|
mkdir packaged
|
|
mkdir packaged/res
|
|
cp build/VoxelEngine.exe packaged/VoxelCore.exe || cp build/VoxelEngine packaged/VoxelCore.exe
|
|
cp build/vctest/vctest.exe packaged/ || cp build/vctest/vctest packaged/vctest.exe
|
|
cp build/*.dll packaged/ 2>/dev/null || true
|
|
cp -r build/res/* packaged/res/
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
with:
|
|
name: Windows-Build
|
|
path: 'packaged/*'
|