@@ -1271,7 +1271,7 @@ function Build-CMakeProject {
1271
1271
[string []] $UsePinnedCompilers = @ (),
1272
1272
[switch ] $AddAndroidCMakeEnv = $false ,
1273
1273
[switch ] $UseGNUDriver = $false ,
1274
- [string ] $SwiftSDK = " " ,
1274
+ [string ] $SwiftSDK = $null ,
1275
1275
[hashtable ] $Defines = @ {}, # Values are either single strings or arrays of flags
1276
1276
[string []] $BuildTargets = @ ()
1277
1277
)
@@ -1448,21 +1448,12 @@ function Build-CMakeProject {
1448
1448
# TODO(compnerd): remove this once we have the early swift-driver
1449
1449
Add-KeyValueIfNew $Defines CMAKE_Swift_COMPILER_USE_OLD_DRIVER " YES"
1450
1450
1451
- $SwiftFlags = if ( $UsePinnedCompilers .Contains ( " Swift " )) {
1452
- @ ( " -sdk " , ( Get-PinnedToolchainSDK ))
1453
- } elseif ($SwiftSDK ) {
1451
+ [ string []] $SwiftFlags = @ ();
1452
+
1453
+ $SwiftFlags += if ($SwiftSDK ) {
1454
1454
@ (" -sdk" , $SwiftSDK )
1455
1455
} else {
1456
- $RuntimeBinaryCache = Get-ProjectBinaryCache $Platform Runtime
1457
- $SwiftResourceDir = " ${RuntimeBinaryCache} \lib\swift"
1458
-
1459
- @ (
1460
- " -vfsoverlay" , " $RuntimeBinaryCache \stdlib\windows-vfs-overlay.yaml" ,
1461
- " -strict-implicit-module-context" ,
1462
- " -Xcc" , " -Xclang" , " -Xcc" , " -fbuiltin-headers-in-system-modules" ,
1463
- " -resource-dir" , $SwiftResourceDir ,
1464
- " -L" , " $SwiftResourceDir \$ ( $Platform.OS.ToString ().ToLowerInvariant()) "
1465
- )
1456
+ @ ()
1466
1457
}
1467
1458
1468
1459
$SwiftFlags += if ($DebugInfo ) {
@@ -1578,22 +1569,12 @@ function Build-CMakeProject {
1578
1569
# TODO(compnerd) remove this once we have the early swift-driver
1579
1570
Add-KeyValueIfNew $Defines CMAKE_Swift_COMPILER_USE_OLD_DRIVER " YES"
1580
1571
1581
- $SwiftFlags = if ($USePinnedCompilers.Contains (" Swift" )) {
1582
- @ (" -sdk" , (Get-PinnedToolchainSDK ))
1583
- } elseif ($SwiftSDK ) {
1584
- @ (
1585
- " -sdk" , $SwiftSDK ,
1586
- " -sysroot" , $AndroidSysroot
1587
- )
1572
+ [string []] $SwiftFlags = @ ()
1573
+
1574
+ $SwiftFlags += if ($SwiftSDK ) {
1575
+ @ (" -sdk" , $SwiftSDK , " -sysroot" , $AndroidSysroot )
1588
1576
} else {
1589
- $RuntimeBinaryCache = Get-ProjectBinaryCache $Platform Runtime
1590
- $SwiftResourceDir = " ${RuntimeBinaryCache} \lib\swift"
1591
-
1592
- @ (
1593
- " -sdk" , $AndroidSysroot ,
1594
- " -resource-dir" , $SwiftResourceDir ,
1595
- " -L" , " $SwiftResourceDir \$ ( $Platform.OS.ToString ().ToLowerInvariant()) "
1596
- )
1577
+ @ ()
1597
1578
}
1598
1579
1599
1580
$SwiftFlags += @ (
@@ -2004,6 +1985,7 @@ function Build-Compilers([Hashtable] $Platform, [string] $Variant) {
2004
1985
- Platform $Platform `
2005
1986
- UseMSVCCompilers C, CXX `
2006
1987
- UsePinnedCompilers Swift `
1988
+ - SwiftSDK (Get-PinnedToolchainSDK ) `
2007
1989
- BuildTargets @ (" install-distribution" ) `
2008
1990
- CacheScript $SourceCache \swift\cmake\caches\Windows- $ ($Platform.Architecture.LLVMName ).cmake `
2009
1991
- Defines (Get-CompilersDefines $Platform $Variant )
@@ -2065,6 +2047,7 @@ function Test-Compilers([Hashtable] $Platform, [string] $Variant, [switch] $Test
2065
2047
- Platform $Platform `
2066
2048
- UseMSVCCompilers C, CXX `
2067
2049
- UsePinnedCompilers Swift `
2050
+ - SwiftSDK (Get-PinnedToolchainSDK ) `
2068
2051
- BuildTargets $Targets `
2069
2052
- CacheScript $SourceCache \swift\cmake\caches\Windows- $ ($Platform.Architecture.LLVMName ).cmake `
2070
2053
- Defines $TestingDefines
@@ -2400,8 +2383,9 @@ function Build-Runtime([Hashtable] $Platform) {
2400
2383
- Bin (Get-ProjectBinaryCache $Platform Runtime) `
2401
2384
- InstallTo " $ ( Get-SwiftSDK $Platform.OS ) \usr" `
2402
2385
- Platform $Platform `
2403
- - CacheScript $SourceCache \swift\cmake\caches\Runtime- $ ($Platform.OS.ToString ())- $ ($Platform.Architecture.LLVMName ).cmake `
2404
2386
- UseBuiltCompilers C, CXX, Swift `
2387
+ - SwiftSDK $null `
2388
+ - CacheScript $SourceCache \swift\cmake\caches\Runtime- $ ($Platform.OS.ToString ())- $ ($Platform.Architecture.LLVMName ).cmake `
2405
2389
- Defines ($PlatformDefines + @ {
2406
2390
CMAKE_Swift_COMPILER_TARGET = (Get-ModuleTriple $Platform );
2407
2391
CMAKE_Swift_COMPILER_WORKS = " YES" ;
@@ -2444,6 +2428,7 @@ function Test-Runtime([Hashtable] $Platform) {
2444
2428
- Bin (Get-ProjectBinaryCache $Platform Runtime) `
2445
2429
- Platform $Platform `
2446
2430
- UseBuiltCompilers C, CXX, Swift `
2431
+ - SwiftSDK $null `
2447
2432
- BuildTargets check- swift- validation- only_non_executable `
2448
2433
- Defines @ {
2449
2434
SWIFT_INCLUDE_TESTS = " YES" ;
@@ -2518,6 +2503,7 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
2518
2503
- InstallTo " ${SDKROOT} \usr" `
2519
2504
- Platform $Platform `
2520
2505
- UseBuiltCompilers C, CXX, Swift `
2506
+ - SwiftSDK $null `
2521
2507
- UseGNUDriver `
2522
2508
- Defines @ {
2523
2509
BUILD_SHARED_LIBS = if ($Static ) { " NO" } else { " YES" };
@@ -2546,6 +2532,7 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
2546
2532
- InstallTo " ${SDKROOT} \usr" `
2547
2533
- Platform $Platform `
2548
2534
- UseBuiltCompilers C, CXX, Swift `
2535
+ - SwiftSDK $null `
2549
2536
- UseGNUDriver `
2550
2537
- Defines @ {
2551
2538
BUILD_SHARED_LIBS = if ($Static ) { " NO" } else { " YES" };
@@ -2564,6 +2551,7 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
2564
2551
- InstallTo " ${SDKROOT} \usr" `
2565
2552
- Platform $Platform `
2566
2553
- UseBuiltCompilers C, Swift `
2554
+ - SwiftSDK $null `
2567
2555
- UseGNUDriver `
2568
2556
- Defines @ {
2569
2557
BUILD_SHARED_LIBS = if ($Static ) { " NO" } else { " YES" };
@@ -2582,6 +2570,7 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
2582
2570
- InstallTo " ${SDKROOT} \usr" `
2583
2571
- Platform $Platform `
2584
2572
- UseBuiltCompilers C, Swift `
2573
+ - SwiftSDK $null `
2585
2574
- UseGNUDriver `
2586
2575
- Defines @ {
2587
2576
BUILD_SHARED_LIBS = if ($Static ) { " NO" } else { " YES" };
@@ -2601,6 +2590,7 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
2601
2590
- InstallTo " ${SDKROOT} \usr" `
2602
2591
- Platform $Platform `
2603
2592
- UseBuiltCompilers C, CXX, Swift `
2593
+ - SwiftSDK $null `
2604
2594
- UseGNUDriver `
2605
2595
- Defines @ {
2606
2596
BUILD_SHARED_LIBS = if ($Static ) { " NO" } else { " YES" };
@@ -2621,6 +2611,7 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
2621
2611
- InstallTo " ${SDKROOT} \usr" `
2622
2612
- Platform $Platform `
2623
2613
- UseBuiltCompilers CXX, Swift `
2614
+ - SwiftSDK $null `
2624
2615
- UseGNUDriver `
2625
2616
- Defines @ {
2626
2617
BUILD_SHARED_LIBS = if ($Static ) { " NO" } else { " YES" };
@@ -2702,8 +2693,8 @@ function Build-Dispatch([Hashtable] $Platform) {
2702
2693
- Bin (Get-ProjectBinaryCache $Platform Dispatch) `
2703
2694
- InstallTo " $ ( Get-SwiftSDK $Platform.OS ) \usr" `
2704
2695
- Platform $Platform `
2705
- - SwiftSDK (Get-SwiftSDK $Platform.OS ) `
2706
2696
- UseBuiltCompilers C, CXX, Swift `
2697
+ - SwiftSDK (Get-SwiftSDK $Platform.OS ) `
2707
2698
- Defines @ {
2708
2699
ENABLE_SWIFT = " YES" ;
2709
2700
}
@@ -2717,9 +2708,9 @@ function Test-Dispatch {
2717
2708
- Src $SourceCache \swift- corelibs- libdispatch `
2718
2709
- Bin (Get-ProjectBinaryCache $BuildPlatform Dispatch) `
2719
2710
- Platform $BuildPlatform `
2711
+ - UseBuiltCompilers C, CXX, Swift `
2720
2712
- SwiftSDK (Get-SwiftSDK $BuildPlatform.OS ) `
2721
2713
- BuildTargets default , ExperimentalTest `
2722
- - UseBuiltCompilers C, CXX, Swift `
2723
2714
- Defines @ {
2724
2715
ENABLE_SWIFT = " YES" ;
2725
2716
}
@@ -2863,14 +2854,19 @@ function Test-XCTest {
2863
2854
Invoke-IsolatingEnvVars {
2864
2855
$env: Path = " $ ( Get-ProjectBinaryCache $BuildPlatform XCTest) ;$ ( Get-ProjectBinaryCache $BuildPlatform DynamicFoundation) \bin;$ ( Get-ProjectBinaryCache $BuildPlatform Dispatch) ;$ ( Get-ProjectBinaryCache $BuildPlatform Runtime) \bin;${env: Path} ;$UnixToolsBinDir "
2865
2856
2857
+ $RuntimeBinaryCache = Get-ProjectBinaryCache $BuildPlatform Runtime
2858
+ $SwiftRuntimeDirectory = " ${RuntimeBinaryCache} \lib\swift"
2859
+
2866
2860
Build-CMakeProject `
2867
2861
- Src $SourceCache \swift- corelibs- xctest `
2868
2862
- Bin (Get-ProjectBinaryCache $BuildPlatform XCTest) `
2869
2863
- Platform $BuildPlatform `
2870
2864
- UseBuiltCompilers Swift `
2865
+ - SwiftSDK $null `
2871
2866
- BuildTargets default , check- xctest `
2872
2867
- Defines @ {
2873
2868
CMAKE_BUILD_WITH_INSTALL_RPATH = " YES" ;
2869
+ CMAKE_Swift_FLAGS = @ (" -resource-dir" , $SwiftRuntimeDirectory , " -vfsoverlay" , " ${RuntimeBinaryCache} \stdlib\windows-vfs-overlay.yaml" );
2874
2870
ENABLE_TESTING = " YES" ;
2875
2871
dispatch_DIR = $ (Get-ProjectCMakeModules $BuildPlatform Dispatch);
2876
2872
Foundation_DIR = $ (Get-ProjectCMakeModules $BuildPlatform DynamicFoundation);
0 commit comments