@@ -434,6 +434,7 @@ enum TargetComponent {
434
434
ClangRuntime
435
435
SwiftInspect
436
436
ExperimentalRuntime
437
+ StaticFoundation
437
438
}
438
439
439
440
function Get-TargetProjectBinaryCache ($Arch , [TargetComponent ]$Project ) {
@@ -2149,7 +2150,18 @@ function Build-Dispatch([Platform]$Platform, $Arch, [switch]$Test = $false) {
2149
2150
}
2150
2151
}
2151
2152
2152
- function Build-Foundation ([Platform ]$Platform , $Arch , [switch ]$Test = $false ) {
2153
+ function Build-Foundation {
2154
+ [CmdletBinding (PositionalBinding = $false )]
2155
+ param
2156
+ (
2157
+ [Parameter (Position = 0 , Mandatory = $true )]
2158
+ [Platform ] $Platform ,
2159
+ [Parameter (Position = 1 , Mandatory = $true )]
2160
+ [hashtable ] $Arch ,
2161
+ [switch ] $Static = $false ,
2162
+ [switch ] $Test = $false
2163
+ )
2164
+
2153
2165
if ($Test ) {
2154
2166
# Foundation tests build via swiftpm rather than CMake
2155
2167
$OutDir = Join-Path - Path $HostArch.BinaryCache - ChildPath swift- foundation- tests
@@ -2182,7 +2194,11 @@ function Build-Foundation([Platform]$Platform, $Arch, [switch]$Test = $false) {
2182
2194
}
2183
2195
} else {
2184
2196
$DispatchBinaryCache = Get-TargetProjectBinaryCache $Arch Dispatch
2185
- $FoundationBinaryCache = Get-TargetProjectBinaryCache $Arch DynamicFoundation
2197
+ $FoundationBinaryCache = if ($Static ) {
2198
+ Get-TargetProjectBinaryCache $Arch StaticFoundation
2199
+ } else {
2200
+ Get-TargetProjectBinaryCache $Arch DynamicFoundation
2201
+ }
2186
2202
$ShortArch = $Arch.LLVMName
2187
2203
2188
2204
Isolate- EnvVars {
@@ -2195,12 +2211,13 @@ function Build-Foundation([Platform]$Platform, $Arch, [switch]$Test = $false) {
2195
2211
Build-CMakeProject `
2196
2212
- Src $SourceCache \swift- corelibs- foundation `
2197
2213
- Bin $FoundationBinaryCache `
2198
- - InstallTo " $ ( $Arch.SDKInstallRoot ) \usr" `
2214
+ - InstallTo $ ( if ( $Static ) { " $ ( $Arch.ExperimentalSDKInstallRoot ) \usr " } else { " $ ( $Arch . SDKInstallRoot) \usr" }) `
2199
2215
- Arch $Arch `
2200
2216
- Platform $Platform `
2201
2217
- UseBuiltCompilers ASM, C, CXX, Swift `
2202
2218
- SwiftSDK:$SDKRoot `
2203
2219
- Defines @ {
2220
+ BUILD_SHARED_LIBS = if ($Static ) { " NO" } else { " YES" };
2204
2221
CMAKE_FIND_PACKAGE_PREFER_CONFIG = " YES" ;
2205
2222
CMAKE_NINJA_FORCE_RESPONSE_FILE = " YES" ;
2206
2223
CMAKE_STATIC_LIBRARY_PREFIX_Swift = " lib" ;
@@ -3119,6 +3136,7 @@ if (-not $SkipBuild) {
3119
3136
Invoke-BuildStep Write-PlatformInfoPlist $Arch
3120
3137
3121
3138
Invoke-BuildStep Build-ExperimentalRuntime - Static Windows $Arch
3139
+ Invoke-BuildStep Build-Foundation - Static Windows $Arch
3122
3140
}
3123
3141
3124
3142
foreach ($Arch in $AndroidSDKArchs ) {
@@ -3147,6 +3165,7 @@ if (-not $SkipBuild) {
3147
3165
Invoke-BuildStep Write-PlatformInfoPlist $Arch
3148
3166
3149
3167
Invoke-BuildStep Build-ExperimentalRuntime - Static Android $Arch
3168
+ Invoke-BuildStep Build-Foundation - Static Android $Arch
3150
3169
}
3151
3170
3152
3171
# Build Macros for distribution
0 commit comments