@@ -292,7 +292,8 @@ function Get-TargetProjectBinaryCache($Arch, [TargetComponent]$Project) {
292292
293293enum HostComponent {
294294 Compilers = 5
295- System = 10
295+ FoundationMacros = 10
296+ System
296297 ToolsSupportCore
297298 LLBuild
298299 Yams
@@ -323,6 +324,7 @@ function Get-HostProjectCMakeModules([HostComponent]$Project) {
323324enum BuildComponent {
324325 BuildTools
325326 Compilers
327+ FoundationMacros
326328}
327329
328330function Get-BuildProjectBinaryCache ([BuildComponent ]$Project ) {
@@ -1455,10 +1457,58 @@ function Build-Foundation([Platform]$Platform, $Arch, [switch]$Test = $false) {
14551457 _SwiftFoundation_SourceDIR = " $SourceCache \swift-foundation" ;
14561458 _SwiftFoundationICU_SourceDIR = " $SourceCache \swift-foundation-icu" ;
14571459 _SwiftCollections_SourceDIR = " $SourceCache \swift-collections"
1460+ SwiftFoundation_MACRO = " $ ( Get-BuildProjectBinaryCache FoundationMacros) \bin"
14581461 } + $TestingDefines )
14591462 }
14601463}
14611464
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+
14621512function Build-XCTest ([Platform ]$Platform , $Arch , [switch ]$Test = $false ) {
14631513 $DispatchBinaryCache = Get-TargetProjectBinaryCache $Arch Dispatch
14641514 $FoundationBinaryCache = Get-TargetProjectBinaryCache $Arch Foundation
@@ -2057,11 +2107,17 @@ if (-not $SkipBuild) {
20572107 # Build platform: SDK, Redist and XCTest
20582108 Invoke-BuildStep Build-Runtime Windows $Arch
20592109 Invoke-BuildStep Build-Dispatch Windows $Arch
2110+ Invoke-BuildStep Build-FoundationMacros - Build Windows $BuildArch
20602111 Invoke-BuildStep Build-Foundation Windows $Arch
20612112 Invoke-BuildStep Build-XCTest Windows $Arch
20622113 }
20632114}
20642115
2116+ if (-not $SkipBuild ) {
2117+ # Build Macros for distribution
2118+ Invoke-BuildStep Build-FoundationMacros Windows $HostArch
2119+ }
2120+
20652121if (-not $ToBatch ) {
20662122 if ($HostArch -in $WindowsSDKArchs ) {
20672123 $RuntimeInstallRoot = [IO.Path ]::Combine((Get-InstallDir $HostArch ), " Runtimes" , $ProductVersion )
0 commit comments