fix: update Windows build workflow for cross-compilation and improve CMake configuration
This commit is contained in:
parent
70aa850999
commit
21874e98c2
85
.github/workflows/windows-clang.yml
vendored
85
.github/workflows/windows-clang.yml
vendored
@ -1,4 +1,4 @@
|
|||||||
name: Windows Build (CLang)
|
name: Windows Build (Cross-compile)
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@ -14,62 +14,61 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-windows:
|
build-windows:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- os: windows-latest
|
|
||||||
compiler: clang
|
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
submodules: 'true'
|
submodules: 'true'
|
||||||
- uses: msys2/setup-msys2@v2
|
|
||||||
id: msys2
|
- name: Install cross-compilation tools
|
||||||
name: Setup MSYS2
|
run: |
|
||||||
with:
|
sudo apt-get update
|
||||||
msystem: clang64
|
sudo apt-get install -y mingw-w64 cmake wget git zip
|
||||||
install: >-
|
|
||||||
mingw-w64-clang-x86_64-toolchain
|
- name: Install CMake >= 3.26
|
||||||
mingw-w64-clang-x86_64-cmake
|
run: |
|
||||||
git
|
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
|
- name: Set up vcpkg
|
||||||
shell: msys2 {0}
|
|
||||||
run: |
|
run: |
|
||||||
git clone https://github.com/microsoft/vcpkg.git
|
git clone https://github.com/microsoft/vcpkg.git
|
||||||
cd vcpkg
|
cd vcpkg
|
||||||
./bootstrap-vcpkg.bat
|
./bootstrap-vcpkg.sh
|
||||||
./vcpkg integrate install
|
cd ..
|
||||||
cd ..
|
|
||||||
- name: Configure project with CMake and vcpkg
|
- name: Configure and build project
|
||||||
env:
|
env:
|
||||||
VCPKG_DEFAULT_TRIPLET: x64-mingw-static
|
VCPKG_DEFAULT_TRIPLET: x64-mingw-static
|
||||||
VCPKG_DEFAULT_HOST_TRIPLET: x64-mingw-static
|
VCPKG_DEFAULT_HOST_TRIPLET: x64-linux
|
||||||
shell: msys2 {0}
|
|
||||||
run: |
|
run: |
|
||||||
export VCPKG_ROOT=$(pwd)/vcpkg
|
export VCPKG_ROOT=$(pwd)/vcpkg
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake -G "MinGW Makefiles" -DVCPKG_TARGET_TRIPLET=x64-mingw-static -DVC_BUILD_NAME="${{ inputs.build_name }}" -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.cmake ..
|
cmake -DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake \
|
||||||
cmake --build . --config Release
|
-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
|
- name: Package for Windows
|
||||||
run: |
|
run: |
|
||||||
mkdir packaged
|
mkdir packaged
|
||||||
mkdir packaged/res
|
mkdir packaged/res
|
||||||
cp build/VoxelEngine.exe packaged/
|
cp build/VoxelEngine.exe packaged/VoxelCore.exe || cp build/VoxelEngine packaged/VoxelCore.exe
|
||||||
cp build/vctest/vctest.exe packaged/
|
cp build/vctest/vctest.exe packaged/ || cp build/vctest/vctest packaged/vctest.exe
|
||||||
cp build/*.dll packaged/
|
cp build/*.dll packaged/ 2>/dev/null || true
|
||||||
cp -r build/res/* packaged/res/
|
cp -r build/res/* packaged/res/
|
||||||
mv packaged/VoxelEngine.exe packaged/VoxelCore.exe
|
|
||||||
- uses: actions/upload-artifact@v3
|
- uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: Windows-Build
|
name: Windows-Build
|
||||||
path: 'packaged/*'
|
path: 'packaged/*'
|
||||||
- name: Run engine tests
|
|
||||||
shell: msys2 {0}
|
|
||||||
working-directory: ${{ github.workspace }}
|
|
||||||
run: |
|
|
||||||
packaged/vctest.exe -e packaged/VoxelCore.exe -d dev/tests -u build
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user