Skip to content

Commit f69d01c

Browse files
committed
fix Windows Vulkan action
1 parent bbc1f56 commit f69d01c

2 files changed

Lines changed: 74 additions & 14 deletions

File tree

.github/workflows/build.yml

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,47 @@ jobs:
3939
if: contains(matrix.os, 'windows')
4040
shell: pwsh
4141
run: |
42+
function Find-GlslangValidator {
43+
$cmd = Get-Command glslangValidator -ErrorAction SilentlyContinue
44+
if ($cmd) { return $cmd.Source }
45+
46+
$candidates = @()
47+
if ($env:VULKAN_SDK) {
48+
$candidates += (Join-Path $env:VULKAN_SDK 'Bin\glslangValidator.exe')
49+
}
50+
$candidates += @(
51+
'C:\VulkanSDK\*\Bin\glslangValidator.exe',
52+
'C:\Program Files\VulkanSDK\*\Bin\glslangValidator.exe',
53+
"$env:USERPROFILE\VulkanSDK\*\Bin\glslangValidator.exe",
54+
'C:\ProgramData\chocolatey\lib\vulkan-sdk\tools\**\glslangValidator.exe'
55+
)
56+
57+
foreach ($pattern in $candidates) {
58+
$found = Get-ChildItem -Path $pattern -File -Recurse -ErrorAction SilentlyContinue |
59+
Sort-Object FullName -Descending | Select-Object -First 1
60+
if ($found) { return $found.FullName }
61+
}
62+
return $null
63+
}
64+
4265
$ErrorActionPreference = 'Continue'
4366
choco install vulkan-sdk -y
44-
if ($LASTEXITCODE -ne 0) {
45-
Write-Host "Chocolatey install failed, falling back to winget..."
67+
$ErrorActionPreference = 'Stop'
68+
69+
$validator = Find-GlslangValidator
70+
if (-not $validator) {
71+
Write-Host "glslangValidator not found after Chocolatey install, falling back to winget..."
4672
winget install --id KhronosGroup.VulkanSDK --accept-package-agreements --accept-source-agreements --disable-interactivity
73+
$validator = Find-GlslangValidator
4774
}
48-
$ErrorActionPreference = 'Stop'
49-
$sdkDir = Get-ChildItem 'C:\VulkanSDK' -Directory | Sort-Object Name -Descending | Select-Object -First 1
50-
if (-not $sdkDir) { throw "Vulkan SDK not found under C:\VulkanSDK" }
51-
"$($sdkDir.FullName)\Bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
52-
glslangValidator --version
75+
76+
if (-not $validator) {
77+
throw "glslangValidator.exe not found after Vulkan SDK installation."
78+
}
79+
80+
Write-Host "Using glslangValidator: $validator"
81+
(Split-Path -Parent $validator) | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
82+
& $validator --version
5383
5484
- name: Build Desktop
5585
run: python3 scripts/build.py desktop

.github/workflows/release.yml

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,47 @@ jobs:
4949
if: contains(matrix.os, 'windows')
5050
shell: pwsh
5151
run: |
52+
function Find-GlslangValidator {
53+
$cmd = Get-Command glslangValidator -ErrorAction SilentlyContinue
54+
if ($cmd) { return $cmd.Source }
55+
56+
$candidates = @()
57+
if ($env:VULKAN_SDK) {
58+
$candidates += (Join-Path $env:VULKAN_SDK 'Bin\glslangValidator.exe')
59+
}
60+
$candidates += @(
61+
'C:\VulkanSDK\*\Bin\glslangValidator.exe',
62+
'C:\Program Files\VulkanSDK\*\Bin\glslangValidator.exe',
63+
"$env:USERPROFILE\VulkanSDK\*\Bin\glslangValidator.exe",
64+
'C:\ProgramData\chocolatey\lib\vulkan-sdk\tools\**\glslangValidator.exe'
65+
)
66+
67+
foreach ($pattern in $candidates) {
68+
$found = Get-ChildItem -Path $pattern -File -Recurse -ErrorAction SilentlyContinue |
69+
Sort-Object FullName -Descending | Select-Object -First 1
70+
if ($found) { return $found.FullName }
71+
}
72+
return $null
73+
}
74+
5275
$ErrorActionPreference = 'Continue'
5376
choco install vulkan-sdk -y
54-
if ($LASTEXITCODE -ne 0) {
55-
Write-Host "Chocolatey install failed, falling back to winget..."
77+
$ErrorActionPreference = 'Stop'
78+
79+
$validator = Find-GlslangValidator
80+
if (-not $validator) {
81+
Write-Host "glslangValidator not found after Chocolatey install, falling back to winget..."
5682
winget install --id KhronosGroup.VulkanSDK --accept-package-agreements --accept-source-agreements --disable-interactivity
83+
$validator = Find-GlslangValidator
5784
}
58-
$ErrorActionPreference = 'Stop'
59-
$sdkDir = Get-ChildItem 'C:\VulkanSDK' -Directory | Sort-Object Name -Descending | Select-Object -First 1
60-
if (-not $sdkDir) { throw "Vulkan SDK not found under C:\VulkanSDK" }
61-
"$($sdkDir.FullName)\Bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
62-
glslangValidator --version
85+
86+
if (-not $validator) {
87+
throw "glslangValidator.exe not found after Vulkan SDK installation."
88+
}
89+
90+
Write-Host "Using glslangValidator: $validator"
91+
(Split-Path -Parent $validator) | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
92+
& $validator --version
6393
6494
- name: Build Desktop
6595
run: python3 scripts/build.py desktop

0 commit comments

Comments
 (0)