@@ -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 ) {
@@ -1566,22 +1557,12 @@ function Build-CMakeProject {
1566
1557
# TODO(compnerd) remove this once we have the early swift-driver
1567
1558
Add-KeyValueIfNew $Defines CMAKE_Swift_COMPILER_USE_OLD_DRIVER " YES"
1568
1559
1569
- $SwiftFlags = if ($USePinnedCompilers.Contains (" Swift" )) {
1570
- @ (" -sdk" , (Get-PinnedToolchainSDK ))
1571
- } elseif ($SwiftSDK ) {
1572
- @ (
1573
- " -sdk" , $SwiftSDK ,
1574
- " -sysroot" , $AndroidSysroot
1575
- )
1560
+ [string []] $SwiftFlags = @ ()
1561
+
1562
+ $SwiftFlags += if ($SwiftSDK ) {
1563
+ @ (" -sdk" , $SwiftSDK , " -sysroot" , $AndroidSysroot )
1576
1564
} else {
1577
- $RuntimeBinaryCache = Get-ProjectBinaryCache $Platform Runtime
1578
- $SwiftResourceDir = " ${RuntimeBinaryCache} \lib\swift"
1579
-
1580
- @ (
1581
- " -sdk" , $AndroidSysroot ,
1582
- " -resource-dir" , $SwiftResourceDir ,
1583
- " -L" , " $SwiftResourceDir \$ ( $Platform.OS.ToString ().ToLowerInvariant()) "
1584
- )
1565
+ @ ()
1585
1566
}
1586
1567
1587
1568
$SwiftFlags += @ (
@@ -1992,6 +1973,7 @@ function Build-Compilers([Hashtable] $Platform, [string] $Variant) {
1992
1973
- Platform $Platform `
1993
1974
- UseMSVCCompilers C, CXX `
1994
1975
- UsePinnedCompilers Swift `
1976
+ - SwiftSDK (Get-PinnedToolchainSDK ) `
1995
1977
- BuildTargets @ (" install-distribution" ) `
1996
1978
- CacheScript $SourceCache \swift\cmake\caches\Windows- $ ($Platform.Architecture.LLVMName ).cmake `
1997
1979
- Defines (Get-CompilersDefines $Platform $Variant )
@@ -2053,6 +2035,7 @@ function Test-Compilers([Hashtable] $Platform, [string] $Variant, [switch] $Test
2053
2035
- Platform $Platform `
2054
2036
- UseMSVCCompilers C, CXX `
2055
2037
- UsePinnedCompilers Swift `
2038
+ - SwiftSDK (Get-PinnedToolchainSDK ) `
2056
2039
- BuildTargets $Targets `
2057
2040
- CacheScript $SourceCache \swift\cmake\caches\Windows- $ ($Platform.Architecture.LLVMName ).cmake `
2058
2041
- Defines $TestingDefines
@@ -2388,8 +2371,9 @@ function Build-Runtime([Hashtable] $Platform) {
2388
2371
- Bin (Get-ProjectBinaryCache $Platform Runtime) `
2389
2372
- InstallTo " $ ( Get-SwiftSDK $Platform.OS ) \usr" `
2390
2373
- Platform $Platform `
2391
- - CacheScript $SourceCache \swift\cmake\caches\Runtime- $ ($Platform.OS.ToString ())- $ ($Platform.Architecture.LLVMName ).cmake `
2392
2374
- UseBuiltCompilers C, CXX, Swift `
2375
+ - SwiftSDK $null `
2376
+ - CacheScript $SourceCache \swift\cmake\caches\Runtime- $ ($Platform.OS.ToString ())- $ ($Platform.Architecture.LLVMName ).cmake `
2393
2377
- Defines ($PlatformDefines + @ {
2394
2378
CMAKE_Swift_COMPILER_TARGET = (Get-ModuleTriple $Platform );
2395
2379
CMAKE_Swift_COMPILER_WORKS = " YES" ;
@@ -2432,6 +2416,7 @@ function Test-Runtime([Hashtable] $Platform) {
2432
2416
- Bin (Get-ProjectBinaryCache $Platform Runtime) `
2433
2417
- Platform $Platform `
2434
2418
- UseBuiltCompilers C, CXX, Swift `
2419
+ - SwiftSDK $null `
2435
2420
- BuildTargets check- swift- validation- only_non_executable `
2436
2421
- Defines @ {
2437
2422
SWIFT_INCLUDE_TESTS = " YES" ;
@@ -2506,6 +2491,7 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
2506
2491
- InstallTo " ${SDKRoot} \usr" `
2507
2492
- Platform $Platform `
2508
2493
- UseBuiltCompilers C, CXX, Swift `
2494
+ - SwiftSDK $null `
2509
2495
- UseGNUDriver `
2510
2496
- Defines @ {
2511
2497
BUILD_SHARED_LIBS = if ($Static ) { " NO" } else { " YES" };
@@ -2531,6 +2517,7 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
2531
2517
- InstallTo " ${SDKRoot} \usr" `
2532
2518
- Platform $Platform `
2533
2519
- UseBuiltCompilers C, CXX, Swift `
2520
+ - SwiftSDK $null `
2534
2521
- UseGNUDriver `
2535
2522
- Defines @ {
2536
2523
BUILD_SHARED_LIBS = if ($Static ) { " NO" } else { " YES" };
@@ -2547,6 +2534,7 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
2547
2534
- InstallTo " ${SDKRoot} \usr" `
2548
2535
- Platform $Platform `
2549
2536
- UseBuiltCompilers C, Swift `
2537
+ - SwiftSDK $null `
2550
2538
- UseGNUDriver `
2551
2539
- Defines @ {
2552
2540
BUILD_SHARED_LIBS = if ($Static ) { " NO" } else { " YES" };
@@ -2563,6 +2551,7 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
2563
2551
- InstallTo " ${SDKRoot} \usr" `
2564
2552
- Platform $Platform `
2565
2553
- UseBuiltCompilers C, Swift `
2554
+ - SwiftSDK $null `
2566
2555
- UseGNUDriver `
2567
2556
- Defines @ {
2568
2557
BUILD_SHARED_LIBS = if ($Static ) { " NO" } else { " YES" };
@@ -2580,6 +2569,7 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
2580
2569
- InstallTo " ${SDKRoot} \usr" `
2581
2570
- Platform $Platform `
2582
2571
- UseBuiltCompilers C, CXX, Swift `
2572
+ - SwiftSDK $null `
2583
2573
- UseGNUDriver `
2584
2574
- Defines @ {
2585
2575
BUILD_SHARED_LIBS = if ($Static ) { " NO" } else { " YES" };
@@ -2598,6 +2588,7 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
2598
2588
- InstallTo " ${SDKRoot} \usr" `
2599
2589
- Platform $Platform `
2600
2590
- UseBuiltCompilers CXX, Swift `
2591
+ - SwiftSDK $null `
2601
2592
- UseGNUDriver `
2602
2593
- Defines @ {
2603
2594
BUILD_SHARED_LIBS = if ($Static ) { " NO" } else { " YES" };
@@ -2675,8 +2666,8 @@ function Build-Dispatch([Hashtable] $Platform) {
2675
2666
- Bin (Get-ProjectBinaryCache $Platform Dispatch) `
2676
2667
- InstallTo " $ ( Get-SwiftSDK $Platform.OS ) \usr" `
2677
2668
- Platform $Platform `
2678
- - SwiftSDK (Get-SwiftSDK $Platform.OS ) `
2679
2669
- UseBuiltCompilers C, CXX, Swift `
2670
+ - SwiftSDK (Get-SwiftSDK $Platform.OS ) `
2680
2671
- Defines @ {
2681
2672
ENABLE_SWIFT = " YES" ;
2682
2673
}
@@ -2690,9 +2681,9 @@ function Test-Dispatch {
2690
2681
- Src $SourceCache \swift- corelibs- libdispatch `
2691
2682
- Bin (Get-ProjectBinaryCache $BuildPlatform Dispatch) `
2692
2683
- Platform $BuildPlatform `
2684
+ - UseBuiltCompilers C, CXX, Swift `
2693
2685
- SwiftSDK (Get-SwiftSDK $BuildPlatform.OS ) `
2694
2686
- BuildTargets default , ExperimentalTest `
2695
- - UseBuiltCompilers C, CXX, Swift `
2696
2687
- Defines @ {
2697
2688
ENABLE_SWIFT = " YES" ;
2698
2689
}
@@ -2836,14 +2827,19 @@ function Test-XCTest {
2836
2827
Invoke-IsolatingEnvVars {
2837
2828
$env: Path = " $ ( Get-ProjectBinaryCache $BuildPlatform XCTest) ;$ ( Get-ProjectBinaryCache $BuildPlatform DynamicFoundation) \bin;$ ( Get-ProjectBinaryCache $BuildPlatform Dispatch) ;$ ( Get-ProjectBinaryCache $BuildPlatform Runtime) \bin;${env: Path} ;$UnixToolsBinDir "
2838
2829
2830
+ $RuntimeBinaryCache = Get-ProjectBinaryCache $BuildPlatform Runtime
2831
+ $SwiftRuntimeDirectory = " ${RuntimeBinaryCache} \lib\swift"
2832
+
2839
2833
Build-CMakeProject `
2840
2834
- Src $SourceCache \swift- corelibs- xctest `
2841
2835
- Bin (Get-ProjectBinaryCache $BuildPlatform XCTest) `
2842
2836
- Platform $BuildPlatform `
2843
2837
- UseBuiltCompilers Swift `
2838
+ - SwiftSDK $null `
2844
2839
- BuildTargets default , check- xctest `
2845
2840
- Defines @ {
2846
2841
CMAKE_BUILD_WITH_INSTALL_RPATH = " YES" ;
2842
+ CMAKE_Swift_FLAGS = @ (" -resource-dir" , $SwiftRuntimeDirectory , " -vfsoverlay" , " ${RuntimeBinaryCache} \stdlib\windows-vfs-overlay.yaml" );
2847
2843
ENABLE_TESTING = " YES" ;
2848
2844
dispatch_DIR = $ (Get-ProjectCMakeModules $BuildPlatform Dispatch);
2849
2845
Foundation_DIR = $ (Get-ProjectCMakeModules $BuildPlatform DynamicFoundation);
0 commit comments