Skip to content

Commit 2bcb1a7

Browse files
Add version check for sccache
1 parent a7af8ea commit 2bcb1a7

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

utils/build.ps1

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -915,6 +915,20 @@ function Test-CMakeAtLeast([int]$Major, [int]$Minor, [int]$Patch = 0) {
915915
return [int]$Matches.3 -ge $Patch
916916
}
917917

918+
function Test-SCCacheAtLeast([int]$Major, [int]$Minor, [int]$Patch = 0) {
919+
if ($ToBatch) { return $false }
920+
921+
$SCCacheVersionString = @(& sccache.exe --version)[0]
922+
if (-not ($SCCacheVersionString -match "sccache (\d+)\.(\d+)(?:\.(\d+))?")) {
923+
throw "Unexpected SCCache version string format"
924+
}
925+
926+
if ([int]$Matches.1 -ne $Major) { return [int]$Matches.1 -gt $Major }
927+
if ([int]$Matches.2 -ne $Minor) { return [int]$Matches.2 -gt $Minor }
928+
if ($null -eq $Matches.3) { return 0 -gt $Patch }
929+
return [int]$Matches.3 -ge $Patch
930+
}
931+
918932
enum Platform {
919933
Windows
920934
Android
@@ -2783,6 +2797,13 @@ try {
27832797
Fetch-Dependencies
27842798

27852799
if (-not $SkipBuild) {
2800+
if (-Not (Test-CMakeAtLeast -Major 3 -Minor 28)) {
2801+
throw "Minimum required CMake version is 3.28"
2802+
}
2803+
if ($EnableCaching -And (-Not (Test-SCCacheAtLeast -Major 0 -Minor 7 -Patch 4))) {
2804+
throw "Minimum required sccache version is 0.7.4"
2805+
}
2806+
27862807
Invoke-BuildStep Build-CMark $BuildArch
27872808
Invoke-BuildStep Build-BuildTools $BuildArch
27882809
if ($IsCrossCompiling) {

0 commit comments

Comments
 (0)