@@ -2490,18 +2490,37 @@ function Build-Foundation {
2490
2490
Get-ProjectBinaryCache $Platform DynamicFoundation
2491
2491
}
2492
2492
2493
+ $FoundationImage = if ($Static ) {
2494
+ " $ ( Get-SwiftSDK $Platform.OS - Identifier " $ ( $Platform.OS ) Experimental" ) \usr"
2495
+ } else {
2496
+ " $ ( Get-SwiftSDK $Platform.OS ) \usr"
2497
+ }
2498
+
2499
+ $SwiftFlags = if ($Static ) {
2500
+ @ (" -static-stdlib" , " -Xfrontend" , " -use-static-resource-dir" )
2501
+ } else {
2502
+ @ ()
2503
+ }
2504
+
2505
+ $SwiftSDK = if ($Static ) {
2506
+ Get-SwiftSDK $Platform.OS - Identifier " $ ( $Platform.OS ) Experimental"
2507
+ } else {
2508
+ Get-SwiftSDK $Platform.OS
2509
+ }
2510
+
2493
2511
Build-CMakeProject `
2494
2512
- Src $SourceCache \swift- corelibs- foundation `
2495
2513
- Bin $FoundationBinaryCache `
2496
- - InstallTo $ ( if ( $Static ) { " $ ( Get-SwiftSDK $Platform .OS - Identifier " $ ( $Platform .OS ) Experimental " ) \usr " } else { " $ ( Get-SwiftSDK $Platform .OS ) \usr " }) `
2514
+ - InstallTo $FoundationImage `
2497
2515
- Platform $Platform `
2498
2516
- UseBuiltCompilers ASM, C, CXX, Swift `
2499
- - SwiftSDK ( Get-SwiftSDK $Platform .OS ) `
2517
+ - SwiftSDK $SwiftSDK `
2500
2518
- Defines @ {
2501
2519
BUILD_SHARED_LIBS = if ($Static ) { " NO" } else { " YES" };
2502
2520
CMAKE_FIND_PACKAGE_PREFER_CONFIG = " YES" ;
2503
2521
CMAKE_NINJA_FORCE_RESPONSE_FILE = " YES" ;
2504
2522
CMAKE_STATIC_LIBRARY_PREFIX_Swift = " lib" ;
2523
+ CMAKE_Swift_FLAGS = $SwiftFlags ;
2505
2524
ENABLE_TESTING = " NO" ;
2506
2525
FOUNDATION_BUILD_TOOLS = if ($Platform.OS -eq [OS ]::Windows) { " YES" } else { " NO" };
2507
2526
CURL_DIR = " $BinaryCache \$ ( $Platform.Triple ) \usr\lib\cmake\CURL" ;
@@ -3337,7 +3356,6 @@ if (-not $SkipBuild) {
3337
3356
3338
3357
foreach ($Platform in $WindowsSDKPlatforms ) {
3339
3358
Invoke-BuildStep Build-SDK $Platform
3340
- Invoke-BuildStep Build-ExperimentalSDK $Platform
3341
3359
3342
3360
Get-ChildItem " $ ( Get-SwiftSDK Windows) \usr\lib\swift\windows" - Filter " *.lib" - File - ErrorAction Ignore | ForEach-Object {
3343
3361
Write-Host - BackgroundColor DarkRed - ForegroundColor White " $ ( $_.FullName ) is not nested in an architecture directory"
@@ -3347,29 +3365,48 @@ if (-not $SkipBuild) {
3347
3365
Copy-Directory " $ ( Get-SwiftSDK Windows) \usr\bin" " $ ( [IO.Path ]::Combine((Get-InstallDir $Platform ), " Runtimes" , $ProductVersion , " usr" )) "
3348
3366
}
3349
3367
3350
- Write-PlatformInfoPlist Windows
3351
3368
Install-SDK $WindowsSDKPlatforms
3352
3369
Write-SDKSettings Windows
3370
+
3371
+ foreach ($Platform in $WindowsSDKPlatforms ) {
3372
+ Invoke-BuildStep Build-ExperimentalSDK $Platform
3373
+ Get-ChildItem " $ ( Get-SwiftSDK Windows - Identifier WindowsExperimental) \usr\lib\swift_static\windows" - Filter " *.lib" - File - ErrorAction Ignore | ForEach-Object {
3374
+ Write-Host - BackgroundColor DarkRed - ForegroundColor White " $ ( $_.FullName ) is not nested in an architecture directory"
3375
+ Move-Item $_.FullName " $ ( Get-SwiftSDK Windows - Identifier WindowsExperimental) \usr\lib\swift_static\windows\$ ( $Platform.Architecture.LLVMName ) \" | Out-Null
3376
+ }
3377
+ }
3378
+
3353
3379
Install-SDK $WindowsSDKPlatforms - Identifier WindowsExperimental
3354
3380
Write-SDKSettings Windows - Identifier WindowsExperimental
3355
3381
3382
+ Write-PlatformInfoPlist Windows
3383
+
3356
3384
if ($Android ) {
3357
3385
foreach ($Platform in $AndroidSDKPlatforms ) {
3358
3386
Invoke-BuildStep Build-SDK $Platform
3359
- Invoke-BuildStep Build-ExperimentalSDK $Platform
3360
3387
3361
3388
Get-ChildItem " $ ( Get-SwiftSDK Android) \usr\lib\swift\android" - File | Where-Object { $_.Name -match " .a$|.so$" } | ForEach-Object {
3362
3389
Write-Host - BackgroundColor DarkRed - ForegroundColor White " $ ( $_.FullName ) is not nested in an architecture directory"
3363
3390
Move-Item $_.FullName " $ ( Get-SwiftSDK Android) \usr\lib\swift\android\$ ( $Platform.Architecture.LLVMName ) \" | Out-Null
3364
3391
}
3365
3392
}
3366
3393
3367
- Write-PlatformInfoPlist Android
3368
3394
Install-SDK $AndroidSDKPlatforms
3369
3395
Write-SDKSettings Android
3370
- Install-SDK $AndroidSDKPlatforms - Identifiers AndroidExperimental
3396
+
3397
+ foreach ($Platform in $AndroidSDKPlatforms ) {
3398
+ Invoke-BuildStep Build-ExperimentalSDK $Platform
3399
+ Get-ChildItem " $ ( Get-SwiftSDK Android - Identifier AndroidExperimental) \usr\lib\swift_static\android" - File | Where-Object { $_.Name -match " .a$" } | ForEach-Object {
3400
+ Write-Host - BackgroundColor DarkRed - ForegroundColor White " $ ( $_.FullName ) is not nested in an architecture directory"
3401
+ Move-Item $_.FullName " $ ( Get-SwiftSDK Android - Identifier AndroidExperimental) \usr\lib\swift_static\android\$ ( $Platform.Architecture.LLVMName ) \" | Out-Null
3402
+ }
3403
+ }
3404
+
3405
+ Install-SDK $AndroidSDKPlatforms - Identifier AndroidExperimental
3371
3406
Write-SDKSettings Android - Identifier AndroidExperimental
3372
3407
3408
+ Write-PlatformInfoPlist Android
3409
+
3373
3410
# Android swift-inspect only supports 64-bit platforms.
3374
3411
$AndroidSDKPlatforms | Where-Object { @ (" arm64-v8a" , " x86_64" ) -contains $_.Architecture.ABI } | ForEach-Object {
3375
3412
Invoke-BuildStep Build-Inspect $_
0 commit comments