Skip to content

Commit 42b6556

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 0d699a6 commit 42b6556

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
@@ -4023,6 +4044,8 @@ if (-not $SkipBuild) {
40234044

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

0 commit comments

Comments
 (0)