Skip to content

Commit 085c34f

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 ef50f0f commit 085c34f

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

utils/build.ps1

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,7 @@ function Invoke-BuildStep {
695695
enum Project {
696696
BuildTools
697697
RegsGen2
698+
EarlySwiftDriver
698699

699700
CDispatch
700701
Compilers
@@ -1915,6 +1916,26 @@ function Build-BuildTools([Hashtable] $Platform) {
19151916
}
19161917
}
19171918

1919+
function Build-EarlySwiftDriver {
1920+
Build-CMakeProject `
1921+
-Src $SourceCache\swift-driver `
1922+
-Bin (Get-ProjectBinaryCache $Platform EarlySwiftDriver) `
1923+
-Platform $BuildPlatform `
1924+
-UsePinnedCompilers C,CXX,Swift `
1925+
-SwiftSDK (Get-PinnedToolchainSDK -OS $BuildPlatform.OS -Identifier "$($BuildPlatform.OS)Experimental") `
1926+
-BuildTargets default `
1927+
-Defines @{
1928+
BUILD_SHARED_LIBS = "NO";
1929+
BUILD_TESTING = "NO";
1930+
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
1931+
# TODO(compnerd) - remove `-Xfrontend -use-static-resource-dir` - this is inferred by the `-static-stdlib`.
1932+
CMAKE_Swift_FLAGS = @("-static-stdlib", "-Xfrontend", "-use-static-resource-dir");
1933+
SWIFT_DRIVER_BUILD_TOOLS = "NO";
1934+
SQLite3_INCLUDE_DIR = "$SourceCache\swift-toolchain-sqlite\Sources\CSQLite\include";
1935+
SQLite3_LIBRARY = "$(Get-ProjectBinaryCache $Platform SQLite)\SQLite3.lib";
1936+
}
1937+
}
1938+
19181939
function Write-PList {
19191940
[CmdletBinding(PositionalBinding = $false)]
19201941
param
@@ -1997,6 +2018,7 @@ function Get-CompilersDefines([Hashtable] $Platform, [string] $Variant, [switch]
19972018
return $TestDefines + $DebugDefines + @{
19982019
CLANG_TABLEGEN = (Join-Path -Path $BuildTools -ChildPath "clang-tblgen.exe");
19992020
CLANG_TIDY_CONFUSABLE_CHARS_GEN = (Join-Path -Path $BuildTools -ChildPath "clang-tidy-confusable-chars-gen.exe");
2021+
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
20002022
CMAKE_Swift_FLAGS = $SwiftFlags;
20012023
LibXml2_DIR = "$BinaryCache\$($Platform.Triple)\usr\lib\cmake\libxml2-2.11.5";
20022024
LLDB_LIBXML2_VERSION = "2.11.5";
@@ -3721,6 +3743,8 @@ if (-not $SkipBuild) {
37213743

37223744
Invoke-BuildStep Build-CMark $BuildPlatform
37233745
Invoke-BuildStep Build-BuildTools $BuildPlatform
3746+
Invoke-BuildStep Build-SQLite $BuildPlatform
3747+
Invoke-BuildStep Build-EarlySwiftDriver $BuildPlatform
37243748
if ($IsCrossCompiling) {
37253749
Invoke-BuildStep Build-XML2 $BuildPlatform
37263750
Invoke-BuildStep Build-Compilers $BuildPlatform -Variant "Asserts"

0 commit comments

Comments
 (0)