Skip to content

Commit d200708

Browse files
committed
utils: adjust the StaticFoundation builds on Windows
This is in preparation for the addition of libdispatch to the SDK.
1 parent 3269c06 commit d200708

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

utils/build.ps1

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2507,18 +2507,37 @@ function Build-Foundation {
25072507
Get-ProjectBinaryCache $Platform DynamicFoundation
25082508
}
25092509

2510+
$FoundationImage = if ($Static) {
2511+
"$(Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental")\usr"
2512+
} else {
2513+
"$(Get-SwiftSDK $Platform.OS)\usr"
2514+
}
2515+
2516+
$SwiftSDK = if ($Static) {
2517+
Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental"
2518+
} else {
2519+
Get-SwiftSDK $Platform.OS
2520+
}
2521+
2522+
$SwiftFlags = if ($Static) {
2523+
@("-static-stdlib", "-Xfrontend", "-use-static-resource-dir")
2524+
} else {
2525+
@()
2526+
}
2527+
25102528
Build-CMakeProject `
25112529
-Src $SourceCache\swift-corelibs-foundation `
25122530
-Bin $FoundationBinaryCache `
2513-
-InstallTo $(if ($Static) { "$(Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental")\usr" } else { "$(Get-SwiftSDK $Platform.OS)\usr" }) `
2531+
-InstallTo $FoundationImage `
25142532
-Platform $Platform `
25152533
-UseBuiltCompilers ASM,C,CXX,Swift `
2516-
-SwiftSDK (Get-SwiftSDK $Platform.OS) `
2534+
-SwiftSDK $SwiftSDK `
25172535
-Defines @{
25182536
BUILD_SHARED_LIBS = if ($Static) { "NO" } else { "YES" };
25192537
CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES";
25202538
CMAKE_NINJA_FORCE_RESPONSE_FILE = "YES";
25212539
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
2540+
CMAKE_Swift_FLAGS = $SwiftFlags;
25222541
ENABLE_TESTING = "NO";
25232542
FOUNDATION_BUILD_TOOLS = if ($Platform.OS -eq [OS]::Windows) { "YES" } else { "NO" };
25242543
CURL_DIR = "$BinaryCache\$($Platform.Triple)\usr\lib\cmake\CURL";

0 commit comments

Comments
 (0)