@@ -478,6 +478,11 @@ function Get-BuildProjectCMakeModules([BuildComponent]$Project) {
478
478
return " $BinaryCache \$ ( $Project.value__ ) \cmake\modules"
479
479
}
480
480
481
+ function Get-PlainLLVMTarget ($Arch ) {
482
+ # Remove trailing Android API number from the LLVMTarget (if present)
483
+ return $Arch.LLVMTarget.Replace (" $AndroidAPILevel " , " " )
484
+ }
485
+
481
486
function Copy-File ($Src , $Dst ) {
482
487
# Create the directory tree first so Copy-Item succeeds
483
488
# If $Dst is the target directory, make sure it ends with "\"
@@ -1091,7 +1096,7 @@ function Build-CMakeProject {
1091
1096
if (-not ($Platform -eq " Windows" )) {
1092
1097
TryAdd- KeyValue $Defines CMAKE_Swift_COMPILER_WORKS = " YES"
1093
1098
}
1094
- TryAdd- KeyValue $Defines CMAKE_Swift_COMPILER_TARGET $Arch .LLVMTarget.Replace ( " $AndroidAPILevel " , " " )
1099
+ TryAdd- KeyValue $Defines CMAKE_Swift_COMPILER_TARGET " $ ( Get-PlainLLVMTarget $Arch )
1095
1100
if ($UseBuiltCompilers .Contains(" Swift" )) {
1096
1101
$RuntimeBinaryCache = Get-TargetProjectBinaryCache $Arch Runtime
1097
1102
$SwiftResourceDir = " ${RuntimeBinaryCache} \lib\swift"
@@ -1671,12 +1676,10 @@ function Build-RegsGen2($Arch) {
1671
1676
}
1672
1677
1673
1678
function Build-DS2([Platform]$Platform , $Arch ) {
1674
- $ArchName = $Arch.LLVMTarget.Replace (" $AndroidAPILevel " , " " )
1675
-
1676
1679
Build-CMakeProject `
1677
1680
-Src " $SourceCache \ds2" `
1678
1681
-Bin " $ ($Arch.BinaryCache )\$Platform \ds2" `
1679
- - InstallTo " $ ( $Arch.PlatformInstallRoot ) \Developer\Library\$ArchName " `
1682
+ -InstallTo " $ ($Arch.PlatformInstallRoot )\Developer\Library\$ ( Get-PlainLLVMTarget $Arch ) " `
1680
1683
-Arch $Arch `
1681
1684
-Platform $Platform `
1682
1685
-BuildTargets default `
@@ -1828,7 +1831,7 @@ function Build-Runtime([Platform]$Platform, $Arch) {
1828
1831
-CacheScript $SourceCache \swift\cmake\caches\Runtime-$Platform -$ ( $Arch.LLVMName ) .cmake `
1829
1832
-UseBuiltCompilers C,CXX,Swift `
1830
1833
-Defines ($PlatformDefines + @{
1831
- CMAKE_Swift_COMPILER_TARGET = $Arch .LLVMTarget.Replace ( " $AndroidAPILevel " , " " ) ;
1834
+ CMAKE_Swift_COMPILER_TARGET = " $ ( Get-PlainLLVMTarget $Arch ) " ;
1832
1835
CMAKE_Swift_COMPILER_WORKS = " YES" ;
1833
1836
CMAKE_SYSTEM_NAME = $Platform .ToString();
1834
1837
LLVM_DIR = " $ (Get-TargetProjectBinaryCache $Arch LLVM)\lib\cmake\llvm" ;
@@ -2124,7 +2127,7 @@ function Install-Platform([Platform]$Platform, $Arch) {
2124
2127
Get-ChildItem -Recurse " $PlatformLibSrc \$ ($Arch.LLVMName )" | ForEach-Object {
2125
2128
if (" .swiftmodule" , " .swiftdoc" , " .swiftinterface" -contains $_ .Extension) {
2126
2129
$DstDir = " $PlatformLibDst \$ ($_.BaseName ).swiftmodule"
2127
- Copy-File $_.FullName " $DstDir \$ ( $Arch.LLVMTarget ) $ ( $_.Extension ) "
2130
+ Copy-File $_ .FullName " $DstDir \$ (Get-PlainLLVMTarget $Arch )$ ($_.Extension )"
2128
2131
} else {
2129
2132
Copy-File $_ .FullName " $PlatformLibDst \$ ($Arch.LLVMName )\"
2130
2133
}
0 commit comments