@@ -554,6 +554,7 @@ function Build-CMakeProject {
554
554
[string []] $UseMSVCCompilers = @ (), # C,CXX
555
555
[string []] $UseBuiltCompilers = @ (), # ASM,C,CXX,Swift
556
556
[string []] $UsePinnedCompilers = @ (), # ASM,C,CXX,Swift
557
+ [switch ] $UseSwiftSwiftDriver = $false ,
557
558
[string ] $SwiftSDK = " " ,
558
559
[hashtable ] $Defines = @ {}, # Values are either single strings or arrays of flags
559
560
[string []] $BuildTargets = @ ()
@@ -573,6 +574,19 @@ function Build-CMakeProject {
573
574
Isolate- EnvVars {
574
575
Invoke-VsDevShell $Arch
575
576
577
+ if ($EnableCaching ) {
578
+ $env: SCCACHE_DIRECT = " true"
579
+ $env: SCCACHE_DIR = " $BinaryCache \sccache"
580
+ }
581
+ if ($UseSwiftSwiftDriver ) {
582
+ $env: SWIFT_DRIVER_SWIFT_FRONTEND_EXEC = " $BinaryCache \1\bin\swift-frontend.exe"
583
+ }
584
+
585
+ # TODO(compnerd) workaround swiftc.exe symlink not existing.
586
+ if ($UseSwiftSwiftDriver ) {
587
+ Copy-Item - Force " $BinaryCache \7\bin\swift-driver.exe" " $BinaryCache \7\bin\swiftc.exe" | Out-Null
588
+ }
589
+
576
590
# Add additional defines (unless already present)
577
591
$Defines = $Defines.Clone ()
578
592
@@ -593,11 +607,6 @@ function Build-CMakeProject {
593
607
}
594
608
$CXXFlags = $CFlags.Clone () + " /Zc:__cplusplus"
595
609
596
- if ($EnableCaching ) {
597
- $env: SCCACHE_DIRECT = " true"
598
- $env: SCCACHE_DIR = " $BinaryCache \sccache"
599
- }
600
-
601
610
if ($UseMSVCCompilers.Contains (" C" )) {
602
611
TryAdd- KeyValue $Defines CMAKE_C_COMPILER cl
603
612
if ($EnableCaching ) {
@@ -660,7 +669,9 @@ function Build-CMakeProject {
660
669
if ($UsePinnedCompilers.Contains (" Swift" ) -Or $UseBuiltCompilers.Contains (" Swift" )) {
661
670
$SwiftArgs = @ ()
662
671
663
- if ($UseBuiltCompilers.Contains (" Swift" )) {
672
+ if ($UseSwiftSwiftDriver ) {
673
+ TryAdd- KeyValue $Defines CMAKE_Swift_COMPILER " $BinaryCache \7\bin\swiftc.exe"
674
+ } elseif ($UseBuiltCompilers.Contains (" Swift" )) {
664
675
TryAdd- KeyValue $Defines CMAKE_Swift_COMPILER " $BinaryCache \1\bin\swiftc.exe"
665
676
} else {
666
677
TryAdd- KeyValue $Defines CMAKE_Swift_COMPILER (Join-Path - Path (Get-PinnedToolchainTool ) - ChildPath " swiftc.exe" )
0 commit comments