-
Notifications
You must be signed in to change notification settings - Fork 30
458 lines (410 loc) · 17.2 KB
/
build.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
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
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
name: Build pipeline
on:
workflow_dispatch:
inputs:
build_type_release:
description: 'Release CMake build type'
required: true
default: 'Release'
build_type_debug:
description: 'Debug CMake build type'
required: true
default: 'Debug'
build_use_cache:
description: 'Whether to use the vcpkg cache or not'
type: boolean
required: false
default: true
push:
branches:
- '*'
pull_request:
branches: [master, opengl]
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE_DEBUG: ${{ github.event.inputs.build_type_debug }}
BUILD_TYPE_RELEASE: ${{ github.event.inputs.build_type_release }}
USE_CACHE: ${{ github.event.inputs.build_use_cache == true || github.event.inputs.build_use_cache == null }}
RUN_TESTS: true
jobs:
windows-build:
runs-on: windows-latest
name: Build on Windows
# Run both builds in parallel and don't cancel if one fails
strategy:
matrix:
build-type: [Debug, Release]
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Restore swiftshader repository cache
uses: actions/cache/restore@v3
id: swiftshadercache-restore
with:
path: ${{ github.workspace }}/swiftshader/build/Windows
key: ${{ runner.os }}
- name: Checkout swiftshader repository
uses: actions/checkout@v4
if: steps.swiftshadercache-restore.outputs.cache-hit != 'true'
with:
repository: google/swiftshader
path: swiftshader
- name: Setup Vcpkg
uses: friendlyanon/setup-vcpkg@v1
# Committish: The commit sha of the vcpkg repo, same as in vcpkg.json
with:
committish: 821100d967e1737d96414a308e3f7cbe0d1abf18
cache: ${{ env.USE_CACHE }}
# This doesn't work when the Visual Studio C++ CLI was set up first (maybe needs a setup with 2019 version)
- name: Install Vulkan SDK
uses: humbletim/install-vulkan-sdk@v1.1.1
with:
version: 1.3.261.1
cache: true
- name: Delete MSVC tool version
shell: pwsh
# Add additional scripting steps here
run: |
cd 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build'
Get-ChildItem -Recurse *
Remove-Item * -Include 'Microsoft.VCToolsVersion.v143.default.props','Microsoft.VCToolsVersion.v143.default.txt' -Force | Out-Null
Get-ChildItem -Recurse *
- name: Setup Microsoft Visual C++ CLI
uses: ilammy/msvc-dev-cmd@v1
- name: Setup Ninja
uses: ashutoshvarma/setup-ninja@master
with:
# ninja version to download. Default: 1.10.0
version: 1.10.0
- name: Run scripts
shell: pwsh
# Add additional scripting steps here
run: |
cd ${{ github.workspace }}
${{ github.workspace }}/vcpkg/vcpkg install --clean-after-build --triplet=x64-windows
Remove-Item –path vcpkg_installed –recurse
- name: Build swiftshader
uses: ashutoshvarma/action-cmake-build@master
if: steps.swiftshadercache-restore.outputs.cache-hit != 'true'
with:
build-dir: ${{ github.workspace }}/swiftshader/build
source-dir: ${{ github.workspace }}/swiftshader
cc: "cl"
cxx: "cl"
configure-options: -G Ninja -DSWIFTSHADER_BUILD_TESTS=OFF -DSWIFTSHADER_ENABLE_ASTC=OFF
parallel: 16
build-type: MinSizeRel
- name: Save swiftshader respository cache
id: swiftshadercache-save
uses: actions/cache/save@v3
with:
path: ${{ github.workspace }}/swiftshader/build/Windows
key: ${{ steps.swiftshadercache-restore.outputs.cache-primary-key }}
- name: Build ${{ matrix.build-type }} configuration with CMake
uses: ashutoshvarma/action-cmake-build@master
with:
build-dir: ${{ github.workspace }}/build/${{ matrix.build-type }}
source-dir: ${{ github.workspace }}
cc: "cl"
cxx: "cl"
configure-options: -DCMAKE_TOOLCHAIN_FILE='${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake'
-DATLAS_DEMO=ON -DATLAS_TESTS=OFF -DATLAS_EDITOR=ON -G Ninja
parallel: 16
build-type: ${{ matrix.build-type }}
- name: Build ${{ matrix.build-type }} test configuration with CMake
uses: ashutoshvarma/action-cmake-build@master
if: ${{ env.RUN_TESTS }} == true
with:
build-dir: ${{ github.workspace }}/tests/${{ matrix.build-type }}
source-dir: ${{ github.workspace }}
cc: "cl"
cxx: "cl"
configure-options: -DCMAKE_TOOLCHAIN_FILE='${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake'
-DATLAS_TESTS=ON -DATLAS_BINDLESS=OFF -DATLAS_EDITOR=OFF -DATLAS_HEADLESS=ON -G Ninja
parallel: 16
build-type: ${{ matrix.build-type }}
- name: Run tests
shell: pwsh
if: ${{ env.RUN_TESTS }} == true
# Add additional scripting steps here
run: |
Copy-Item -Path "${{ github.workspace }}\swiftshader\build\Windows\*.*" -Destination "${{ github.workspace }}/bin/tests/${{ matrix.build-type }}"
Copy-Item -Path "${{ github.workspace }}\VULKAN_SDK\Bin\VkLayer_khronos_validation.*" -Destination "${{ github.workspace }}/bin/tests/${{ matrix.build-type }}"
cd ${{ github.workspace }}/bin/tests/${{ matrix.build-type }}
set VK_LOADER_LAYERS_ENABLE=*validation
set VK_ADD_LAYER_PATH=${{ github.workspace }}\VULKAN_SDK\Bin\
.\AtlasEngineTests.exe
env:
VK_ICD_FILENAMES: ${{ github.workspace }}/bin/${{ matrix.build-type }}/vk_swiftshader_icd.json
VK_ADD_LAYER_PATH: ${{ github.workspace }}\VULKAN_SDK\Bin\;${{ github.workspace }}/bin/tests/${{ matrix.build-type }}
VK_LOADER_LAYERS_ENABLE: '*validation'
- name: Upload artifact
if: ${{ matrix.build-type == 'Release' }}
uses: actions/upload-artifact@v4
with:
name: Atlas Engine Windows ${{ matrix.build-type }}
path: |
data
README.md
LICENSE.md
THIRDPARTY.md
${{ github.workspace }}/bin/**/AtlasEngineDemo.exe
${{ github.workspace }}/bin/**/AtlasEngineEditor.exe
${{ github.workspace }}/bin/**/*.dll
!${{ github.workspace }}/bin/tests
!**/CMakeFiles
compression-level: 9
linux-build:
runs-on: ubuntu-latest
name: Build on Linux
# Run both builds in parallel and don't cancel if one fails
strategy:
matrix:
build-type: [Debug, Release]
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Restore swiftshader repository cache
uses: actions/cache/restore@v3
id: swiftshadercache-restore
with:
path: ${{ github.workspace }}/swiftshader/build/Linux
key: ${{ runner.os }}
- name: Checkout swiftshader repository
uses: actions/checkout@v4
if: steps.swiftshadercache-restore.outputs.cache-hit != 'true'
with:
repository: google/swiftshader
path: swiftshader
- name: Setup Vcpkg
uses: friendlyanon/setup-vcpkg@v1
# Committish: The commit sha of the vcpkg repo, same as in vcpkg.json
with:
committish: 821100d967e1737d96414a308e3f7cbe0d1abf18
cache: ${{ env.USE_CACHE }}
- name: Setup Ninja
uses: ashutoshvarma/setup-ninja@master
with:
# ninja version to download. Default: 1.10.0
version: 1.10.0
- name: Install Vulkan SDK
uses: humbletim/install-vulkan-sdk@v1.1.1
with:
version: 1.3.261.1
cache: true
- name: Run scripts
shell: bash
# Add additional scripting steps here
run: |
sudo apt-get update
sudo apt-get install libgl1-mesa-dev
cd ${{ github.workspace }}
${{ github.workspace }}/vcpkg/vcpkg install --clean-after-build --triplet=x64-linux
rm -r vcpkg_installed
- name: Build swiftshader
uses: ashutoshvarma/action-cmake-build@master
if: steps.swiftshadercache-restore.outputs.cache-hit != 'true'
with:
build-dir: ${{ github.workspace }}/swiftshader/build
source-dir: ${{ github.workspace }}/swiftshader
cc: "gcc"
cxx: "g++"
configure-options: -G Ninja -DSWIFTSHADER_BUILD_TESTS=OFF -DSWIFTSHADER_ENABLE_ASTC=OFF
parallel: 16
build-type: MinSizeRel
- name: Save swiftshader respository cache
id: swiftshadercache-save
uses: actions/cache/save@v3
with:
path: ${{ github.workspace }}/swiftshader/build/Linux
key: ${{ steps.swiftshadercache-restore.outputs.cache-primary-key }}
# https://github.com/marketplace/actions/setup-ninja
- name: Build ${{ matrix.build-type }} configuration with CMake
uses: ashutoshvarma/action-cmake-build@master
with:
build-dir: ${{ github.workspace }}/build/${{ matrix.build-type }}
source-dir: ${{ github.workspace }}
cc: "gcc"
cxx: "g++"
configure-options: -DCMAKE_TOOLCHAIN_FILE='${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake'
-DATLAS_DEMO=ON -DATLAS_TESTS=OFF -DATLAS_EDITOR=ON -G Ninja
parallel: 16
build-type: ${{ matrix.build-type }}
- name: Build ${{ matrix.build-type }} test configuration with CMake
uses: ashutoshvarma/action-cmake-build@master
if: ${{ env.RUN_TESTS }} == true
with:
build-dir: ${{ github.workspace }}/tests/${{ matrix.build-type }}
source-dir: ${{ github.workspace }}
cc: "gcc"
cxx: "g++"
configure-options: -DCMAKE_TOOLCHAIN_FILE='${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake'
-DATLAS_TESTS=ON -DATLAS_BINDLESS=OFF -DATLAS_EDITOR=OFF -DATLAS_HEADLESS=ON -G Ninja
parallel: 16
build-type: ${{ matrix.build-type }}
- name: Run tests
shell: bash
if: ${{ env.RUN_TESTS }} == true
# Add additional scripting steps here
run: |
cd ${{ github.workspace }}/bin/tests/${{ matrix.build-type }}
./AtlasEngineTests
env:
VK_ICD_FILENAMES: ${{ github.workspace }}/swiftshader/build/Linux/vk_swiftshader_icd.json
VK_ADD_LAYER_PATH: ${{ github.workspace }}/VULKAN_SDK/lib/vulkan/layers/:${{ github.workspace }}/VULKAN_SDK/etc/vulkan/explicit_layer.d/
LD_LIBRARY_PATH: ${{ github.workspace }}/VULKAN_SDK/lib/
VK_LOADER_LAYERS_ENABLE: '*validation'
- name: Upload artifact
if: ${{ matrix.build-type == 'Release' }}
uses: actions/upload-artifact@v4
with:
name: Atlas Engine Linux ${{ matrix.build-type }}
path: |
data
README.md
LICENSE.md
THIRDPARTY.md
${{ github.workspace }}/bin/**/AtlasEngineDemo
${{ github.workspace }}/bin/**/AtlasEngineEditor
${{ github.workspace }}/bin/**/*.so*
!${{ github.workspace }}/bin/tests
!**/CMakeFiles
compression-level: 9
macos-build:
runs-on: macos-latest
name: Build on MacOS
# Run both builds in parallel and don't cancel if one fails
strategy:
matrix:
build-type: [Debug, Release]
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Restore swiftshader repository cache
uses: actions/cache/restore@v3
id: swiftshadercache-restore
with:
path: ${{ github.workspace }}/swiftshader/build/Darwin
key: ${{ runner.os }}
- name: Checkout swiftshader repository
uses: actions/checkout@v4
if: steps.swiftshadercache-restore.outputs.cache-hit != 'true'
with:
repository: google/swiftshader
path: swiftshader
- name: Setup Vcpkg
uses: friendlyanon/setup-vcpkg@v1
# Committish: The commit sha of the vcpkg repo, same as in vcpkg.json
with:
committish: 821100d967e1737d96414a308e3f7cbe0d1abf18
cache: ${{ env.USE_CACHE }}
- name: Setup Ninja
uses: ashutoshvarma/setup-ninja@master
with:
# ninja version to download. Default: 1.10.0
version: 1.10.0
- name: Install Vulkan SDK
uses: humbletim/install-vulkan-sdk@v1.1.1
with:
version: 1.3.261.1
cache: true
- name: Run scripts
shell: bash
# Add additional scripting steps here
run: |
cd ${{ github.workspace }}
brew install pkg-config
${{ github.workspace }}/vcpkg/vcpkg install --clean-after-build --triplet=arm64-osx
rm -r vcpkg_installed
- name: Build swiftshader
uses: ashutoshvarma/action-cmake-build@master
if: steps.swiftshadercache-restore.outputs.cache-hit != 'true'
with:
build-dir: ${{ github.workspace }}/swiftshader/build
source-dir: ${{ github.workspace }}/swiftshader
cc: "clang"
cxx: "clang++"
configure-options: -G Ninja -DSWIFTSHADER_BUILD_TESTS=OFF -DSWIFTSHADER_ENABLE_ASTC=OFF
parallel: 16
build-type: MinSizeRel
- name: Save swiftshader respository cache
id: swiftshadercache-save
uses: actions/cache/save@v3
with:
path: ${{ github.workspace }}/swiftshader/build/Darwin
key: ${{ steps.swiftshadercache-restore.outputs.cache-primary-key }}
# https://github.com/marketplace/actions/setup-ninja
- name: Build ${{ matrix.build-type }} configuration with CMake
uses: ashutoshvarma/action-cmake-build@master
with:
build-dir: ${{ github.workspace }}/build/${{ matrix.build-type }}
source-dir: ${{ github.workspace }}
cc: "clang"
cxx: "clang++"
configure-options: -DCMAKE_TOOLCHAIN_FILE='${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake'
-DATLAS_DEMO=ON -DATLAS_TESTS=OFF -DATLAS_EDITOR=ON -DATLAS_BUNDLE=ON -G Ninja
parallel: 16
build-type: ${{ matrix.build-type }}
- name: Build bundle
shell: bash
if: ${{ matrix.build-type == 'Release' }}
run: |
cd ${{ github.workspace }}/build/${{ matrix.build-type }}
cmake --install . --config ${{ matrix.build-type }}
{
echo '<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.files.downloads.read-write</key>
<true/>
<key>com.apple.security.files.documents.read-write</key>
<true/>
</dict>
</plist>'
} >engine.entitlements
codesign --force --deep -s - --entitlements engine.entitlements AtlasEngineEditor.app
codesign --force --deep -s - --entitlements engine.entitlements AtlasEngineDemo.app
tar -cvf AtlasEngineEditor.tar AtlasEngineEditor.app
tar -cvf AtlasEngineDemo.tar AtlasEngineDemo.app
cp AtlasEngineEditor.tar ${{ github.workspace }}/AtlasEngineEditor.tar
cp AtlasEngineDemo.tar ${{ github.workspace }}/AtlasEngineDemo.tar
- name: Build ${{ matrix.build-type }} test configuration with CMake
uses: ashutoshvarma/action-cmake-build@master
if: ${{ env.RUN_TESTS }} == true
with:
build-dir: ${{ github.workspace }}/tests/${{ matrix.build-type }}
source-dir: ${{ github.workspace }}
cc: "clang"
cxx: "clang++"
configure-options: -DCMAKE_TOOLCHAIN_FILE='${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake'
-DATLAS_TESTS=ON -DATLAS_BINDLESS=OFF -DATLAS_EDITOR=OFF -DATLAS_BUNDLE=ON -DATLAS_HEADLESS=ON -G Ninja
parallel: 16
build-type: ${{ matrix.build-type }}
- name: Run tests
shell: bash
if: ${{ env.RUN_TESTS }} == true
# Add additional scripting steps here
run: |
cd ${{ github.workspace }}/bin/tests/${{ matrix.build-type }}
./AtlasEngineTests
env:
VK_ICD_FILENAMES: ${{ github.workspace }}/swiftshader/build/Darwin/vk_swiftshader_icd.json
VK_ADD_LAYER_PATH: ${{ github.workspace }}/VULKAN_SDK/share/vulkan/explicit_layer.d/
DYLD_LIBRARY_PATH: ${{ github.workspace }}/VULKAN_SDK/lib/
VK_LOADER_LAYERS_ENABLE: '*validation'
- name: Upload artifact
uses: actions/upload-artifact@v4
if: ${{ matrix.build-type == 'Release' }}
with:
name: Atlas Engine MacOS ${{ matrix.build-type }}
path: |
README.md
LICENSE.md
THIRDPARTY.md
${{ github.workspace }}/AtlasEngineDemo.tar
${{ github.workspace }}/AtlasEngineEditor.tar
compression-level: 9