Skip to content

Commit 6fc9386

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 a3f0647 commit 6fc9386

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

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

40624083
Invoke-BuildStep Build-CMark $BuildPlatform
40634084
Invoke-BuildStep Build-BuildTools $BuildPlatform
4085+
Invoke-BuildStep Build-SQLite $BuildPlatform
4086+
Invoke-BuildStep Build-EarlySwiftDriver $BuildPlatform
40644087
if ($IsCrossCompiling) {
40654088
Invoke-BuildStep Build-XML2 $BuildPlatform
40664089
Invoke-BuildStep Build-Compilers $BuildPlatform -Variant "Asserts"

0 commit comments

Comments
 (0)