88 required : false
99
1010jobs :
11- build :
11+ build-windows :
1212 name : Build SwiftShader (Windows x64)
1313 runs-on : windows-2025-vs2026
1414 env :
@@ -28,17 +28,140 @@ jobs:
2828 shell : pwsh
2929 run : |
3030 cmake -S swiftshader-src -B swiftshader-build -Thost=x64 -DSWIFTSHADER_BUILD_TESTS=OFF -DSWIFTSHADER_BUILD_BENCHMARKS=OFF
31- cmake --build swiftshader-build --config RelWithDebInfo --target vk_swiftshader
31+ cmake --build swiftshader-build --config Release --target vk_swiftshader
32+
33+ - name : Upload build output
34+ uses : actions/upload-artifact@v4
35+ with :
36+ name : swiftshader-win-x64
37+ path : |
38+ swiftshader-build/**/vk_swiftshader.dll
39+ swiftshader-build/**/vk_swiftshader_icd.json
40+
41+ build-linux :
42+ name : Build SwiftShader (Linux x64)
43+ runs-on : ubuntu-24.04
44+ env :
45+ CMAKE_POLICY_VERSION_MINIMUM : " 3.5"
46+ steps :
47+ - name : Checkout
48+ uses : actions/checkout@v4
49+
50+ - name : Checkout SwiftShader
51+ uses : actions/checkout@v4
52+ with :
53+ repository : google/swiftshader
54+ submodules : recursive
55+ path : swiftshader-src
56+
57+ - name : Build
58+ run : |
59+ cmake -S swiftshader-src -B swiftshader-build -DCMAKE_BUILD_TYPE=Release -DSWIFTSHADER_BUILD_TESTS=OFF -DSWIFTSHADER_BUILD_BENCHMARKS=OFF
60+ cmake --build swiftshader-build --target vk_swiftshader -- -j$(nproc)
61+
62+ - name : Collect build output
63+ run : |
64+ mkdir -p swiftshader-out
65+ find swiftshader-build -maxdepth 2 -name "libvk_swiftshader.so" -exec cp {} swiftshader-out/ \;
66+ find swiftshader-build -maxdepth 2 -name "vk_swiftshader_icd.json" -exec cp {} swiftshader-out/ \;
67+
68+ - name : Upload build output
69+ uses : actions/upload-artifact@v4
70+ with :
71+ name : swiftshader-linux-x64
72+ path : swiftshader-out/
73+
74+ build-macos :
75+ name : Build SwiftShader (macOS ARM64)
76+ runs-on : macos-15
77+ env :
78+ CMAKE_POLICY_VERSION_MINIMUM : " 3.5"
79+ steps :
80+ - name : Checkout
81+ uses : actions/checkout@v4
82+
83+ - name : Checkout SwiftShader
84+ uses : actions/checkout@v4
85+ with :
86+ repository : google/swiftshader
87+ submodules : recursive
88+ path : swiftshader-src
89+
90+ - name : Build
91+ run : |
92+ cmake -S swiftshader-src -B swiftshader-build -DCMAKE_BUILD_TYPE=Release -DSWIFTSHADER_BUILD_TESTS=OFF -DSWIFTSHADER_BUILD_BENCHMARKS=OFF
93+ cmake --build swiftshader-build --target vk_swiftshader -- -j$(sysctl -n hw.ncpu)
94+
95+ - name : Collect build output
96+ run : |
97+ mkdir -p swiftshader-out
98+ find swiftshader-build -maxdepth 2 -name "libvk_swiftshader.dylib" -exec cp {} swiftshader-out/ \;
99+ find swiftshader-build -maxdepth 2 -name "vk_swiftshader_icd.json" -exec cp {} swiftshader-out/ \;
100+
101+ - name : Upload build output
102+ uses : actions/upload-artifact@v4
103+ with :
104+ name : swiftshader-osx-arm64
105+ path : swiftshader-out/
106+
107+ pack :
108+ name : Pack & Publish NuGet
109+ needs : [build-windows, build-linux, build-macos]
110+ runs-on : windows-2025-vs2026
111+ steps :
112+ - name : Checkout
113+ uses : actions/checkout@v4
114+
115+ - name : Checkout SwiftShader (for commit hash)
116+ uses : actions/checkout@v4
117+ with :
118+ repository : google/swiftshader
119+ path : swiftshader-src
120+ fetch-depth : 1
121+
122+ - name : Download Windows artifact
123+ uses : actions/download-artifact@v4
124+ with :
125+ name : swiftshader-win-x64
126+ path : artifacts/win-x64
127+
128+ - name : Download Linux artifact
129+ uses : actions/download-artifact@v4
130+ with :
131+ name : swiftshader-linux-x64
132+ path : artifacts/linux-x64
133+
134+ - name : Download macOS artifact
135+ uses : actions/download-artifact@v4
136+ with :
137+ name : swiftshader-osx-arm64
138+ path : artifacts/osx-arm64
32139
33140 - name : Prepare package contents
34141 shell : pwsh
35142 run : |
36143 $destDir = "build/deps/swiftshader"
37- Copy-Item swiftshader-build/RelWithDebInfo/vk_swiftshader.dll $destDir/
38- # ICD JSON is generated in a platform-specific directory by cmake
39- $icdJson = Get-ChildItem -Recurse -Path swiftshader-build -Filter vk_swiftshader_icd.json | Select-Object -First 1
40- if (-not $icdJson) { throw "vk_swiftshader_icd.json not found in build output" }
41- Copy-Item $icdJson.FullName $destDir/
144+
145+ # Windows
146+ New-Item -Path "$destDir/win-x64" -ItemType Directory -Force | Out-Null
147+ $winDll = Get-ChildItem -Recurse -Path artifacts/win-x64 -Filter vk_swiftshader.dll | Select-Object -First 1
148+ Copy-Item $winDll.FullName "$destDir/win-x64/"
149+ $winIcd = Get-ChildItem -Recurse -Path artifacts/win-x64 -Filter vk_swiftshader_icd.json | Select-Object -First 1
150+ Copy-Item $winIcd.FullName "$destDir/win-x64/"
151+
152+ # Linux
153+ New-Item -Path "$destDir/linux-x64" -ItemType Directory -Force | Out-Null
154+ $linuxSo = Get-ChildItem -Recurse -Path artifacts/linux-x64 -Filter libvk_swiftshader.so | Select-Object -First 1
155+ Copy-Item $linuxSo.FullName "$destDir/linux-x64/"
156+ $linuxIcd = Get-ChildItem -Recurse -Path artifacts/linux-x64 -Filter vk_swiftshader_icd.json | Select-Object -First 1
157+ Copy-Item $linuxIcd.FullName "$destDir/linux-x64/"
158+
159+ # macOS
160+ New-Item -Path "$destDir/osx-arm64" -ItemType Directory -Force | Out-Null
161+ $macDylib = Get-ChildItem -Recurse -Path artifacts/osx-arm64 -Filter libvk_swiftshader.dylib | Select-Object -First 1
162+ Copy-Item $macDylib.FullName "$destDir/osx-arm64/"
163+ $macIcd = Get-ChildItem -Recurse -Path artifacts/osx-arm64 -Filter vk_swiftshader_icd.json | Select-Object -First 1
164+ Copy-Item $macIcd.FullName "$destDir/osx-arm64/"
42165
43166 - name : Pack NuGet
44167 shell : pwsh
@@ -52,15 +175,15 @@ jobs:
52175 -OutputDirectory nupkg
53176 echo "PACKAGE_VERSION=$version" >> $env:GITHUB_ENV
54177
55- - name : Upload artifact
178+ - name : Upload package artifact
56179 uses : actions/upload-artifact@v4
57180 with :
58181 name : Stride.Dependencies.SwiftShader.nupkg
59182 path : nupkg/*.nupkg
60183
61184 publish :
62185 name : Sign & Publish to NuGet.org
63- needs : build
186+ needs : pack
64187 runs-on : windows-2025-vs2026
65188 environment : production
66189 steps :
0 commit comments