Skip to content

Commit acd3495

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 bfcc5b6 commit acd3495

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
@@ -843,6 +843,7 @@ enum Project {
843843
RegsGen2
844844
BootstrapFoundationMacros
845845
BootstrapTestingMacros
846+
EarlySwiftDriver
846847

847848
CDispatch
848849
Compilers
@@ -2144,6 +2145,26 @@ function Build-BuildTools([Hashtable] $Platform) {
21442145
}
21452146
}
21462147

2148+
function Build-EarlySwiftDriver {
2149+
Build-CMakeProject `
2150+
-Src $SourceCache\swift-driver `
2151+
-Bin (Get-ProjectBinaryCache $Platform EarlySwiftDriver) `
2152+
-Platform $BuildPlatform `
2153+
-UsePinnedCompilers C,CXX,Swift `
2154+
-SwiftSDK (Get-PinnedToolchainSDK -OS $BuildPlatform.OS -Identifier "$($BuildPlatform.OS)Experimental") `
2155+
-BuildTargets default `
2156+
-Defines @{
2157+
BUILD_SHARED_LIBS = "NO";
2158+
BUILD_TESTING = "NO";
2159+
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
2160+
# TODO(compnerd) - remove `-Xfrontend -use-static-resource-dir` - this is inferred by the `-static-stdlib`.
2161+
CMAKE_Swift_FLAGS = @("-static-stdlib", "-Xfrontend", "-use-static-resource-dir");
2162+
SWIFT_DRIVER_BUILD_TOOLS = "NO";
2163+
SQLite3_INCLUDE_DIR = "$SourceCache\swift-toolchain-sqlite\Sources\CSQLite\include";
2164+
SQLite3_LIBRARY = "$(Get-ProjectBinaryCache $Platform SQLite)\SQLite3.lib";
2165+
}
2166+
}
2167+
21472168
function Write-PList {
21482169
[CmdletBinding(PositionalBinding = $false)]
21492170
param
@@ -4164,6 +4185,8 @@ if (-not $SkipBuild) {
41644185

41654186
Invoke-BuildStep Build-CMark $BuildPlatform
41664187
Invoke-BuildStep Build-BuildTools $BuildPlatform
4188+
Invoke-BuildStep Build-SQLite $BuildPlatform
4189+
Invoke-BuildStep Build-EarlySwiftDriver $BuildPlatform
41674190
if ($IsCrossCompiling) {
41684191
Invoke-BuildStep Build-XML2 $BuildPlatform
41694192
Invoke-BuildStep Build-Compilers $BuildPlatform -Variant "Asserts"

0 commit comments

Comments
 (0)