1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
name: build - windows msvc
on:
workflow_call:
jobs:
windows-msvc:
# inspired by https://github.com/lukka/CppCMakeVcpkgTemplate/blob/main/.github/workflows/hosted-pure-workflow.yml
strategy:
matrix:
config: [Debug, Release]
arch: [x64, x86]
name: Windows ${{ matrix.config }} ${{ matrix.arch }} Build (MSVC)
runs-on: windows-2022
env:
VCPKG_ROOT: C:\vcpkg
VCPKG_TARGET_TRIPLET: ${{ matrix.arch }}-windows-static
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Checkout vcpkg
id: prepare
run: |
read REF TOOLSET < .github/scripts/vcpkg_ref
cd ${{ env.VCPKG_ROOT }}
# REF can be empty, a commit hash or a pull request
[ -n "$REF" ] && git fetch
git checkout $REF || git pull origin $REF
echo "vcpkg_key=${{ hashFiles( './install-dependencies.sh' ) }}-${REF}" >> $GITHUB_OUTPUT
echo "toolset=${TOOLSET}" >> $GITHUB_OUTPUT
shell: bash
- name: Restore vcpkg and its artifacts.
uses: actions/cache@v3
with:
path: ${{ env.VCPKG_ROOT }}\installed
key: |
${{ steps.prepare.outputs.vcpkg_key }}-${{ matrix.arch }}
- name: Installing dependencies
run: |
choco install innosetup
# Cache should have been populated by vcpkg-packages job
./install-dependencies.sh vcpkg --triplet=${{ env.VCPKG_TARGET_TRIPLET }}
shell: bash
- name: Configure MSVC development console
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.arch }}
# Check https://github.com/actions/runner-images/blob/main/images/win/toolsets/toolset-2022.json for installed versions
toolset: ${{ steps.prepare.outputs.toolset }}
- name: Compiler
env:
VCPKG_ROOT: C:\vcpkg
run: |
mkdir $env:GITHUB_WORKSPACE\build
cd $env:GITHUB_WORKSPACE\build
cmake.exe -G "NMake Makefiles" .. -DVCPKG_TARGET_TRIPLET=${{ env.VCPKG_TARGET_TRIPLET }} -DCMAKE_TOOLCHAIN_FILE="${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake" -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DOPTION_BUILD_WEBSITE_TOOLS=OFF -DOPTION_BUILD_TRANSLATIONS=ON -DOPTION_BUILD_TESTS=ON -DOPTION_ASAN=OFF -DOPTION_BUILD_CODECHECK=OFF -DOPTION_BUILD_WINSTATIC=ON -DOPTION_USE_GLBINDING=ON -DOPTION_FORCE_EMBEDDED_MINIZIP=ON
if ((Select-String -Quiet REVDETECT-BROKEN VERSION)) { exit 1 }
nmake
if ("${{ matrix.config }}" -Match "Release") {
strip -sv ./src/widelands.exe
}
- name: InnoSetup
run: |
cd $env:GITHUB_WORKSPACE
# Environment variables needed by our InnoSetup script
$env:PLATFORM = "${{ matrix.arch }}"
$env:CONFIGURATION = "${{ matrix.config }}"
$env:APPVEYOR_BUILD_FOLDER = $env:GITHUB_WORKSPACE
$env:APPVEYOR_BUILD_VERSION = "Widelands-${{ github.sha }}-${{ matrix.config }}-${{ matrix.arch }}"
ISCC.exe /o$env:GITHUB_WORKSPACE /fWidelands-${{ github.sha }}-msvc-${{ matrix.config }}-${{ matrix.arch }} $env:GITHUB_WORKSPACE\utils\windows\innosetup\Widelands.iss
- name: Uploading installer
uses: actions/upload-artifact@v3
with:
name: Widelands ${{ matrix.config }} ${{ matrix.arch }} Installer (MSVC)
path: ${{ github.workspace }}\Widelands-${{ github.sha }}-msvc-${{ matrix.config }}-${{ matrix.arch }}.exe
|