Skip to content

Commit 4214842

Browse files
authored
Merge pull request #76574 from compnerd/early-driver-win
utils: enable early swift driver on Windows
2 parents c7b3b73 + 909748e commit 4214842

File tree

1 file changed

+32
-19
lines changed

1 file changed

+32
-19
lines changed

utils/build.ps1

Lines changed: 32 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -273,14 +273,14 @@ if ($UseHostToolchain -is [string]) {
273273

274274
$DefaultPinned = @{
275275
AMD64 = @{
276-
PinnedBuild = "https://download.swift.org/swift-6.1.2-release/windows10/swift-6.1.2-RELEASE/swift-6.1.2-RELEASE-windows10.exe";
277-
PinnedSHA256 = "92A0323ED7DD333C3B05E6E0E428F3A91C77D159F6CCFC8626A996F2ACE09A0B";
278-
PinnedVersion = "6.1.2";
276+
PinnedBuild = "https://download.swift.org/development/windows10/swift-DEVELOPMENT-SNAPSHOT-2025-11-03-a/swift-DEVELOPMENT-SNAPSHOT-2025-11-03-a-windows10.exe";
277+
PinnedSHA256 = "1B93C9B419070925E5ABCD1A273C510121E9928554876EC0DCA530121D8C93D3";
278+
PinnedVersion = "0.0.0";
279279
};
280280
ARM64 = @{
281-
PinnedBuild = "https://download.swift.org/swift-6.1.2-release/windows10-arm64/swift-6.1.2-RELEASE/swift-6.1.2-RELEASE-windows10-arm64.exe";
282-
PinnedSHA256 = "121FB407E578178F82DCCF39A4D03527873D8F7611A801A8FC26DA52503A0C5C";
283-
PinnedVersion = "6.1.2";
281+
PinnedBuild = "https://download.swift.org/development/windows10-arm64/swift-DEVELOPMENT-SNAPSHOT-2025-11-03-a/swift-DEVELOPMENT-SNAPSHOT-2025-11-03-a-windows10-arm64.exe"
282+
PinnedSHA256 = "";
283+
PinnedVersion = "0.0.0";
284284
};
285285
}
286286

@@ -843,6 +843,7 @@ enum Project {
843843
RegsGen2
844844
BootstrapFoundationMacros
845845
BootstrapTestingMacros
846+
EarlySwiftDriver
846847

847848
CDispatch
848849
Compilers
@@ -1710,9 +1711,6 @@ function Build-CMakeProject {
17101711
Add-KeyValueIfNew $Defines CMAKE_Swift_COMPILER $SWIFTC
17111712
Add-KeyValueIfNew $Defines CMAKE_Swift_COMPILER_TARGET $Platform.Triple
17121713

1713-
# TODO(compnerd): remove this once we have the early swift-driver
1714-
Add-KeyValueIfNew $Defines CMAKE_Swift_COMPILER_USE_OLD_DRIVER "YES"
1715-
17161714
[string[]] $SwiftFlags = @();
17171715

17181716
$SwiftFlags += if ($SwiftSDK) {
@@ -1829,9 +1827,6 @@ function Build-CMakeProject {
18291827
Add-KeyValueIfNew $Defines CMAKE_Swift_COMPILER $SWIFTC
18301828
Add-KeyValueIfNew $Defines CMAKE_Swift_COMPILER_TARGET $Platform.Triple
18311829

1832-
# TODO(compnerd) remove this once we have the early swift-driver
1833-
Add-KeyValueIfNew $Defines CMAKE_Swift_COMPILER_USE_OLD_DRIVER "YES"
1834-
18351830
[string[]] $SwiftFlags = @()
18361831

18371832
$SwiftFlags += if ($SwiftSDK) {
@@ -2145,6 +2140,26 @@ function Build-BuildTools([Hashtable] $Platform) {
21452140
}
21462141
}
21472142

2143+
function Build-EarlySwiftDriver {
2144+
Build-CMakeProject `
2145+
-Src $SourceCache\swift-driver `
2146+
-Bin (Get-ProjectBinaryCache $Platform EarlySwiftDriver) `
2147+
-Platform $BuildPlatform `
2148+
-UsePinnedCompilers C,CXX,Swift `
2149+
-SwiftSDK (Get-PinnedToolchainSDK -OS $BuildPlatform.OS -Identifier "$($BuildPlatform.OS)Experimental") `
2150+
-BuildTargets default `
2151+
-Defines @{
2152+
BUILD_SHARED_LIBS = "NO";
2153+
BUILD_TESTING = "NO";
2154+
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
2155+
# TODO(compnerd) - remove `-Xfrontend -use-static-resource-dir` - this is inferred by the `-static-stdlib`.
2156+
CMAKE_Swift_FLAGS = @("-static-stdlib", "-Xfrontend", "-use-static-resource-dir");
2157+
SWIFT_DRIVER_BUILD_TOOLS = "NO";
2158+
SQLite3_INCLUDE_DIR = "$SourceCache\swift-toolchain-sqlite\Sources\CSQLite\include";
2159+
SQLite3_LIBRARY = "$(Get-ProjectBinaryCache $Platform SQLite)\SQLite3.lib";
2160+
}
2161+
}
2162+
21482163
function Write-PList {
21492164
[CmdletBinding(PositionalBinding = $false)]
21502165
param
@@ -2228,15 +2243,10 @@ function Get-CompilersDefines([Hashtable] $Platform, [string] $Variant, [switch]
22282243
$SwiftFlags += @("-use-ld=lld");
22292244
}
22302245

2231-
$CMakeStaticLibPrefixSwiftDefine = if ((Get-PinnedToolchainVersion) -eq "0.0.0") {
2232-
@{ CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib"; }
2233-
} else {
2234-
@{}
2235-
}
2236-
22372246
return $TestDefines + $DebugDefines + @{
22382247
CLANG_TABLEGEN = (Join-Path -Path $BuildTools -ChildPath "clang-tblgen.exe");
22392248
CLANG_TIDY_CONFUSABLE_CHARS_GEN = (Join-Path -Path $BuildTools -ChildPath "clang-tidy-confusable-chars-gen.exe");
2249+
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
22402250
CMAKE_Swift_FLAGS = $SwiftFlags;
22412251
LibXml2_DIR = "$BinaryCache\$($Platform.Triple)\usr\lib\cmake\libxml2-2.11.5";
22422252
LLDB_LIBXML2_VERSION = "2.11.5";
@@ -2270,6 +2280,7 @@ function Get-CompilersDefines([Hashtable] $Platform, [string] $Variant, [switch]
22702280
SWIFT_TOOLCHAIN_VERSION = "${ToolchainIdentifier}";
22712281
SWIFT_BUILD_SWIFT_SYNTAX = "YES";
22722282
SWIFT_CLANG_LOCATION = (Get-PinnedToolchainToolsDir);
2283+
SWIFT_EARLY_SWIFT_DRIVER_BUILD = "$(Get-ProjectBinaryCache $BuildPlatform EarlySwiftDriver)\bin";
22732284
SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY = "YES";
22742285
SWIFT_ENABLE_EXPERIMENTAL_CXX_INTEROP = "YES";
22752286
SWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING = "YES";
@@ -2285,7 +2296,7 @@ function Get-CompilersDefines([Hashtable] $Platform, [string] $Variant, [switch]
22852296
SWIFT_STDLIB_ASSERTIONS = "NO";
22862297
SWIFTSYNTAX_ENABLE_ASSERTIONS = "NO";
22872298
"cmark-gfm_DIR" = "$($Platform.ToolchainInstallRoot)\usr\lib\cmake";
2288-
} + $CMakeStaticLibPrefixSwiftDefine
2299+
}
22892300
}
22902301

22912302
function Build-Compilers([Hashtable] $Platform, [string] $Variant) {
@@ -4190,6 +4201,8 @@ if (-not $SkipBuild) {
41904201

41914202
Invoke-BuildStep Build-CMark $BuildPlatform
41924203
Invoke-BuildStep Build-BuildTools $BuildPlatform
4204+
Invoke-BuildStep Build-SQLite $BuildPlatform
4205+
Invoke-BuildStep Build-EarlySwiftDriver $BuildPlatform
41934206
if ($IsCrossCompiling) {
41944207
Invoke-BuildStep Build-XML2 $BuildPlatform
41954208
Invoke-BuildStep Build-Compilers $BuildPlatform -Variant "Asserts"

0 commit comments

Comments
 (0)