Repository navigation
411 lines (369 loc) · 16.5 KB
/
Copy pathc-cpp.yml
File metadata and controls
411 lines (369 loc) · 16.5 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
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
name: C/C++ CI
on:
push:
branches: [ "**" ]
pull_request:
branches: [ "**" ]
# https://github.com/git-lfs/git-lfs/issues/5749
env:
GIT_CLONE_PROTECTION_ACTIVE: false
permissions:
contents: read
jobs:
build:
name: "Android (Ubuntu)"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
- name: Free up disk space
run: |
df -h
sudo rm -rf /usr/share/dotnet /opt/ghc
sudo docker system prune --all --force --volumes
sudo apt-get clean -y
df -h
- name: Set up NDK
uses: nttld/setup-ndk@v1
with:
ndk-version: r26b
- name: Set up JDK
uses: actions/setup-java@v5
with:
java-version: 21
distribution: 'oracle'
- name: Install CMake 4.0.0
shell: bash
run: |
sudo apt remove cmake -y || true
sudo pip install --break-system-packages cmake==4.0.0
cmake --version
- name: Point AGP at the pip-installed CMake
shell: bash
run: |
CMAKE_DATA_DIR=$(python3 -c 'import cmake, os; print(os.path.dirname(cmake.__file__) + "/data")')
echo "cmake.dir=$CMAKE_DATA_DIR" >> build/android/local.properties
cat build/android/local.properties
- name: Assemble APK debug
run: |
cd build/android
chmod +x ./gradlew
./gradlew assembleDebug
cmake-build:
strategy:
fail-fast: false
matrix:
config:
- {
name: "Windows - MSVC 2022",
os: windows-latest,
build_type: "Debug",
cc: "cl",
cxx: "cl",
generators: "Visual Studio 17 2022",
cmake_args: "-DIGL_WITH_TRACY=ON -DIGL_WITH_TESTS=ON"
}
- {
name: "Windows - MSVC 2022 (no OpenGL)",
os: windows-latest,
build_type: "Debug",
cc: "cl",
cxx: "cl",
generators: "Visual Studio 17 2022",
cmake_args: "-DIGL_WITH_TRACY=ON -DIGL_WITH_TESTS=ON -DIGL_WITH_OPENGL=OFF"
}
- {
name: "Ubuntu - Clang",
os: ubuntu-latest,
build_type: "Debug",
cc: "clang",
cxx: "clang++",
generators: "Unix Makefiles",
cmake_args: "-DIGL_WITH_TRACY=ON"
}
- {
name: "Ubuntu - GCC",
os: ubuntu-latest,
build_type: "Debug",
cc: "gcc",
cxx: "g++",
generators: "Unix Makefiles",
# TODO: Fix killing GCC process on Github CI when IGL_WITH_SHELL is ON.
cmake_args: "-DIGL_WITH_TRACY=ON -DIGL_WITH_SHELL=OFF"
}
# https://github.com/emscripten-core/emscripten/pull/20802#issuecomment-1858114093
# - {
# name: "Emscripten (Ubuntu)",
# os: ubuntu-latest,
# build_type: "Debug",
# cc: "emcc",
# cxx: "em++",
# generators: "Ninja",
# }
# - {
# name: "macOS - Clang (Xcode)",
# os: macos-latest,
# build_type: "Debug",
# cc: "clang",
# cxx: "clang++",
# generators: "Xcode",
# cmake_args: "-DIGL_WITH_VULKAN=OFF"
# }
# - {
# name: "macOS - Clang (Unix Makefiles)",
# os: macos-latest,
# build_type: "Debug",
# cc: "clang",
# cxx: "clang++",
# generators: "Unix Makefiles",
# cmake_args: "-DIGL_WITH_VULKAN=OFF"
# }
runs-on: ${{ matrix.config.os }}
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
- if: startsWith(matrix.config.os, 'windows')
run: |
git config --system core.longpaths true
- if: startsWith(matrix.config.name, 'Emscripten')
run: |
sudo sed -i 's/azure\.//' /etc/apt/sources.list
sudo apt-get update
sudo apt-get install -y clang emscripten xorg-dev libxinerama-dev libxcursor-dev libgles2-mesa-dev libegl1-mesa-dev libglfw3-dev libglew-dev libstdc++-12-dev
- if: startsWith(matrix.config.name, 'Ubuntu' )
run: |
sudo sed -i 's/azure\.//' /etc/apt/sources.list
sudo apt-get update
sudo apt-get install -y clang xorg-dev libxinerama-dev libxcursor-dev libgles2-mesa-dev libegl1-mesa-dev libglfw3-dev libglew-dev libstdc++-12-dev
- name: Prepare Vulkan SDK
uses: jakoch/install-vulkan-sdk-action@v1.2.5
with:
vulkan_version: 1.4.309.0
install_runtime: true
cache: true
stripdown: true
- name: Get the number of CPU cores
uses: SimenB/github-actions-cpu-cores@v2
- name: Build
shell: bash
env:
CC: ${{ matrix.config.cc }}
CXX: ${{ matrix.config.cxx }}
if: ${{ matrix.config.name != 'Emscripten (Ubuntu)' }}
run: |
cmake ${{ env.CMAKE_GENERATOR }} -S "${{ github.workspace }}" -B build ${{ matrix.config.cmake_args }}
cd build
cmake --build . --parallel ${{ steps.cpu-cores.outputs.count }}
- name: Build Emscripten
shell: bash
env:
CC: ${{ matrix.config.cc }}
CXX: ${{ matrix.config.cxx }}
if: ${{ matrix.config.name == 'Emscripten (Ubuntu)' }}
run: |
emcmake cmake ${{ env.CMAKE_GENERATOR }} -S "${{ github.workspace }}" -B build ${{ matrix.config.cmake_args }}
cd build
cmake --build . --parallel ${{ steps.cpu-cores.outputs.count }}
cmake-test-ubuntu:
strategy:
fail-fast: false
matrix:
config:
- {
name: "Ubuntu - Clang",
os: ubuntu-latest,
build_type: "Debug",
cc: "clang-16",
cxx: "clang++-16",
generators: "Unix Makefiles",
}
runs-on: ${{ matrix.config.os }}
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
- name: Install Ubuntu packages
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y gcc-13 clang-16 xorg-dev libxinerama-dev libxcursor-dev libgles2-mesa-dev libegl1-mesa-dev libglfw3-dev libglew-dev libstdc++-12-dev extra-cmake-modules libxkbcommon-x11-dev wayland-protocols ninja-build
sudo apt-get install -y mesa-vulkan-drivers libvulkan1 vulkan-tools vulkan-validationlayers
cmake --version
vulkaninfo
- name: Install Vulkan SDK
uses: jakoch/install-vulkan-sdk-action@v1.2.5
with:
vulkan_version: 1.4.309.0
install_runtime: true
cache: true
stripdown: true
- name: Get the number of CPU cores
uses: SimenB/github-actions-cpu-cores@v2
- name: Check disk space
run: df -h
- name: Build
shell: bash
env:
CC: ${{ matrix.config.cc }}
CXX: ${{ matrix.config.cxx }}
run: |
cmake ${{ env.CMAKE_GENERATOR }} -S "${{ github.workspace }}" -B build ${{ matrix.config.cmake_args }} -DCMAKE_BUILD_TYPE=Debug
cd build
cmake --build . --target Tiny --parallel ${{ steps.cpu-cores.outputs.count }}
cmake --build . --target BasicFramebufferSession_vulkan --parallel ${{ steps.cpu-cores.outputs.count }}
cmake --build . --target BindGroupSession_vulkan --parallel ${{ steps.cpu-cores.outputs.count }}
cmake --build . --target ColorSession_vulkan --parallel ${{ steps.cpu-cores.outputs.count }}
cmake --build . --target DrawInstancedSession_vulkan --parallel ${{ steps.cpu-cores.outputs.count }}
cmake --build . --target GPUStressSession_vulkan --parallel ${{ steps.cpu-cores.outputs.count }}
cmake --build . --target HelloWorldSession_vulkan --parallel ${{ steps.cpu-cores.outputs.count }}
cmake --build . --target ImguiSession_vulkan --parallel ${{ steps.cpu-cores.outputs.count }}
cmake --build . --target MRTSession_vulkan --parallel ${{ steps.cpu-cores.outputs.count }}
cmake --build . --target SubpassDeferredSession_vulkan --parallel ${{ steps.cpu-cores.outputs.count }}
cmake --build . --target Textured3DCubeSession_vulkan --parallel ${{ steps.cpu-cores.outputs.count }}
cmake --build . --target TextureViewSession_vulkan --parallel ${{ steps.cpu-cores.outputs.count }}
cmake --build . --target TinyMeshBindGroupSession_vulkan --parallel ${{ steps.cpu-cores.outputs.count }}
cmake --build . --target TinyMeshSession_vulkan --parallel ${{ steps.cpu-cores.outputs.count }}
cmake --build . --target TQSession_vulkan --parallel ${{ steps.cpu-cores.outputs.count }}
cmake --build . --target YUVColorSession_vulkan --parallel ${{ steps.cpu-cores.outputs.count }}
- name: Run tests (shell)
run: |
ls build/shell
./build/shell/BasicFramebufferSession_vulkan --headless --viewport-size 1600x900 --screenshot-file BasicFramebufferSession.png
./build/shell/BindGroupSession_vulkan --headless --viewport-size 1600x900 --screenshot-file BindGroupSession.png
./build/shell/ColorSession_vulkan --headless --viewport-size 1600x900 --screenshot-file ColorSession.png
./build/shell/DrawInstancedSession_vulkan --headless --viewport-size 1600x900 --screenshot-file DrawInstancedSession.png
./build/shell/GPUStressSession_vulkan --headless --viewport-size 1600x900 --screenshot-file GPUStressSession.png
./build/shell/HelloWorldSession_vulkan --headless --viewport-size 1600x900 --screenshot-file HelloWorldSession.png
./build/shell/ImguiSession_vulkan --headless --viewport-size 1600x900 --screenshot-file ImguiSession.png
./build/shell/MRTSession_vulkan --headless --viewport-size 1600x900 --screenshot-file MRTSession.png
./build/shell/SubpassDeferredSession_vulkan --headless --viewport-size 1600x900 --screenshot-file SubpassDeferredSession.png
./build/shell/Textured3DCubeSession_vulkan --headless --viewport-size 1600x900 --screenshot-file Textured3DCubeSession.png
./build/shell/TextureViewSession_vulkan --headless --viewport-size 1600x900 --screenshot-file TextureViewSession.png
./build/shell/TinyMeshBindGroupSession_vulkan --headless --viewport-size 1600x900 --screenshot-file TinyMeshBindGroupSession.png
./build/shell/TinyMeshSession_vulkan --headless --viewport-size 1600x900 --screenshot-file TinyMeshSession.png
./build/shell/TQSession_vulkan --headless --viewport-size 1600x900 --screenshot-file TQSession.png
./build/shell/YUVColorSession_vulkan --headless --viewport-size 1600x900 --screenshot-file YUVColorSession.png
- name: Run tests (desktop)
run: |
ls build/samples/desktop
#./build/samples/desktop/Tiny --headless
- name: Upload artifacts
uses: actions/upload-artifact@v6
with:
name: Screenshots
path: |
BasicFramebufferSession.png
BindGroupSession.png
ColorSession.png
DrawInstancedSession.png
GPUStressSession.png
HelloWorldSession.png
ImguiSession.png
MRTSession.png
SubpassDeferredSession.png
Textured3DCubeSession.png
TextureViewSession.png
TinyMeshBindGroupSession.png
TinyMeshSession.png
TQSession.png
YUVColorSession.png
if-no-files-found: error
retention-days: 5
overwrite: true
# WebGPU backend on Dawn (Vulkan backend on lavapipe). Dawn is built once per revision and cached.
cmake-webgpu-ubuntu:
name: "WebGPU - Dawn on lavapipe (Ubuntu)"
runs-on: ubuntu-latest
env:
DAWN_REVISION: 42d0e90fe3552a2a8e95ca8e506bc19bbda12729
CC: clang
CXX: clang++
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
- name: Install Ubuntu packages
run: |
sudo apt-get update
sudo apt-get install -y clang ninja-build xorg-dev libxinerama-dev libxcursor-dev libx11-xcb-dev libgles2-mesa-dev libegl1-mesa-dev libglfw3-dev libglew-dev libstdc++-12-dev mesa-vulkan-drivers libvulkan-dev libvulkan1 vulkan-tools
# The lavapipe ICD file name differs between Mesa packages (e.g. with or without an arch suffix), so look it up.
- name: Locate lavapipe ICD
run: |
LVP_ICD=$(dpkg -L mesa-vulkan-drivers | grep -E '/lvp_icd[^/]*\.json$' | head -n 1)
if [ -z "$LVP_ICD" ]; then
echo "lavapipe ICD not found in mesa-vulkan-drivers"
ls -l /usr/share/vulkan/icd.d/ || true
exit 1
fi
echo "Using lavapipe ICD: $LVP_ICD"
echo "VK_ICD_FILENAMES=$LVP_ICD" >> "$GITHUB_ENV"
VK_ICD_FILENAMES="$LVP_ICD" vulkaninfo --summary
- name: Cache Dawn
id: cache-dawn
uses: actions/cache@v4
with:
path: ~/dawn-install
key: dawn-${{ env.DAWN_REVISION }}-ubuntu-clang-vulkan
- name: Build Dawn
if: steps.cache-dawn.outputs.cache-hit != 'true'
run: |
mkdir dawn && cd dawn
git init -q
git fetch -q --depth 1 https://dawn.googlesource.com/dawn "$DAWN_REVISION"
git checkout -q FETCH_HEAD
cmake -G Ninja -S . -B build -DCMAKE_BUILD_TYPE=Release -DDAWN_FETCH_DEPENDENCIES=ON \
-DDAWN_ENABLE_INSTALL=ON -DDAWN_BUILD_SAMPLES=OFF -DDAWN_BUILD_TESTS=OFF \
-DTINT_BUILD_TESTS=OFF -DTINT_BUILD_CMD_TOOLS=OFF -DDAWN_USE_GLFW=OFF \
-DDAWN_ENABLE_DESKTOP_GL=OFF -DDAWN_ENABLE_OPENGLES=OFF -DDAWN_ENABLE_VULKAN=ON \
-DCMAKE_INSTALL_PREFIX="$HOME/dawn-install"
cmake --build build
cmake --install build
- name: Build IGL
run: |
cmake -G Ninja -S "${{ github.workspace }}" -B build -DCMAKE_BUILD_TYPE=Debug \
-DIGL_WITH_WEBGPU=ON -DIGL_WEBGPU_DAWN_DIR="$HOME/dawn-install" \
-DIGL_WITH_OPENGL=OFF -DIGL_WITH_VULKAN=OFF -DIGL_WITH_TESTS=ON
cmake --build build --target IGLTests ColorSession_webgpu HelloWorldSession_webgpu TQSession_webgpu
- name: Run tests
continue-on-error: true
run: |
./build/src/igl/tests/IGLTests
- name: Run shell sessions (headless)
run: |
./build/shell/ColorSession_webgpu --headless --viewport-size 1600x900 --screenshot-file ColorSession_webgpu.png
./build/shell/HelloWorldSession_webgpu --headless --viewport-size 1600x900 --screenshot-file HelloWorldSession_webgpu.png
./build/shell/TQSession_webgpu --headless --viewport-size 1600x900 --screenshot-file TQSession_webgpu.png
- name: Upload artifacts
uses: actions/upload-artifact@v6
with:
name: Screenshots-WebGPU
path: |
ColorSession_webgpu.png
HelloWorldSession_webgpu.png
TQSession_webgpu.png
if-no-files-found: error
retention-days: 5
overwrite: true
# WebGPU backend for the browser: emdawnwebgpu needs Emscripten >= 4.0.10 (the apt package is
# older), so emsdk is pinned to the version fbsource builds with.
cmake-webgpu-emscripten:
name: "WebGPU - Emscripten 4.0.19"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
- name: Install Ubuntu packages
run: |
sudo apt-get update
sudo apt-get install -y ninja-build
- name: Set up Emscripten
uses: mymindstorm/setup-emsdk@v14
with:
version: 4.0.19
- name: Build
run: |
emcmake cmake -G Ninja -S "${{ github.workspace }}" -B build -DCMAKE_BUILD_TYPE=Debug -DIGL_WITH_WEBGPU=ON
cmake --build build --target IGLWebGPU