Skip to content

Commit 96f4c08

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 7e834c3 commit 96f4c08

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
@@ -2126,6 +2127,26 @@ function Build-BuildTools([Hashtable] $Platform) {
21262127
}
21272128
}
21282129

2130+
function Build-EarlySwiftDriver {
2131+
Build-CMakeProject `
2132+
-Src $SourceCache\swift-driver `
2133+
-Bin (Get-ProjectBinaryCache $Platform EarlySwiftDriver) `
2134+
-Platform $BuildPlatform `
2135+
-UsePinnedCompilers C,CXX,Swift `
2136+
-SwiftSDK (Get-PinnedToolchainSDK -OS $BuildPlatform.OS -Identifier "$($BuildPlatform.OS)Experimental") `
2137+
-BuildTargets default `
2138+
-Defines @{
2139+
BUILD_SHARED_LIBS = "NO";
2140+
BUILD_TESTING = "NO";
2141+
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
2142+
# TODO(compnerd) - remove `-Xfrontend -use-static-resource-dir` - this is inferred by the `-static-stdlib`.
2143+
CMAKE_Swift_FLAGS = @("-static-stdlib", "-Xfrontend", "-use-static-resource-dir");
2144+
SWIFT_DRIVER_BUILD_TOOLS = "NO";
2145+
SQLite3_INCLUDE_DIR = "$SourceCache\swift-toolchain-sqlite\Sources\CSQLite\include";
2146+
SQLite3_LIBRARY = "$(Get-ProjectBinaryCache $Platform SQLite)\SQLite3.lib";
2147+
}
2148+
}
2149+
21292150
function Write-PList {
21302151
[CmdletBinding(PositionalBinding = $false)]
21312152
param
@@ -4035,6 +4056,8 @@ if (-not $SkipBuild) {
40354056

40364057
Invoke-BuildStep Build-CMark $BuildPlatform
40374058
Invoke-BuildStep Build-BuildTools $BuildPlatform
4059+
Invoke-BuildStep Build-SQLite $BuildPlatform
4060+
Invoke-BuildStep Build-EarlySwiftDriver $BuildPlatform
40384061
if ($IsCrossCompiling) {
40394062
Invoke-BuildStep Build-XML2 $BuildPlatform
40404063
Invoke-BuildStep Build-Compilers $BuildPlatform -Variant "Asserts"

0 commit comments

Comments
 (0)