Skip to content

Commit 06aa42b

Browse files
authored
Merge pull request #82346 from compnerd/static-foundation-setup
utils: adjust the StaticFoundation builds on Windows
2 parents 5a6a147 + d200708 commit 06aa42b

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
@@ -2506,18 +2506,37 @@ function Build-Foundation {
25062506
Get-ProjectBinaryCache $Platform DynamicFoundation
25072507
}
25082508

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

0 commit comments

Comments
 (0)