Skip to content

Commit ebfaf29

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 65e1c52 commit ebfaf29

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
@@ -4009,6 +4030,8 @@ if (-not $SkipBuild) {
40094030

40104031
Invoke-BuildStep Build-CMark $BuildPlatform
40114032
Invoke-BuildStep Build-BuildTools $BuildPlatform
4033+
Invoke-BuildStep Build-SQLite $BuildPlatform
4034+
Invoke-BuildStep Build-EarlySwiftDriver $BuildPlatform
40124035
if ($IsCrossCompiling) {
40134036
Invoke-BuildStep Build-XML2 $BuildPlatform
40144037
Invoke-BuildStep Build-Compilers $BuildPlatform -Variant "Asserts"

0 commit comments

Comments
 (0)