forked from KhronosGroup/Vulkan-Loader
-
Notifications
You must be signed in to change notification settings - Fork 0
442 lines (421 loc) · 16.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
# Copyright (c) 2021-2024 Valve Corporation
# Copyright (c) 2021-2024 LunarG, Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Author: Lenny Komow <[email protected]>
# Author: Charles Giessen <[email protected]>
name: CI Build
# https://docs.github.com/en/actions/using-jobs/using-concurrency
concurrency:
# github.head_ref is only defined on pull_request
# Fallback to the run ID, which is guaranteed to be both unique and defined for the run.
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
on:
push:
pull_request:
branches:
- main
permissions: read-all
jobs:
linux:
needs: codegen
runs-on: ${{matrix.os}}
strategy:
matrix:
compiler: [ {cc: gcc, cxx: g++}, {cc: clang, cxx: clang++} ]
config: [ Debug, Release ]
os: [ ubuntu-20.04, ubuntu-22.04 ]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Test CMake min
# NOTE: The main users who benefit from an older CMake version
# are linux users stuck on older LTS releases. It's idiomatic best
# practice to try and support them so they don't have to install
# the CMake tarball. Ideally the minimum we use matches what the default
# package provided by Ubuntu via APT.
if: ${{ matrix.os == 'ubuntu-20.04' }}
uses: lukka/get-cmake@latest
with:
cmakeVersion: 3.17.2
- run: sudo apt update
- run: sudo apt install --yes --no-install-recommends libwayland-dev libxrandr-dev
# This is to combat a bug when using 6.6 linux kernels with thread/address sanitizer
# https://github.com/google/sanitizers/issues/1716
- run: sudo sysctl vm.mmap_rnd_bits=28
- run: |
cmake -S. -B build \
-D CMAKE_BUILD_TYPE=${{ matrix.config }} \
-D BUILD_TESTS=ON \
-D UPDATE_DEPS=ON \
-D LOADER_ENABLE_ADDRESS_SANITIZER=ON \
-D BUILD_WERROR=ON \
-D CMAKE_CXX_COMPILER=${{ matrix.compiler.cxx }} \
-D CMAKE_C_COMPILER=${{ matrix.compiler.cc }}
- run: cmake --build build
- run: ctest --output-on-failure --test-dir build/
- run: cmake --install build --prefix /tmp
codegen:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: scripts/update_deps.py --dir ext --no-build
- run: scripts/generate_source.py --verify ext/Vulkan-Headers/registry/
linux-no-asm:
needs: codegen
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- run: sudo apt update
- run: sudo apt install --yes --no-install-recommends libwayland-dev libxrandr-dev
- run: |
cmake -S. -B build \
-D CMAKE_BUILD_TYPE=Release \
-D BUILD_TESTS=ON \
-D UPDATE_DEPS=ON \
-D BUILD_WERROR=ON \
-D USE_GAS=OFF \
-D CMAKE_C_COMPILER=clang \
-D CMAKE_CXX_COMPILER=clang++
- run: cmake --build build
- run: cmake --install build --prefix /tmp
- run: ctest --output-on-failure -E UnknownFunction --test-dir build/
linux-32:
needs: codegen
runs-on: ubuntu-22.04
strategy:
matrix:
config: [ Debug, Release ]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- uses: lukka/get-cmake@latest
with:
cmakeVersion: 3.17.2
- name: Enable 32 bit
run: sudo dpkg --add-architecture i386
- run: sudo apt-get update
- run: |
sudo apt install --yes --no-install-recommends \
gcc-multilib g++-multilib libc6:i386 libc6-dev-i386 libgcc-s1:i386 \
libwayland-dev:i386 libxrandr-dev:i386
- run: |
cmake -S. -B build \
-D CMAKE_BUILD_TYPE=${{matrix.config}} \
-D BUILD_TESTS=ON \
-D UPDATE_DEPS=ON \
-D BUILD_WERROR=ON \
-D SYSCONFDIR=/etc/not_vulkan \
-G Ninja
env:
CFLAGS: -m32
CXXFLAGS: -m32
LDFLAGS: -m32
ASFLAGS: --32
- run: cmake --build build
- run: cmake --install build --prefix /tmp
- run: ctest --output-on-failure
working-directory: build/
linux-32-no-asm:
needs: codegen
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- uses: lukka/get-cmake@latest
with:
cmakeVersion: 3.17.2
- name: Enable 32 bit
run: sudo dpkg --add-architecture i386
- run: sudo apt-get update
- run: |
sudo apt install --yes --no-install-recommends \
gcc-multilib g++-multilib libc6:i386 libc6-dev-i386 libgcc-s1:i386 \
libwayland-dev:i386 libxrandr-dev:i386
- run: |
cmake -S. -B build \
-D CMAKE_BUILD_TYPE=Release \
-D BUILD_TESTS=ON \
-D UPDATE_DEPS=ON \
-D BUILD_WERROR=ON \
-D USE_GAS=OFF \
-G Ninja
env:
CFLAGS: -m32
CXXFLAGS: -m32
LDFLAGS: -m32
ASFLAGS: --32
- run: cmake --build build
- run: ctest --output-on-failure -E UnknownFunction
working-directory: build/
windows_vs:
# windows is 2x expensive to run on GitHub machines, so only run if we know something else simple passed as well
needs: linux-no-asm
runs-on: windows-latest
strategy:
matrix:
arch: [ Win32, x64 ]
config: [ Debug, Release ]
steps:
- uses: actions/checkout@v4
- run: |
cmake -S. -B build `
-D BUILD_TESTS=ON `
-D UPDATE_DEPS=ON `
-D CMAKE_BUILD_TYPE=${{matrix.config}} `
-A ${{ matrix.arch }} `
-D BUILD_WERROR=ON
- run: cmake --build build/ --config ${{matrix.config}}
- run: cmake --install build --prefix build/install --config ${{matrix.config}}
- run: ctest --output-on-failure -C ${{matrix.config}} --test-dir build/
windows_vs-no-asm:
# windows is 2x expensive to run on GitHub machines, so only run if we know something else simple passed as well
needs: linux-no-asm
runs-on: windows-latest
strategy:
matrix:
arch: [ Win32, x64 ]
steps:
- uses: actions/checkout@v4
- run: |
cmake -S. -B build `
-D BUILD_TESTS=ON `
-D UPDATE_DEPS=ON `
-D USE_MASM=OFF `
-D CMAKE_BUILD_TYPE=Release `
-A ${{ matrix.arch }} `
-D BUILD_WERROR=ON
- run: cmake --build build/ --config Release
- run: ctest --output-on-failure -C Release -E UnknownFunction --test-dir build/
# Test both clang and clang-cl (Chromium project uses clang-cl)
windows_clang:
# windows is 2x expensive to run on GitHub machines, so only run if we know something else simple passed as well
needs: linux-no-asm
runs-on: windows-2022
strategy:
matrix:
compiler: [ clang, clang-cl ]
config: [ Debug, Release ]
steps:
- uses: actions/checkout@v4
- uses: ilammy/msvc-dev-cmd@v1
- run: |
cmake -S. -B build `
-D CMAKE_C_COMPILER=${{matrix.compiler}} `
-D CMAKE_CXX_COMPILER=${{matrix.compiler}} `
-D UPDATE_DEPS=ON `
-D CMAKE_BUILD_TYPE=${{matrix.config}} `
-D BUILD_WERROR=ON `
-D BUILD_TESTS=ON `
-G Ninja
- run: cmake --build build/
- run: ctest --output-on-failure --test-dir build/
- run: cmake --install build --prefix build/install
mac:
# Mac is 10x expensive to run on GitHub machines, so only run if we know something else passed as well
needs: windows_clang
runs-on: macos-13
strategy:
matrix:
config: [ Debug, Release ]
static_build: [ APPLE_STATIC_LOADER=ON, APPLE_STATIC_LOADER=OFF ]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- uses: lukka/get-cmake@latest
- run: |
cmake -S. -B build \
-D CMAKE_BUILD_TYPE=${{matrix.config}} \
-D ${{matrix.static_build}} \
-D BUILD_TESTS=ON \
-D UPDATE_DEPS=ON \
-D BUILD_WERROR=ON \
-D LOADER_ENABLE_ADDRESS_SANITIZER=ON \
-G Ninja
env:
# Prevents regression of KhronosGroup/Vulkan-Loader/issues/1332
LDFLAGS: -Wl,-fatal_warnings
- run: cmake --build build
- run: cmake --install build --prefix /tmp
- run: ctest --output-on-failure --test-dir build/
apple-cross-compile:
# Mac is 10x expensive to run on GitHub machines, so only run if we know something else passed as well
needs: windows_clang
name: ${{ matrix.CMAKE_SYSTEM_NAME }}
runs-on: macos-13
strategy:
matrix:
CMAKE_SYSTEM_NAME: [ iOS, tvOS ]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- uses: lukka/get-cmake@latest
- run: |
cmake -S . -B build \
-D CMAKE_SYSTEM_NAME=${{ matrix.CMAKE_SYSTEM_NAME }} \
"-D CMAKE_OSX_ARCHITECTURES=arm64;x86_64" \
-D CMAKE_BUILD_TYPE=Debug \
-D UPDATE_DEPS=ON \
-D BUILD_WERROR=ON \
-G Ninja
env:
LDFLAGS: -Wl,-fatal_warnings
- run: cmake --build build
- run: cmake --install build --prefix /tmp
- name: Verify Universal Binary
run: |
vtool -show-build /tmp/lib/libvulkan.dylib | grep 'architecture x86_64'
vtool -show-build /tmp/lib/libvulkan.dylib | grep 'architecture arm64'
# Building a universal binary disables assembly automatically
# Furthermore the Vulkan SDK ships universal binaries
mac-univeral:
# Mac is 10x expensive to run on GitHub machines, so only run if we know something else passed as well
needs: windows_clang
name: "Universal Binary Testing (STATIC ${{ matrix.static }}) w/ ${{ matrix.generator }}"
runs-on: macos-latest
strategy:
matrix:
static: [ 'ON', 'OFF' ]
generator: [ Ninja, Xcode ]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- uses: lukka/get-cmake@latest
- run: |
cmake -S. -B build \
-D CMAKE_BUILD_TYPE=Release \
-D APPLE_STATIC_LOADER=${{matrix.static}} \
"-D CMAKE_OSX_ARCHITECTURES=arm64;x86_64" \
-D BUILD_TESTS=ON \
-D UPDATE_DEPS=ON \
-D BUILD_WERROR=ON \
-G ${{ matrix.generator }}
env:
LDFLAGS: -Wl,-fatal_warnings
- run: cmake --build build --config Release
- run: ctest --output-on-failure --build-config Release -E UnknownFunction --test-dir build/
- run: cmake --install build --config Release --prefix /tmp
- name: Verify Universal Binary
if: ${{ matrix.static == 'OFF' }}
run: |
vtool -show-build /tmp/lib/libvulkan.dylib | grep 'architecture x86_64'
vtool -show-build /tmp/lib/libvulkan.dylib | grep 'architecture arm64'
chromium:
needs: codegen
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: scripts/gn/gn.py
mingw:
# windows is 2x expensive to run on GitHub machines, so only run if we know something else simple passed as well
needs: linux-no-asm
runs-on: windows-2022
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- uses: lukka/get-cmake@latest
- name: Setup uasm
run: |
C:/msys64/usr/bin/pacman -Sy --noconfirm --needed mingw-w64-x86_64-uasm
printf '%s\n' 'C:/msys64/mingw64/bin' >> $GITHUB_PATH
- name: UASM Check
run: uasm -?
- run: |
cmake -S. -B build \
-D UPDATE_DEPS=ON \
-D CMAKE_BUILD_TYPE=Release \
-D BUILD_WERROR=ON \
-G Ninja
- run: cmake --build build
- run: cmake --install build --prefix /tmp
mingw-use-gas:
# windows is 2x expensive to run on GitHub machines, so only run if we know something else simple passed as well
needs: linux-no-asm
runs-on: windows-2022
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- uses: lukka/get-cmake@latest
- run: |
cmake -S. -B build \
-D UPDATE_DEPS=ON \
-D CMAKE_BUILD_TYPE=Release \
-D BUILD_WERROR=ON \
-D USE_GAS=ON \
-G Ninja
- run: cmake --build build
- run: cmake --install build --prefix /tmp
mingw-no-asm:
# windows is 2x expensive to run on GitHub machines, so only run if we know something else simple passed as well
needs: linux-no-asm
runs-on: windows-2022
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- uses: lukka/get-cmake@latest
# Make sure this doesn't fail even without explicitly setting '-D USE_MASM=OFF' and without uasm
- run: |
cmake -S. -B build \
-D UPDATE_DEPS=ON \
-D CMAKE_BUILD_TYPE=Release \
-D BUILD_WERROR=ON \
-G Ninja
- run: cmake --build build
- run: cmake --install build --prefix /tmp
mingw-no-asm-explicit:
# windows is 2x expensive to run on GitHub machines, so only run if we know something else simple passed as well
needs: linux-no-asm
runs-on: windows-2022
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- uses: lukka/get-cmake@latest
- run: |
cmake -S. -B build \
-D UPDATE_DEPS=ON \
-D CMAKE_BUILD_TYPE=Release \
-D BUILD_WERROR=ON \
-D USE_MASM=OFF \
-G Ninja
- run: cmake --build build
- run: cmake --install build --prefix /tmp