-
Notifications
You must be signed in to change notification settings - Fork 3
112 lines (97 loc) · 4.09 KB
/
windows-build-msvc.yml
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: Build (Windows MSVC)
on:
push:
paths-ignore:
- '**/README.md'
- '.github/workflows/macos-build.yml'
- '.github/workflows/ubuntu-build.yml'
- '.github/workflows/windows-build-msys2.yml'
- 'appimage-data/**'
- 'flatpak-data/**'
pull_request:
jobs:
build-msvc:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
build_type: ["Release"]
shared_libs_enabled: ["ON", "OFF"]
config:
- {
os: windows-latest,
cc: "cl",
cxx: "cl",
arch: "x86",
cmake-arch-args: "-T host=x86 -A Win32"
}
- {
os: windows-latest,
cc: "cl",
cxx: "cl",
arch: "x64",
cmake-arch-args: ""
}
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: Set reusable strings
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}\build" >> "$GITHUB_OUTPUT"
- name: Download SDL2 development libraries
run: |
mkdir ${{ steps.strings.outputs.build-output-dir }}\sdl-dev-libs
cd ${{ steps.strings.outputs.build-output-dir }}\sdl-dev-libs
Invoke-WebRequest https://github.com/libsdl-org/SDL/releases/download/release-2.30.1/SDL2-devel-2.30.1-VC.zip -OutFile SDL2.zip
Invoke-WebRequest https://github.com/libsdl-org/SDL_image/releases/download/release-2.8.2/SDL2_image-devel-2.8.2-VC.zip -OutFile SDL2_image.zip
Invoke-WebRequest https://github.com/libsdl-org/SDL_mixer/releases/download/release-2.8.0/SDL2_mixer-devel-2.8.0-VC.zip -OutFile SDL2_mixer.zip
7z x -y SDL2.zip
7z x -y SDL2_image.zip
7z x -y SDL2_mixer.zip
- name: Configure CMake
run: >
cmake
-S ${{ github.workspace }}
-B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DBUILD_SHARED_LIBS=${{ matrix.shared_libs_enabled }}
${{ matrix.config.cmake-arch-args }}
-DSDL2_PATH=${{ steps.strings.outputs.build-output-dir }}\sdl-dev-libs\SDL2-2.30.1
-DSDL2_IMAGE_PATH=${{ steps.strings.outputs.build-output-dir }}\sdl-dev-libs\SDL2_image-2.8.2
-DSDL2_MIXER_PATH=${{ steps.strings.outputs.build-output-dir }}\sdl-dev-libs\SDL2_mixer-2.8.0
- name: Build
run: >
cmake
--build ${{ steps.strings.outputs.build-output-dir }}
--config ${{ matrix.build_type }}
- name: Download SDL2 binaries
if: matrix.shared_libs_enabled == 'OFF'
run: |
mkdir SDL_deps
cd SDL_deps
Invoke-WebRequest https://github.com/libsdl-org/SDL/releases/download/release-2.30.1/SDL2-2.30.1-win32-${{ matrix.config.arch }}.zip -OutFile SDL2.zip
Invoke-WebRequest https://github.com/libsdl-org/SDL_image/releases/download/release-2.8.2/SDL2_image-2.8.2-win32-${{ matrix.config.arch }}.zip -OutFile SDL2_image.zip
Invoke-WebRequest https://github.com/libsdl-org/SDL_mixer/releases/download/release-2.8.0/SDL2_mixer-2.8.0-win32-${{ matrix.config.arch }}.zip -OutFile SDL2_mixer.zip
7z x -y SDL2.zip
7z x -y SDL2_image.zip
7z x -y SDL2_mixer.zip
copy SDL2.dll ${{ steps.strings.outputs.build-output-dir }}\bin\${{ matrix.build_type }}
copy SDL2_image.dll ${{ steps.strings.outputs.build-output-dir }}\bin\${{ matrix.build_type }}
copy SDL2_mixer.dll ${{ steps.strings.outputs.build-output-dir }}\bin\${{ matrix.build_type }}
- name: Fix for wrong assets location
if: matrix.shared_libs_enabled == 'OFF'
run: >
mv
${{ steps.strings.outputs.build-output-dir }}\bin\assets
${{ steps.strings.outputs.build-output-dir }}\bin\${{ matrix.build_type }}
- name: Upload Build Artifact
if: matrix.shared_libs_enabled == 'OFF'
uses: actions/upload-artifact@v4
with:
name: 'windows-msvc-${{ matrix.config.arch }}'
path: '${{ steps.strings.outputs.build-output-dir }}\bin\${{ matrix.build_type }}'
if-no-files-found: error
compression-level: 9