-
Notifications
You must be signed in to change notification settings - Fork 4
379 lines (365 loc) · 14 KB
/
swiftshader.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
name: SwiftShader
on: [push, pull_request]
# Cancel in-progress builds on push to same branch / PR
# https://stackoverflow.com/a/72408109
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
# Ideally use a commit that's verified to work well elsewhere (Arch
# swiftshader-git package, for example)
COMMIT: a6940c8e6eb0c61c433ed4b61ae04c12ff37bfbb
# Mostly just copied from here, with ES1 disabled:
# https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=swiftshader-git
jobs:
ubuntu-gles:
name: GLES, ${{ matrix.os }}
runs-on: ${{ matrix.runs-on }}
container: ${{ matrix.container }}
strategy:
matrix:
include:
- os: ubuntu-18.04
runs-on: ubuntu-latest
container: ubuntu:bionic-20220427
steps:
- name: Install base build tools
# apt update is needed to fetch package lists; software-properties-common
# is the add-apt-repository command (why that isn't included by
# default?!)
run: |
apt update
apt install -y ninja-build cmake g++ software-properties-common
- name: Install a newer Git version from a PPA
# The actions/checkout FOR SOME REASON requires Git 2.18+, while 18.04
# ships only with 2.17. Ultimately that means the "clones" are not
# actually clones, so I can't do git submodule update.
run: |
add-apt-repository ppa:git-core/ppa
apt update
apt install -y git
- name: Clone SwiftShader
# checkout v4 uses Node 20 which doesn't work on Ubuntu 18.04
uses: actions/checkout@v3.6.0
with:
repository: google/swiftshader
ref: ${{ env.COMMIT }}
path: swiftshader
# Yeah, I know, but the repo has no tags, and we use number of commits
# for SWIFTSHADER_VERSION.
fetch-depth: 0
- name: Init & update submodules, fetch version
run: |
git -C swiftshader submodule init
git -C swiftshader submodule update
SWIFTSHADER_VERSION="r$(git -C swiftshader rev-list --count HEAD).$(git -C swiftshader rev-parse --short=10 HEAD)"
echo "version: $SWIFTSHADER_VERSION"
echo "SWIFTSHADER_VERSION=$SWIFTSHADER_VERSION" >> $GITHUB_ENV
- name: Build & install Debug
run: |
mkdir build-debug && cd build-debug
cmake ../swiftshader \
-DCMAKE_BUILD_TYPE=Debug \
-DSWIFTSHADER_BUILD_GLES_CM=OFF \
-DSWIFTSHADER_BUILD_GLESv2=ON \
-DSWIFTSHADER_BUILD_VULKAN=OFF \
-DSWIFTSHADER_BUILD_PVR=OFF \
-DSWIFTSHADER_BUILD_TESTS=OFF \
-DSWIFTSHADER_WARNINGS_AS_ERRORS=OFF \
-G Ninja
ninja
cd ..
install -dm755 install-debug/lib
install -dm755 install-debug/include
install -dm755 install-debug/include/EGL
install -dm755 install-debug/include/KHR
install -m755 -t install-debug/lib \
build-debug/libEGL.so \
build-debug/libGLESv2.so
install -m644 -t install-debug/include/EGL \
swiftshader/include/EGL/egl.h \
swiftshader/include/EGL/eglext.h \
swiftshader/include/EGL/eglplatform.h
install -m644 -t install-debug/include/KHR \
swiftshader/include/KHR/khrplatform.h
- name: Build & install Release
run: |
mkdir build && cd build
cmake ../swiftshader \
-DCMAKE_BUILD_TYPE=Release \
-DSWIFTSHADER_BUILD_GLES_CM=OFF \
-DSWIFTSHADER_BUILD_GLESv2=ON \
-DSWIFTSHADER_BUILD_VULKAN=OFF \
-DSWIFTSHADER_BUILD_PVR=OFF \
-DSWIFTSHADER_BUILD_TESTS=OFF \
-DSWIFTSHADER_WARNINGS_AS_ERRORS=OFF \
-G Ninja
ninja
cd ..
install -dm755 install/lib
install -dm755 install/include
install -dm755 install/include/EGL
install -dm755 install/include/KHR
install -m755 -t install/lib \
build/libEGL.so \
build/libGLESv2.so
install -m644 -t install/include/EGL \
swiftshader/include/EGL/egl.h \
swiftshader/include/EGL/eglext.h \
swiftshader/include/EGL/eglplatform.h
install -m644 -t install/include/KHR \
swiftshader/include/KHR/khrplatform.h
- name: Upload Debug artifacts
uses: actions/upload-artifact@v4.3.3
with:
name: swiftshader-gles-${{ env.SWIFTSHADER_VERSION }}-${{ matrix.os }}-debug
path: install-debug
- name: Upload Release artifacts
uses: actions/upload-artifact@v4.3.3
with:
name: swiftshader-gles-${{ env.SWIFTSHADER_VERSION }}-${{ matrix.os }}
path: install
ubuntu-vulkan:
name: Vulkan, ${{ matrix.os }}
runs-on: ${{ matrix.runs-on }}
container: ${{ matrix.container }}
strategy:
matrix:
include:
- os: ubuntu-18.04
runs-on: ubuntu-latest
container: ubuntu:bionic-20220427
steps:
- name: Install base build tools
# apt update is needed to fetch package lists; software-properties-common
# is the add-apt-repository command (why that isn't included by
# default?!)
run: |
apt update
apt install -y ninja-build cmake g++ software-properties-common
- name: Install a newer Git version from a PPA
# The actions/checkout FOR SOME REASON requires Git 2.18+, while 18.04
# ships only with 2.17. Ultimately that means the "clones" are not
# actually clones, so I can't so git submodule update.
run: |
add-apt-repository ppa:git-core/ppa
apt update
apt install -y git
- name: Clone SwiftShader
# checkout v4 uses Node 20 which doesn't work on Ubuntu 18.04
uses: actions/checkout@v3.6.0
with:
repository: google/swiftshader
ref: ${{ env.COMMIT }}
path: swiftshader
# Yeah, I know, but the repo has no tags, and we use number of commits
# for SWIFTSHADER_VERSION.
fetch-depth: 0
- name: Init & update submodules, fetch version
run: |
git -C swiftshader submodule init
git -C swiftshader submodule update
SWIFTSHADER_VERSION="r$(git -C swiftshader rev-list --count HEAD).$(git -C swiftshader rev-parse --short=10 HEAD)"
echo "version: $SWIFTSHADER_VERSION"
echo "SWIFTSHADER_VERSION=$SWIFTSHADER_VERSION" >> $GITHUB_ENV
- name: Configure
run: |
cmake \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DSWIFTSHADER_BUILD_GLES_CM=OFF \
-DSWIFTSHADER_BUILD_GLESv2=OFF \
-DSWIFTSHADER_BUILD_VULKAN=ON \
-DSWIFTSHADER_BUILD_PVR=OFF \
-DSWIFTSHADER_BUILD_TESTS=OFF \
-DSWIFTSHADER_WARNINGS_AS_ERRORS=OFF \
-DSPIRV_WERROR=OFF \
-S swiftshader -B build
- name: Build
run: |
ninja -C build
- name: Install
run: |
install -dm755 install/lib
install -m755 -t install/lib \
build/libvk_swiftshader.so
install -dm755 install/share/vulkan/icd.d/
install -m644 -t install/share/vulkan/icd.d/ \
build/Linux/vk_swiftshader_icd.json
sed 's#./libvk_swiftshader.so#../../../lib/libvk_swiftshader.so#' \
-i install/share/vulkan/icd.d/vk_swiftshader_icd.json
- name: Upload artifacts
uses: actions/upload-artifact@v4.3.3
with:
name: swiftshader-vulkan-${{ env.SWIFTSHADER_VERSION }}-${{ matrix.os }}
path: install
mac:
name: ${{ matrix.os }}
runs-on: ${{ matrix.runs-on }}
strategy:
matrix:
include:
- os: macos12-arm64
runs-on: macos-12
steps:
- name: Install base build tools
run: |
brew install ninja
- name: Clone SwiftShader
uses: actions/checkout@v4.1.7
with:
repository: google/swiftshader
ref: ${{ env.COMMIT }}
path: swiftshader
# Yeah, I know, but the repo has no tags, and we use number of commits
# for SWIFTSHADER_VERSION.
fetch-depth: 0
- name: Init & update submodules, fetch version
run: |
git -C swiftshader submodule init
git -C swiftshader submodule update
SWIFTSHADER_VERSION="r$(git -C swiftshader rev-list --count HEAD).$(git -C swiftshader rev-parse --short=10 HEAD)"
echo "version: $SWIFTSHADER_VERSION"
echo "SWIFTSHADER_VERSION=$SWIFTSHADER_VERSION" >> $GITHUB_ENV
- name: Configure
# Can't do -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" as it says
# clang: error: the clang compiler does not support '-march=x86-64'
# Yay FFS. Planned obsolescence going really fast these days.
run: |
cmake \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_OSX_ARCHITECTURES="arm64" \
-DSWIFTSHADER_BUILD_GLES_CM=OFF \
-DSWIFTSHADER_BUILD_GLESv2=ON \
-DSWIFTSHADER_BUILD_VULKAN=ON \
-DSWIFTSHADER_BUILD_PVR=OFF \
-DSWIFTSHADER_BUILD_TESTS=OFF \
-DSWIFTSHADER_WARNINGS_AS_ERRORS=OFF \
-DSPIRV_WERROR=OFF \
-S swiftshader -B build
- name: Build
run: |
ninja -C build
- name: Install
run: |
install -dm755 install-gles/lib
install -dm755 install-gles/include
install -dm755 install-gles/include/EGL
install -dm755 install-gles/include/KHR
install -dm755 install-vulkan/lib
# There's no install -t on macOS
install -m755 \
build/libEGL.dylib \
build/libGLESv2.dylib \
install-gles/lib
install -m644 \
swiftshader/include/EGL/egl.h \
swiftshader/include/EGL/eglext.h \
swiftshader/include/EGL/eglplatform.h \
install-gles/include/EGL
install -m644 \
swiftshader/include/KHR/khrplatform.h \
install-gles/include/KHR
install -m755 \
build/libvk_swiftshader.dylib \
install-vulkan/lib
install -dm755 install-vulkan/share/vulkan/icd.d/
install -m644 build/Darwin/vk_swiftshader_icd.json \
install-vulkan/share/vulkan/icd.d/
# There's no sed -i on macOS, need to provide an extension and then
# delete the backup
sed -e 's#./libvk_swiftshader.dylib#../../../lib/libvk_swiftshader.dylib#' \
-i'.old' install-vulkan/share/vulkan/icd.d/vk_swiftshader_icd.json
rm install-vulkan/share/vulkan/icd.d/vk_swiftshader_icd.json.old
- name: Upload GLES artifacts
uses: actions/upload-artifact@v4.3.3
with:
name: swiftshader-gles-${{ env.SWIFTSHADER_VERSION }}-${{ matrix.os }}
path: install-gles
- name: Upload Vulkan artifacts
uses: actions/upload-artifact@v4.3.3
with:
name: swiftshader-vulkan-${{ env.SWIFTSHADER_VERSION }}-${{ matrix.os }}
path: install-vulkan
windows:
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
# Can't (easily) build on MSVC 2017 because windows-2016 has CMake 3.12
# and the damn SwiftShader codebase requires 3.13 for some stupid
# reason.
os: [windows-2019]
steps:
- name: Install Ninja
uses: seanmiddleditch/gha-setup-ninja@v5
- name: Set up Visual Studio environment
uses: compnerd/gha-setup-vsdevenv@v6
- name: Clone SwiftShader
uses: actions/checkout@v4.1.7
with:
repository: google/swiftshader
ref: ${{ env.COMMIT }}
path: swiftshader
# Yeah, I know, but the repo has no tags, and we use number of commits
# for SWIFTSHADER_VERSION.
fetch-depth: 0
- name: Init & update submodules, fetch version
run: |
git -C swiftshader submodule init
git -C swiftshader submodule update
$SWIFTSHADER_VERSION="r$(git -C swiftshader rev-list --count HEAD).$(git -C swiftshader rev-parse --short=10 HEAD)"
echo "version: $SWIFTSHADER_VERSION"
echo "SWIFTSHADER_VERSION=$SWIFTSHADER_VERSION" >> $GITHUB_ENV
- name: Configure
run: |
cmake `
-G Ninja `
-DCMAKE_C_COMPILER=cl.exe `
-DCMAKE_CXX_COMPILER=cl.exe `
-DCMAKE_BUILD_TYPE=Release `
-DSWIFTSHADER_BUILD_GLES_CM=OFF `
-DSWIFTSHADER_BUILD_GLESv2=ON `
-DSWIFTSHADER_BUILD_VULKAN=ON `
-DSWIFTSHADER_BUILD_PVR=OFF `
-DSWIFTSHADER_BUILD_TESTS=OFF `
-DSWIFTSHADER_WARNINGS_AS_ERRORS=OFF `
-DSPIRV_WERROR=OFF `
-S swiftshader -B build
- name: Build
run: |
ninja -C build
- name: Install
run: |
mkdir install-gles\bin
mkdir install-gles\lib
mkdir install-gles\include
mkdir install-gles\include\EGL
mkdir install-gles\include\KHR
mkdir install-vulkan\bin
mkdir install-vulkan\lib
mkdir install-vulkan\share\vulkan\icd.d
copy build\libEGL.dll install-gles\bin\
copy build\src\OpenGL\libEGL\libEGL.lib install-gles\lib\
copy build\libGLESv2.dll install-gles\bin\
copy build\src\OpenGL\libGLESv2\libGLESv2.lib install-gles\lib\
copy swiftshader\include\EGL\egl.h install-gles\include\EGL\
copy swiftshader\include\EGL\eglext.h install-gles\include\EGL\
copy swiftshader\include\EGL\eglplatform.h install-gles\include\EGL\
copy swiftshader\include\KHR\khrplatform.h install-gles\include\KHR\
copy build\vk_swiftshader.dll install-vulkan\bin\
copy build\src\Vulkan\vk_swiftshader.lib install-vulkan\lib\
(Get-Content build\Windows\vk_swiftshader_icd.json) `
-replace '\.\\\\vk_swiftshader\.dll', '..\\..\\..\\bin\\vk_swiftshader.dll' `
| Out-File -encoding UTF8 install-vulkan\share\vulkan\icd.d\vk_swiftshader_icd.json
- name: Upload GLES artifacts
uses: actions/upload-artifact@v4.3.3
with:
name: swiftshader-gles-${{ env.SWIFTSHADER_VERSION }}-${{ matrix.os }}
path: install-gles
- name: Upload Vulkan artifacts
uses: actions/upload-artifact@v4.3.3
with:
name: swiftshader-vulkan-${{ env.SWIFTSHADER_VERSION }}-${{ matrix.os }}
path: install-vulkan