Skip to content

Commit 211bf63

Browse files
committed
utils: build early swift-driver on Windows
This prepares the swift-driver building on Windows. By statically linking the runtime and its dependencies, this will allow us to avoid the runtime shuffling that is required to get the runtime required to get the swift-driver working.
1 parent e47c73f commit 211bf63

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

utils/build.ps1

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -837,6 +837,7 @@ enum Project {
837837
RegsGen2
838838
BootstrapFoundationMacros
839839
BootstrapTestingMacros
840+
EarlySwiftDriver
840841

841842
CDispatch
842843
Compilers
@@ -2112,6 +2113,26 @@ function Build-BuildTools([Hashtable] $Platform) {
21122113
}
21132114
}
21142115

2116+
function Build-EarlySwiftDriver {
2117+
Build-CMakeProject `
2118+
-Src $SourceCache\swift-driver `
2119+
-Bin (Get-ProjectBinaryCache $Platform EarlySwiftDriver) `
2120+
-Platform $BuildPlatform `
2121+
-UsePinnedCompilers C,CXX,Swift `
2122+
-SwiftSDK (Get-PinnedToolchainSDK -OS $BuildPlatform.OS -Identifier "$($BuildPlatform.OS)Experimental") `
2123+
-BuildTargets default `
2124+
-Defines @{
2125+
BUILD_SHARED_LIBS = "NO";
2126+
BUILD_TESTING = "NO";
2127+
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
2128+
# TODO(compnerd) - remove `-Xfrontend -use-static-resource-dir` - this is inferred by the `-static-stdlib`.
2129+
CMAKE_Swift_FLAGS = @("-static-stdlib", "-Xfrontend", "-use-static-resource-dir");
2130+
SWIFT_DRIVER_BUILD_TOOLS = "NO";
2131+
SQLite3_INCLUDE_DIR = "$SourceCache\swift-toolchain-sqlite\Sources\CSQLite\include";
2132+
SQLite3_LIBRARY = "$(Get-ProjectBinaryCache $Platform SQLite)\SQLite3.lib";
2133+
}
2134+
}
2135+
21152136
function Write-PList {
21162137
[CmdletBinding(PositionalBinding = $false)]
21172138
param
@@ -4022,6 +4043,8 @@ if (-not $SkipBuild) {
40224043

40234044
Invoke-BuildStep Build-CMark $BuildPlatform
40244045
Invoke-BuildStep Build-BuildTools $BuildPlatform
4046+
Invoke-BuildStep Build-SQLite $BuildPlatform
4047+
Invoke-BuildStep Build-EarlySwiftDriver $BuildPlatform
40254048
if ($IsCrossCompiling) {
40264049
Invoke-BuildStep Build-XML2 $BuildPlatform
40274050
Invoke-BuildStep Build-Compilers $BuildPlatform -Variant "Asserts"

0 commit comments

Comments
 (0)