@@ -269,6 +269,7 @@ $AndroidARM64 = @{
269269 CMakeName = " aarch64" ;
270270 LLVMName = " aarch64" ;
271271 LLVMTarget = " aarch64-unknown-linux-android$AndroidAPILevel " ;
272+ ShortName = " arm64" ;
272273 BuildID = 400 ;
273274 BinaryCache = " $BinaryCache \aarch64" ;
274275 PlatformInstallRoot = " $BinaryCache \arm64\Android.platform" ;
@@ -283,6 +284,7 @@ $AndroidARMv7 = @{
283284 CMakeName = " armv7-a" ;
284285 LLVMName = " armv7" ;
285286 LLVMTarget = " armv7-unknown-linux-androideabi$AndroidAPILevel " ;
287+ ShortName = " armv7" ;
286288 BuildID = 500 ;
287289 BinaryCache = " $BinaryCache \armv7" ;
288290 PlatformInstallRoot = " $BinaryCache \armv7\Android.platform" ;
@@ -297,6 +299,7 @@ $AndroidX86 = @{
297299 CMakeName = " i686" ;
298300 LLVMName = " i686" ;
299301 LLVMTarget = " i686-unknown-linux-android$AndroidAPILevel " ;
302+ ShortName = " i686" ;
300303 BuildID = 600 ;
301304 BinaryCache = " $BinaryCache \i686" ;
302305 PlatformInstallRoot = " $BinaryCache \x86\Android.platform" ;
@@ -311,6 +314,7 @@ $AndroidX64 = @{
311314 CMakeName = " x86_64" ;
312315 LLVMName = " x86_64" ;
313316 LLVMTarget = " x86_64-unknown-linux-android$AndroidAPILevel " ;
317+ ShortName = " x86_64" ;
314318 BuildID = 700 ;
315319 BinaryCache = " $BinaryCache \x86_64" ;
316320 PlatformInstallRoot = " $BinaryCache \x64\Android.platform" ;
@@ -1056,36 +1060,44 @@ function Build-CMakeProject {
10561060 }
10571061 TryAdd- KeyValue $Defines CMAKE_Swift_COMPILER_TARGET $Arch.LLVMTarget.Replace (" $AndroidAPILevel " , " " )
10581062 if ($UseBuiltCompilers.Contains (" Swift" )) {
1059- if ( $SwiftSDK -ne " " ) {
1060- $SwiftArgs += @ ( " -sdk " , $SwiftSDK )
1061- } else {
1062- $RuntimeBinaryCache = Get-TargetProjectBinaryCache $Arch Runtime
1063- $SwiftResourceDir = " ${RuntimeBinaryCache} \lib\swift "
1064-
1065- switch ( $Platform ) {
1066- Windows {
1063+ $RuntimeBinaryCache = Get-TargetProjectBinaryCache $Arch Runtime
1064+ $SwiftResourceDir = " ${RuntimeBinaryCache} \lib\swift "
1065+
1066+ switch ( $Platform ) {
1067+ Windows {
1068+ if ( $SwiftSDK -ne " " ) {
1069+ $SwiftArgs += @ ( " -sdk " , $SwiftSDK )
1070+ } else {
10671071 $SwiftArgs += @ (
10681072 " -vfsoverlay" , " $RuntimeBinaryCache \stdlib\windows-vfs-overlay.yaml" ,
10691073 " -strict-implicit-module-context" ,
10701074 " -Xcc" , " -Xclang" , " -Xcc" , " -fbuiltin-headers-in-system-modules"
10711075 )
1076+ $SwiftArgs += @ (" -resource-dir" , " $SwiftResourceDir " )
1077+ $SwiftArgs += @ (" -L" , " $SwiftResourceDir \$ ( $Platform.ToString ().ToLowerInvariant()) " )
10721078 }
1073- Android {
1074- $androidNDKPath = Get-AndroidNDKPath
1079+ }
1080+ Android {
1081+ $androidNDKPath = Get-AndroidNDKPath
1082+ if ($SwiftSDK -ne " " ) {
1083+ $SwiftArgs += @ (" -sdk" , $SwiftSDK )
1084+ $SwiftArgs += @ (" -sysroot" , " $androidNDKPath \toolchains\llvm\prebuilt\windows-x86_64\sysroot" )
1085+ } else {
10751086 $SwiftArgs += @ (" -sdk" , " $androidNDKPath \toolchains\llvm\prebuilt\windows-x86_64\sysroot" )
1076- $SwiftArgs += @ (
1077- " -Xclang-linker" , " -target" ,
1078- " -Xclang-linker" , $Arch.LLVMTarget ,
1079- " -Xclang-linker" , " --sysroot" ,
1080- " -Xclang-linker" , " $androidNDKPath \toolchains\llvm\prebuilt\windows-x86_64\sysroot" ,
1081- " -Xclang-linker" , " -resource-dir" ,
1082- " -Xclang-linker" , " $androidNDKPath \toolchains\llvm\prebuilt\windows-x86_64\lib\clang\17"
1083- )
1087+ $SwiftArgs += @ (" -resource-dir" , " $SwiftResourceDir " )
1088+ $SwiftArgs += @ (" -L" , " $SwiftResourceDir \$ ( $Platform.ToString ().ToLowerInvariant()) " )
10841089 }
1090+ $SwiftArgs += @ (
1091+ " -Xclang-linker" , " -target" ,
1092+ " -Xclang-linker" , $Arch.LLVMTarget ,
1093+ " -Xclang-linker" , " --sysroot" ,
1094+ " -Xclang-linker" , " $androidNDKPath \toolchains\llvm\prebuilt\windows-x86_64\sysroot" ,
1095+ " -Xclang-linker" , " -resource-dir" ,
1096+ " -Xclang-linker" , " $androidNDKPath \toolchains\llvm\prebuilt\windows-x86_64\lib\clang\17"
1097+ )
10851098 }
1086- $SwiftArgs += @ (" -resource-dir" , " $SwiftResourceDir " )
1087- $SwiftArgs += @ (" -L" , " $SwiftResourceDir \$ ( $Platform.ToString ().ToLowerInvariant()) " )
10881099 }
1100+
10891101 } else {
10901102 $SwiftArgs += @ (" -sdk" , (Get-PinnedToolchainSDK ))
10911103 }
@@ -1172,7 +1184,7 @@ function Build-CMakeProject {
11721184 }
11731185 }
11741186
1175- if (" " -ne $InstallTo ) {
1187+ if ($BuildTargets .Length -eq 0 -and $InstallTo ) {
11761188 Invoke-Program cmake.exe -- build $Bin -- target install
11771189 }
11781190 }
@@ -1309,7 +1321,6 @@ function Build-CMark($Arch) {
13091321 - Bin " $ ( $Arch.BinaryCache ) \cmark-gfm-0.29.0.gfm.13" `
13101322 - InstallTo " $ ( $Arch.ToolchainInstallRoot ) \usr" `
13111323 - Arch $Arch `
1312- - BuildTargets default `
13131324 - Defines @ {
13141325 BUILD_SHARED_LIBS = " YES" ;
13151326 BUILD_TESTING = " NO" ;
@@ -1477,7 +1488,6 @@ function Build-ZLib([Platform]$Platform, $Arch) {
14771488 - Arch $Arch `
14781489 - Platform $Platform `
14791490 - UseMSVCCompilers C `
1480- - BuildTargets default `
14811491 - Defines @ {
14821492 BUILD_SHARED_LIBS = " NO" ;
14831493 CMAKE_POSITION_INDEPENDENT_CODE = " YES" ;
@@ -1497,7 +1507,6 @@ function Build-XML2([Platform]$Platform, $Arch) {
14971507 - Arch $Arch `
14981508 - Platform $Platform `
14991509 - UseMSVCCompilers C, CXX `
1500- - BuildTargets default `
15011510 - Defines @ {
15021511 BUILD_SHARED_LIBS = " NO" ;
15031512 CMAKE_INSTALL_BINDIR = " bin/$Platform /$ArchName " ;
@@ -1564,7 +1573,6 @@ function Build-CURL([Platform]$Platform, $Arch) {
15641573 - Arch $Arch `
15651574 - Platform $Platform `
15661575 - UseMSVCCompilers C `
1567- - BuildTargets default `
15681576 - Defines ($PlatformDefines + @ {
15691577 BUILD_SHARED_LIBS = " NO" ;
15701578 BUILD_TESTING = " NO" ;
@@ -1687,7 +1695,6 @@ function Build-Runtime([Platform]$Platform, $Arch) {
16871695 - Platform $Platform `
16881696 - CacheScript $SourceCache \swift\cmake\caches\Runtime- $Platform - $ ($Arch.LLVMName ).cmake `
16891697 - UseBuiltCompilers C, CXX, Swift `
1690- - BuildTargets default `
16911698 - Defines ($PlatformDefines + @ {
16921699 CMAKE_Swift_COMPILER_TARGET = $Arch.LLVMTarget.Replace (" $AndroidAPILevel " , " " );
16931700 CMAKE_Swift_COMPILER_WORKS = " YES" ;
@@ -1728,7 +1735,6 @@ function Build-Dispatch([Platform]$Platform, $Arch, [switch]$Test = $false) {
17281735 - Arch $Arch `
17291736 - Platform $Platform `
17301737 - UseBuiltCompilers C, CXX, Swift `
1731- - BuildTargets $Targets `
17321738 - Defines @ {
17331739 ENABLE_SWIFT = " YES" ;
17341740 }
@@ -1771,19 +1777,22 @@ function Build-Foundation([Platform]$Platform, $Arch, [switch]$Test = $false) {
17711777 $ShortArch = $Arch.LLVMName
17721778
17731779 Isolate- EnvVars {
1774- $TestingDefines = @ { ENABLE_TESTING = " NO" }
1775- $Targets = @ (" default" )
1776- $InstallPath = " $ ( $Arch.SDKInstallRoot ) \usr"
1780+ $SDKRoot = if ($Platform -eq " Windows" ) {
1781+ " "
1782+ } else {
1783+ (Get-Variable " ${Platform} $ ( $Arch.ShortName ) " - ValueOnly).SDKInstallRoot
1784+ }
17771785
17781786 Build-CMakeProject `
17791787 - Src $SourceCache \swift- corelibs- foundation `
17801788 - Bin $FoundationBinaryCache `
1781- - InstallTo $InstallPath `
1789+ - InstallTo " $ ( $Arch .SDKInstallRoot ) \usr " `
17821790 - Arch $Arch `
17831791 - Platform $Platform `
17841792 - UseBuiltCompilers ASM, C, CXX, Swift `
1785- - BuildTargets $Targets `
1793+ - SwiftSDK: $SDKRoot `
17861794 - Defines (@ {
1795+ ENABLE_TESTING = " NO" ;
17871796 FOUNDATION_BUILD_TOOLS = if ($Platform -eq " Windows" ) { " YES" } else { " NO" };
17881797 CURL_DIR = " $LibraryRoot \curl-8.9.1\usr\lib\$Platform \$ShortArch \cmake\CURL" ;
17891798 LIBXML2_LIBRARY = if ($Platform -eq " Windows" ) {
@@ -1805,7 +1814,7 @@ function Build-Foundation([Platform]$Platform, $Arch, [switch]$Test = $false) {
18051814 _SwiftFoundationICU_SourceDIR = " $SourceCache \swift-foundation-icu" ;
18061815 _SwiftCollections_SourceDIR = " $SourceCache \swift-collections" ;
18071816 SwiftFoundation_MACRO = " $ ( Get-BuildProjectBinaryCache FoundationMacros) \bin"
1808- } + $TestingDefines )
1817+ })
18091818 }
18101819 }
18111820}
@@ -1832,15 +1841,11 @@ function Build-FoundationMacros() {
18321841 $SwiftSDK = $BuildArch.SDKInstallRoot
18331842 }
18341843
1835- $Targets = if ($Build ) {
1836- @ (" default" )
1837- } else {
1838- @ (" default" , " install" )
1839- }
1840-
18411844 $InstallDir = $null
1845+ $Targets = @ (" default" )
18421846 if (-not $Build ) {
18431847 $InstallDir = " $ ( $Arch.ToolchainInstallRoot ) \usr"
1848+ $Targets = @ ()
18441849 }
18451850
18461851 $SwiftSyntaxCMakeModules = if ($Build -and $HostArch -ne $BuildArch ) {
@@ -1857,7 +1862,7 @@ function Build-FoundationMacros() {
18571862 - Platform $Platform `
18581863 - UseBuiltCompilers Swift `
18591864 - SwiftSDK:$SwiftSDK `
1860- - BuildTargets $Targets `
1865+ - BuildTargets: $Targets `
18611866 - Defines @ {
18621867 SwiftSyntax_DIR = $SwiftSyntaxCMakeModules ;
18631868 }
@@ -1882,7 +1887,7 @@ function Build-XCTest([Platform]$Platform, $Arch, [switch]$Test = $false) {
18821887 $env: Path = " $XCTestBinaryCache ;$FoundationBinaryCache \bin;$DispatchBinaryCache ;$ ( Get-TargetProjectBinaryCache $Arch Runtime) \bin;$env: Path ;$UnixToolsBinDir "
18831888 } else {
18841889 $TestingDefines = @ { ENABLE_TESTING = " NO" }
1885- $Targets = @ (" default " )
1890+ $Targets = @ (" install " )
18861891 $InstallPath = " $ ( $Arch.XCTestInstallRoot ) \usr"
18871892 }
18881893
@@ -1910,7 +1915,6 @@ function Build-Testing([Platform]$Platform, $Arch, [switch]$Test = $false) {
19101915 # TODO: Test
19111916 return
19121917 } else {
1913- $Targets = @ (" default" )
19141918 $InstallPath = " $ ( $Arch.SwiftTestingInstallRoot ) \usr"
19151919 }
19161920
@@ -1921,7 +1925,6 @@ function Build-Testing([Platform]$Platform, $Arch, [switch]$Test = $false) {
19211925 - Arch $Arch `
19221926 - Platform $Platform `
19231927 - UseBuiltCompilers C, CXX, Swift `
1924- - BuildTargets $Targets `
19251928 - Defines (@ {
19261929 BUILD_SHARED_LIBS = " YES" ;
19271930 CMAKE_BUILD_WITH_INSTALL_RPATH = " YES" ;
@@ -2020,7 +2023,6 @@ function Build-SQLite($Arch) {
20202023 - InstallTo $LibraryRoot \sqlite- 3.46 .0 \usr `
20212024 - Arch $Arch `
20222025 - UseMSVCCompilers C `
2023- - BuildTargets default `
20242026 - Defines @ {
20252027 BUILD_SHARED_LIBS = " NO" ;
20262028 }
@@ -2035,7 +2037,6 @@ function Build-System($Arch) {
20352037 - Platform Windows `
20362038 - UseBuiltCompilers C, Swift `
20372039 - SwiftSDK (Get-HostSwiftSDK ) `
2038- - BuildTargets default `
20392040 - Defines @ {
20402041 BUILD_SHARED_LIBS = " YES" ;
20412042 }
@@ -2055,7 +2056,6 @@ function Build-ToolsSupportCore($Arch) {
20552056 - Platform Windows `
20562057 - UseBuiltCompilers C, Swift `
20572058 - SwiftSDK (Get-HostSwiftSDK ) `
2058- - BuildTargets default `
20592059 - Defines @ {
20602060 BUILD_SHARED_LIBS = " YES" ;
20612061 SwiftSystem_DIR = (Get-HostProjectCMakeModules System);
@@ -2081,7 +2081,7 @@ function Build-LLBuild($Arch, [switch]$Test = $false) {
20812081 $env: CLANG = ([IO.Path ]::Combine((Get-HostProjectBinaryCache Compilers), " bin" , " clang.exe" ))
20822082 $InstallPath = " "
20832083 } else {
2084- $Targets = @ (" default " )
2084+ $Targets = @ ()
20852085 $TestingDefines = @ {}
20862086 $InstallPath = " $ ( $Arch.ToolchainInstallRoot ) \usr"
20872087 }
@@ -2129,7 +2129,6 @@ function Build-ArgumentParser($Arch) {
21292129 - Platform Windows `
21302130 - UseBuiltCompilers Swift `
21312131 - SwiftSDK (Get-HostSwiftSDK ) `
2132- - BuildTargets default `
21332132 - Defines @ {
21342133 BUILD_SHARED_LIBS = " YES" ;
21352134 BUILD_TESTING = " NO" ;
@@ -2145,7 +2144,6 @@ function Build-Driver($Arch) {
21452144 - Platform Windows `
21462145 - UseBuiltCompilers C, CXX, Swift `
21472146 - SwiftSDK (Get-HostSwiftSDK ) `
2148- - BuildTargets default `
21492147 - Defines @ {
21502148 BUILD_SHARED_LIBS = " YES" ;
21512149 SwiftSystem_DIR = (Get-HostProjectCMakeModules System);
@@ -2185,7 +2183,6 @@ function Build-Collections($Arch) {
21852183 - Platform Windows `
21862184 - UseBuiltCompilers C, Swift `
21872185 - SwiftSDK (Get-HostSwiftSDK ) `
2188- - BuildTargets default `
21892186 - Defines @ {
21902187 BUILD_SHARED_LIBS = " YES" ;
21912188 }
@@ -2235,7 +2232,6 @@ function Build-PackageManager($Arch) {
22352232 - Platform Windows `
22362233 - UseBuiltCompilers C, Swift `
22372234 - SwiftSDK (Get-HostSwiftSDK ) `
2238- - BuildTargets default `
22392235 - Defines @ {
22402236 BUILD_SHARED_LIBS = " YES" ;
22412237 CMAKE_Swift_FLAGS = @ (" -DCRYPTO_v2" );
@@ -2263,7 +2259,6 @@ function Build-Markdown($Arch) {
22632259 - Platform Windows `
22642260 - UseBuiltCompilers C, Swift `
22652261 - SwiftSDK (Get-HostSwiftSDK ) `
2266- - BuildTargets default `
22672262 - Defines @ {
22682263 BUILD_SHARED_LIBS = " NO" ;
22692264 ArgumentParser_DIR = (Get-HostProjectCMakeModules ArgumentParser);
@@ -2281,7 +2276,6 @@ function Build-Format($Arch) {
22812276 - UseMSVCCompilers C `
22822277 - UseBuiltCompilers Swift `
22832278 - SwiftSDK (Get-HostSwiftSDK ) `
2284- - BuildTargets default `
22852279 - Defines @ {
22862280 BUILD_SHARED_LIBS = " YES" ;
22872281 ArgumentParser_DIR = (Get-HostProjectCMakeModules ArgumentParser);
@@ -2318,7 +2312,6 @@ function Build-SourceKitLSP($Arch) {
23182312 - Platform Windows `
23192313 - UseBuiltCompilers C, Swift `
23202314 - SwiftSDK (Get-HostSwiftSDK ) `
2321- - BuildTargets default `
23222315 - Defines @ {
23232316 SwiftSyntax_DIR = (Get-HostProjectCMakeModules Compilers);
23242317 SwiftSystem_DIR = (Get-HostProjectCMakeModules System);
@@ -2361,8 +2354,10 @@ function Build-TestingMacros() {
23612354 }
23622355
23632356 $InstallDir = $null
2357+ $Targets = @ (" default" )
23642358 if (-not $Build ) {
23652359 $InstallDir = " $ ( $Arch.ToolchainInstallRoot ) \usr"
2360+ $Targets = @ ()
23662361 }
23672362
23682363 $SwiftSyntaxCMakeModules = if ($Build -and $HostArch -ne $BuildArch ) {
@@ -2379,7 +2374,7 @@ function Build-TestingMacros() {
23792374 - Platform $Platform `
23802375 - UseBuiltCompilers Swift `
23812376 - SwiftSDK:$SwiftSDK `
2382- - BuildTargets $Targets `
2377+ - BuildTargets: $Targets `
23832378 - Defines @ {
23842379 SwiftSyntax_DIR = $SwiftSyntaxCMakeModules ;
23852380 }
0 commit comments