-
Notifications
You must be signed in to change notification settings - Fork 57
293 lines (290 loc) · 11.7 KB
/
Copy pathcmake.yml
File metadata and controls
293 lines (290 loc) · 11.7 KB
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
jobs:
build-linux:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v5
with:
submodules: recursive
- name: Cache ccache
uses: actions/cache@v5
with:
path: ${{ github.workspace }}/.ccache/linux
key: linux-ccache-${{ runner.os }}-${{ env.BUILD_TYPE }}-${{ hashFiles('**/CMakeLists.txt') }}
restore-keys: linux-ccache-${{ runner.os }}-${{ env.BUILD_TYPE }}-
- name: Install dependencies
run: |
sudo apt-get update -y -qq
sudo apt-get install -y -qq libsdl2-dev ninja-build ccache
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
env:
CCACHE_DIR: ${{ github.workspace }}/.ccache/linux
CCACHE_BASEDIR: ${{ github.workspace }}
run: cmake -S . -B ${{github.workspace}}/build -GNinja -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DDPPC_68K_DEBUGGER=ON -DDPPC_BUILD_PPC_TESTS=ON -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel
- name: ccache stats
run: ccache --show-stats || true
- name: Test
working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{env.BUILD_TYPE}} --output-on-failure
- name: Upload logs on failure
if: failure()
uses: actions/upload-artifact@v6
with:
name: logs-${{ github.job }}
path: |
${{ github.workspace }}/build/Testing/Temporary/LastTest.log
${{ github.workspace }}/build/CMakeFiles/CMakeOutput.log
${{ github.workspace }}/build/CMakeFiles/CMakeError.log
if-no-files-found: ignore
retention-days: ${{ github.event_name == 'pull_request' && 7 || 30 }}
- name: Upload artifact
if: always()
uses: actions/upload-artifact@v6
with:
name: DingusPPC-LINUX
path: ${{github.workspace}}/build/bin
retention-days: ${{ github.event_name == 'pull_request' && 7 || 30 }}
build-macos:
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
- runner: macos-latest
arch: arm64
brew_prefix: /opt/homebrew
- runner: macos-15-intel
arch: x86_64
brew_prefix: /usr/local
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v5
with:
submodules: recursive
- name: Cache ccache
uses: actions/cache@v5
with:
path: ${{ github.workspace }}/.ccache/${{ matrix.arch }}
key: macos-${{ matrix.runner }}-${{ matrix.arch }}-ccache-${{ env.BUILD_TYPE }}-${{ hashFiles('**/CMakeLists.txt') }}
restore-keys: macos-${{ matrix.runner }}-${{ matrix.arch }}-ccache-${{ env.BUILD_TYPE }}-
- name: Install dependencies
run: |
export HOMEBREW_NO_AUTO_UPDATE=1
export HOMEBREW_NO_INSTALL_CLEANUP=1
brew install sdl2 ccache ninja
- name: Configure CMake
env:
CCACHE_DIR: ${{ github.workspace }}/.ccache/${{ matrix.arch }}
CCACHE_BASEDIR: ${{ github.workspace }}
run: |
export PATH="${{ matrix.brew_prefix }}/opt/ccache/libexec:$PATH"
cmake -S . -B ${{github.workspace}}/build -GNinja -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DDPPC_68K_DEBUGGER=ON -DDPPC_BUILD_PPC_TESTS=ON -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }}
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel
- name: ccache stats
run: ccache --show-stats || true
- name: Test
working-directory: ${{github.workspace}}/build
run: ctest -C ${{env.BUILD_TYPE}} --output-on-failure
- name: Upload logs on failure
if: failure()
uses: actions/upload-artifact@v6
with:
name: logs-${{ github.job }}-${{ matrix.arch }}
path: |
${{ github.workspace }}/build/Testing/Temporary/LastTest.log
${{ github.workspace }}/build/CMakeFiles/CMakeOutput.log
${{ github.workspace }}/build/CMakeFiles/CMakeError.log
if-no-files-found: ignore
retention-days: ${{ github.event_name == 'pull_request' && 7 || 30 }}
- name: Upload artifact
if: always()
uses: actions/upload-artifact@v6
with:
name: DingusPPC-macOS-${{ matrix.arch }}
path: ${{github.workspace}}/build/bin
retention-days: ${{ github.event_name == 'pull_request' && 7 || 30 }}
build-windows-msys2:
runs-on: windows-latest
timeout-minutes: 45
env:
MSYSTEM: MINGW64
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
submodules: recursive
- name: Cache ccache
uses: actions/cache@v5
with:
path: ${{ github.workspace }}/.ccache/msys
key: windows-msys-ccache-${{ env.BUILD_TYPE }}-${{ hashFiles('**/CMakeLists.txt') }}
restore-keys: windows-msys-ccache-${{ env.BUILD_TYPE }}-
- name: Setup MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: >-
cmake
ninja
git
mingw-w64-x86_64-cmake
mingw-w64-x86_64-gcc
mingw-w64-x86_64-binutils
mingw-w64-x86_64-ninja
mingw-w64-x86_64-pkgconf
mingw-w64-x86_64-SDL2
mingw-w64-x86_64-ccache
- name: Build
shell: msys2 {0}
run: |
echo "Running build at $(date -u +'%Y-%m-%dT%H:%M:%SZ')"
export CHERE_INVOKING=yes
export MSYS=winsymlinks:native
export CCACHE_BASEDIR="${GITHUB_WORKSPACE}"
export CCACHE_DIR="${GITHUB_WORKSPACE}/.ccache/msys"
export CCACHE_DEPEND=1
ccache --zero-stats || true
cmake -S . -B build -GNinja -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DDPPC_68K_DEBUGGER=ON -DDPPC_BUILD_PPC_TESTS=ON -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
cmake --build build --config ${{ env.BUILD_TYPE }} --parallel
ccache --show-stats || true
echo "Finished build at $(date -u +'%Y-%m-%dT%H:%M:%SZ')"
- name: Test
shell: msys2 {0}
run: |
cd build
ctest --output-on-failure --parallel
- name: Upload logs on failure
if: failure()
uses: actions/upload-artifact@v6
with:
name: logs-${{ github.job }}
path: |
${{ github.workspace }}/build/Testing/Temporary/LastTest.log
${{ github.workspace }}/build/CMakeFiles/CMakeOutput.log
${{ github.workspace }}/build/CMakeFiles/CMakeError.log
if-no-files-found: ignore
retention-days: ${{ github.event_name == 'pull_request' && 7 || 30 }}
- name: Upload artifact
if: always()
uses: actions/upload-artifact@v6
with:
name: DingusPPC-MSYS
path: ${{github.workspace}}/build/bin
retention-days: ${{ github.event_name == 'pull_request' && 7 || 30 }}
build-windows-vsbuild:
runs-on: windows-latest
timeout-minutes: 45
env:
VCPKG_FEATURE_FLAGS: binarycaching
strategy:
fail-fast: false
matrix:
include:
- name: clang
generator: Ninja
cmake_args: -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl
ccache_args: -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
upload_suffix: CLANG
- name: msvc
generator: Ninja
cmake_args: ""
ccache_args: -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
upload_suffix: MSVC
- name: msbuild
generator: Ninja
cmake_args: -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl
ccache_args: -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
upload_suffix: MSBUILD
steps:
- uses: actions/checkout@v5
with:
submodules: recursive
# Configures MSVC/Clang environment natively for all subsequent steps
- name: Setup MSVC Developer Command Prompt
uses: TheMrMilchmann/setup-msvc-dev@v4
with:
arch: x64
- name: Setup msbuild
uses: microsoft/setup-msbuild@v3
- name: Install vcpkg packages
shell: cmd
run: '"%VCPKG_INSTALLATION_ROOT%\vcpkg.exe" install --triplet x64-windows'
- name: Install Ninja
if: matrix.generator == 'Ninja'
run: choco install ninja -y
- name: Cache ccache
if: matrix.generator == 'Ninja'
uses: actions/cache@v5
with:
path: ${{ github.workspace }}/.ccache/vsbuild-${{ matrix.name }}
key: vsbuild-${{ matrix.name }}-ccache-${{ env.BUILD_TYPE }}-${{ hashFiles('**/CMakeLists.txt') }}
restore-keys: vsbuild-${{ matrix.name }}-ccache-${{ env.BUILD_TYPE }}-
- name: Install ccache
if: matrix.generator == 'Ninja'
run: choco install ccache -y
- name: Configure & Build
shell: cmd
env:
CCACHE_DIR: ${{ github.workspace }}/.ccache/vsbuild-${{ matrix.name }}
CCACHE_BASEDIR: ${{ github.workspace }}
run: |
mkdir build
call "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
cd build
cmake -S .. -B . -G "${{ matrix.generator }}" -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DDPPC_68K_DEBUGGER=ON -DDPPC_BUILD_PPC_TESTS=ON ${{ matrix.ccache_args }} -DCMAKE_TOOLCHAIN_FILE=%VCPKG_INSTALLATION_ROOT%\scripts\buildsystems\vcpkg.cmake
cmake --build . --config ${{ env.BUILD_TYPE }} --parallel
cd ..
- name: ccache stats
if: matrix.generator == 'Ninja'
shell: cmd
run: |
ccache --show-stats
if %errorlevel% neq 0 echo ccache stats unavailable
- name: Test
working-directory: ${{github.workspace}}/build
shell: cmd
run: ctest -C ${{env.BUILD_TYPE}} --output-on-failure
- name: Upload logs on failure
if: failure()
uses: actions/upload-artifact@v6
with:
name: logs-${{ github.job }}-${{ matrix.name }}
path: |
${{ github.workspace }}/build/Testing/Temporary/LastTest.log
${{ github.workspace }}/build/CMakeFiles/CMakeOutput.log
${{ github.workspace }}/build/CMakeFiles/CMakeError.log
if-no-files-found: ignore
retention-days: ${{ github.event_name == 'pull_request' && 7 || 30 }}
- name: Upload artifact
if: always()
uses: actions/upload-artifact@v6
with:
name: DingusPPC-${{ matrix.upload_suffix }}
path: ${{github.workspace}}/build/bin
retention-days: ${{ github.event_name == 'pull_request' && 7 || 30 }}