@@ -292,7 +292,8 @@ function Get-TargetProjectBinaryCache($Arch, [TargetComponent]$Project) {
292
292
293
293
enum HostComponent {
294
294
Compilers = 5
295
- System = 10
295
+ FoundationMacros = 10
296
+ System
296
297
ToolsSupportCore
297
298
LLBuild
298
299
Yams
@@ -323,6 +324,7 @@ function Get-HostProjectCMakeModules([HostComponent]$Project) {
323
324
enum BuildComponent {
324
325
BuildTools
325
326
Compilers
327
+ FoundationMacros
326
328
}
327
329
328
330
function Get-BuildProjectBinaryCache ([BuildComponent ]$Project ) {
@@ -1455,10 +1457,58 @@ function Build-Foundation([Platform]$Platform, $Arch, [switch]$Test = $false) {
1455
1457
_SwiftFoundation_SourceDIR = " $SourceCache \swift-foundation" ;
1456
1458
_SwiftFoundationICU_SourceDIR = " $SourceCache \swift-foundation-icu" ;
1457
1459
_SwiftCollections_SourceDIR = " $SourceCache \swift-collections"
1460
+ SwiftFoundation_MACRO = " $ ( Get-BuildProjectBinaryCache FoundationMacros) \bin"
1458
1461
} + $TestingDefines )
1459
1462
}
1460
1463
}
1461
1464
1465
+ function Build-FoundationMacros () {
1466
+ [CmdletBinding (PositionalBinding = $false )]
1467
+ param
1468
+ (
1469
+ [Parameter (Position = 0 , Mandatory = $true )]
1470
+ [Platform ]$Platform ,
1471
+ [Parameter (Position = 1 , Mandatory = $true )]
1472
+ [hashtable ]$Arch ,
1473
+ [switch ] $Build = $false
1474
+ )
1475
+
1476
+ $FoundationMacrosBinaryCache = if ($Build ) {
1477
+ Get-BuildProjectBinaryCache FoundationMacros
1478
+ } else {
1479
+ Get-HostProjectBinaryCache FoundationMacros
1480
+ }
1481
+
1482
+ $SwiftSDK = $null
1483
+ if ($Build ) {
1484
+ $SwiftSDK = $HostArch.SDKInstallRoot
1485
+ }
1486
+
1487
+ $Targets = if ($Build ) {
1488
+ @ (" default" )
1489
+ } else {
1490
+ @ (" default" , " install" )
1491
+ }
1492
+
1493
+ $InstallDir = $null
1494
+ if (-not $Build ) {
1495
+ $InstallDir = " $ ( $Arch.ToolchainInstallRoot ) \usr"
1496
+ }
1497
+
1498
+ Build-CMakeProject `
1499
+ - Src $SourceCache \swift- foundation\Sources\FoundationMacros `
1500
+ - Bin $FoundationMacrosBinaryCache `
1501
+ - InstallTo:$InstallDir `
1502
+ - Arch $Arch `
1503
+ - Platform $Platform `
1504
+ - UseBuiltCompilers Swift `
1505
+ - SwiftSDK:$SwiftSDK `
1506
+ - BuildTargets $Targets `
1507
+ - Defines @ {
1508
+ SwiftSyntax_DIR = (Get-HostProjectCMakeModules Compilers);
1509
+ }
1510
+ }
1511
+
1462
1512
function Build-XCTest ([Platform ]$Platform , $Arch , [switch ]$Test = $false ) {
1463
1513
$DispatchBinaryCache = Get-TargetProjectBinaryCache $Arch Dispatch
1464
1514
$FoundationBinaryCache = Get-TargetProjectBinaryCache $Arch Foundation
@@ -2057,11 +2107,17 @@ if (-not $SkipBuild) {
2057
2107
# Build platform: SDK, Redist and XCTest
2058
2108
Invoke-BuildStep Build-Runtime Windows $Arch
2059
2109
Invoke-BuildStep Build-Dispatch Windows $Arch
2110
+ Invoke-BuildStep Build-FoundationMacros - Build Windows $BuildArch
2060
2111
Invoke-BuildStep Build-Foundation Windows $Arch
2061
2112
Invoke-BuildStep Build-XCTest Windows $Arch
2062
2113
}
2063
2114
}
2064
2115
2116
+ if (-not $SkipBuild ) {
2117
+ # Build Macros for distribution
2118
+ Invoke-BuildStep Build-FoundationMacros Windows $HostArch
2119
+ }
2120
+
2065
2121
if (-not $ToBatch ) {
2066
2122
if ($HostArch -in $WindowsSDKArchs ) {
2067
2123
$RuntimeInstallRoot = [IO.Path ]::Combine((Get-InstallDir $HostArch ), " Runtimes" , $ProductVersion )
0 commit comments