@@ -857,6 +857,21 @@ function Get-PinnedToolchainVersion() {
857
857
throw " PinnedVersion must be set"
858
858
}
859
859
860
+ function Get-ClangDriverName ([Platform ] $Platform , [string ] $Lang ) {
861
+ switch ($Platform ) {
862
+ Windows {
863
+ " clang-cl.exe"
864
+ }
865
+ Android {
866
+ switch ($Lang ) {
867
+ C { " clang.exe" }
868
+ ASM { " clang.exe" }
869
+ CXX { " clang++.exe" }
870
+ }
871
+ }
872
+ }
873
+ }
874
+
860
875
function TryAdd-KeyValue ([hashtable ]$Hashtable , [string ]$Key , [string ]$Value ) {
861
876
if (-not $Hashtable.Contains ($Key )) {
862
877
$Hashtable.Add ($Key , $Value )
@@ -1038,7 +1053,7 @@ function Build-CMakeProject {
1038
1053
Append- FlagsDefine $Defines CMAKE_CXX_FLAGS $CXXFlags
1039
1054
}
1040
1055
if ($UsePinnedCompilers.Contains (" ASM" ) -Or $UseBuiltCompilers.Contains (" ASM" )) {
1041
- $Driver = if ( $Platform -eq " Windows " ) { " clang-cl.exe " } else { " clang.exe " }
1056
+ $Driver = ( Get-ClangDriverName $Platform - Lang " ASM " )
1042
1057
if ($UseBuiltCompilers.Contains (" ASM" )) {
1043
1058
TryAdd- KeyValue $Defines CMAKE_ASM_COMPILER ([IO.Path ]::Combine($CompilersBinaryCache , " bin" , $Driver ))
1044
1059
} else {
@@ -1050,7 +1065,7 @@ function Build-CMakeProject {
1050
1065
}
1051
1066
}
1052
1067
if ($UsePinnedCompilers.Contains (" C" ) -Or $UseBuiltCompilers.Contains (" C" )) {
1053
- $Driver = if ( $Platform -eq " Windows " ) { " clang-cl.exe " } else { " clang.exe " }
1068
+ $Driver = ( Get-ClangDriverName $Platform - Lang " C " )
1054
1069
if ($UseBuiltCompilers.Contains (" C" )) {
1055
1070
TryAdd- KeyValue $Defines CMAKE_C_COMPILER ([IO.Path ]::Combine($CompilersBinaryCache , " bin" , $Driver ))
1056
1071
} else {
@@ -1069,7 +1084,7 @@ function Build-CMakeProject {
1069
1084
Append- FlagsDefine $Defines CMAKE_C_FLAGS $CFlags
1070
1085
}
1071
1086
if ($UsePinnedCompilers.Contains (" CXX" ) -Or $UseBuiltCompilers.Contains (" CXX" )) {
1072
- $Driver = if ( $Platform -eq " Windows " ) { " clang-cl.exe " } else { " clang++.exe " }
1087
+ $Driver = ( Get-ClangDriverName $Platform - Lang " CXX " )
1073
1088
if ($UseBuiltCompilers.Contains (" CXX" )) {
1074
1089
TryAdd- KeyValue $Defines CMAKE_CXX_COMPILER ([IO.Path ]::Combine($CompilersBinaryCache , " bin" , $Driver ))
1075
1090
} else {
0 commit comments