Skip to content

Commit b72ef8e

Browse files
authored
Merge pull request #84155 from compnerd/simplify
build.ps1: simplify `Build-Foundation`
2 parents dcf0541 + 640db7a commit b72ef8e

File tree

1 file changed

+6
-45
lines changed

1 file changed

+6
-45
lines changed

utils/build.ps1

Lines changed: 6 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2910,58 +2910,19 @@ function Test-Dispatch {
29102910
}
29112911
}
29122912

2913-
function Build-Foundation {
2914-
[CmdletBinding(PositionalBinding = $false)]
2915-
param
2916-
(
2917-
[Parameter(Position = 0, Mandatory = $true)]
2918-
[Hashtable] $Platform,
2919-
[switch] $Static = $false
2920-
)
2921-
2922-
$FoundationBinaryCache = if ($Static) {
2923-
Get-ProjectBinaryCache $Platform ExperimentalStaticFoundation
2924-
} else {
2925-
Get-ProjectBinaryCache $Platform DynamicFoundation
2926-
}
2927-
2928-
$FoundationImage = if ($Static) {
2929-
"$(Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental")\usr"
2930-
} else {
2931-
"$(Get-SwiftSDK $Platform.OS)\usr"
2932-
}
2933-
2934-
$SwiftSDK = if ($Static) {
2935-
Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental"
2936-
} else {
2937-
Get-SwiftSDK $Platform.OS
2938-
}
2939-
2940-
$SwiftFlags = if ($Static) {
2941-
@("-static-stdlib", "-Xfrontend", "-use-static-resource-dir")
2942-
} else {
2943-
@()
2944-
}
2945-
2946-
$DispatchCMakeModules = if ($Static) {
2947-
Get-ProjectCMakeModules $Platform ExperimentalStaticDispatch
2948-
} else {
2949-
Get-ProjectCMakeModules $Platform Dispatch
2950-
}
2951-
2913+
function Build-Foundation([Hashtable] $Platform) {
29522914
Build-CMakeProject `
29532915
-Src $SourceCache\swift-corelibs-foundation `
2954-
-Bin $FoundationBinaryCache `
2955-
-InstallTo $FoundationImage `
2916+
-Bin (Get-ProjectBinaryCache $Platform DynamicFoundation) `
2917+
-InstallTo "$(Get-SwiftSDK $Platform.OS)\usr" `
29562918
-Platform $Platform `
29572919
-UseBuiltCompilers C,CXX,Swift `
2958-
-SwiftSDK $SwiftSDK `
2920+
-SwiftSDK (Get-SwiftSDK $Platform.OS) `
29592921
-Defines @{
2960-
BUILD_SHARED_LIBS = if ($Static) { "NO" } else { "YES" };
2922+
BUILD_SHARED_LIBS = "YES";
29612923
# FIXME(compnerd) - workaround ARM64 build failure when cross-compiling.
29622924
CMAKE_NINJA_FORCE_RESPONSE_FILE = "YES";
29632925
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
2964-
CMAKE_Swift_FLAGS = $SwiftFlags;
29652926
FOUNDATION_BUILD_TOOLS = if ($Platform.OS -eq [OS]::Windows) { "YES" } else { "NO" };
29662927
CURL_DIR = "$BinaryCache\$($Platform.Triple)\usr\lib\cmake\CURL";
29672928
LibXml2_DIR = "$BinaryCache\$($Platform.Triple)\usr\lib\cmake\libxml2-2.11.5";
@@ -2971,7 +2932,7 @@ function Build-Foundation {
29712932
"$BinaryCache\$($Platform.Triple)\usr\lib\libz.a"
29722933
};
29732934
ZLIB_INCLUDE_DIR = "$BinaryCache\$($Platform.Triple)\usr\include";
2974-
dispatch_DIR = $DispatchCMakeModules;
2935+
dispatch_DIR = (Get-ProjectCMakeModules $Platform Dispatch);
29752936
_SwiftFoundation_SourceDIR = "$SourceCache\swift-foundation";
29762937
_SwiftFoundationICU_SourceDIR = "$SourceCache\swift-foundation-icu";
29772938
_SwiftCollections_SourceDIR = "$SourceCache\swift-collections";

0 commit comments

Comments
 (0)