Skip to content

Commit 573a019

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 337892d commit 573a019

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
@@ -845,6 +845,7 @@ enum Project {
845845
RegsGen2
846846
BootstrapFoundationMacros
847847
BootstrapTestingMacros
848+
EarlySwiftDriver
848849

849850
CDispatch
850851
Compilers
@@ -2151,6 +2152,26 @@ function Build-BuildTools([Hashtable] $Platform) {
21512152
}
21522153
}
21532154

2155+
function Build-EarlySwiftDriver {
2156+
Build-CMakeProject `
2157+
-Src $SourceCache\swift-driver `
2158+
-Bin (Get-ProjectBinaryCache $Platform EarlySwiftDriver) `
2159+
-Platform $BuildPlatform `
2160+
-UsePinnedCompilers C,CXX,Swift `
2161+
-SwiftSDK (Get-PinnedToolchainSDK -OS $BuildPlatform.OS -Identifier "$($BuildPlatform.OS)Experimental") `
2162+
-BuildTargets default `
2163+
-Defines @{
2164+
BUILD_SHARED_LIBS = "NO";
2165+
BUILD_TESTING = "NO";
2166+
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
2167+
# TODO(compnerd) - remove `-Xfrontend -use-static-resource-dir` - this is inferred by the `-static-stdlib`.
2168+
CMAKE_Swift_FLAGS = @("-static-stdlib", "-Xfrontend", "-use-static-resource-dir");
2169+
SWIFT_DRIVER_BUILD_TOOLS = "NO";
2170+
SQLite3_INCLUDE_DIR = "$SourceCache\swift-toolchain-sqlite\Sources\CSQLite\include";
2171+
SQLite3_LIBRARY = "$(Get-ProjectBinaryCache $Platform SQLite)\SQLite3.lib";
2172+
}
2173+
}
2174+
21542175
function Write-PList {
21552176
[CmdletBinding(PositionalBinding = $false)]
21562177
param
@@ -4085,6 +4106,8 @@ if (-not $SkipBuild) {
40854106

40864107
Invoke-BuildStep Build-CMark $BuildPlatform
40874108
Invoke-BuildStep Build-BuildTools $BuildPlatform
4109+
Invoke-BuildStep Build-SQLite $BuildPlatform
4110+
Invoke-BuildStep Build-EarlySwiftDriver $BuildPlatform
40884111
if ($IsCrossCompiling) {
40894112
Invoke-BuildStep Build-XML2 $BuildPlatform
40904113
Invoke-BuildStep Build-Compilers $BuildPlatform -Variant "Asserts"

0 commit comments

Comments
 (0)