@@ -403,7 +403,8 @@ function Get-TargetProjectBinaryCache($Arch, [TargetComponent]$Project) {
403
403
404
404
enum HostComponent {
405
405
Compilers = 5
406
- System = 10
406
+ FoundationMacros = 10
407
+ System
407
408
ToolsSupportCore
408
409
LLBuild
409
410
Yams
@@ -435,6 +436,7 @@ function Get-HostProjectCMakeModules([HostComponent]$Project) {
435
436
enum BuildComponent {
436
437
BuildTools
437
438
Compilers
439
+ FoundationMacros
438
440
}
439
441
440
442
function Get-BuildProjectBinaryCache ([BuildComponent ]$Project ) {
@@ -1673,7 +1675,6 @@ function Build-Foundation([Platform]$Platform, $Arch, [switch]$Test = $false) {
1673
1675
}
1674
1676
} else {
1675
1677
$DispatchBinaryCache = Get-TargetProjectBinaryCache $Arch Dispatch
1676
- $SwiftSyntaxDir = Get-HostProjectCMakeModules Compilers
1677
1678
$FoundationBinaryCache = Get-TargetProjectBinaryCache $Arch Foundation
1678
1679
$ShortArch = $Arch.LLVMName
1679
1680
@@ -1682,12 +1683,6 @@ function Build-Foundation([Platform]$Platform, $Arch, [switch]$Test = $false) {
1682
1683
$Targets = @ (" default" )
1683
1684
$InstallPath = " $ ( $Arch.SDKInstallRoot ) \usr"
1684
1685
1685
- if ($Platform -eq " Android" ) {
1686
- $HostDefines = @ { CMAKE_HOST_Swift_FLAGS = " -sdk `" $ ( $HostArch.SDKInstallRoot ) `" " }
1687
- } else {
1688
- $HostDefines = @ {}
1689
- }
1690
-
1691
1686
Build-CMakeProject `
1692
1687
- Src $SourceCache \swift- corelibs- foundation `
1693
1688
- Bin $FoundationBinaryCache `
@@ -1713,15 +1708,63 @@ function Build-Foundation([Platform]$Platform, $Arch, [switch]$Test = $false) {
1713
1708
};
1714
1709
ZLIB_INCLUDE_DIR = " $LibraryRoot \zlib-1.3.1\usr\include" ;
1715
1710
dispatch_DIR = " $DispatchBinaryCache \cmake\modules" ;
1716
- SwiftSyntax_DIR = " $SwiftSyntaxDir " ;
1711
+ SwiftSyntax_DIR = ( Get-HostProjectCMakeModules Compilers) ;
1717
1712
_SwiftFoundation_SourceDIR = " $SourceCache \swift-foundation" ;
1718
1713
_SwiftFoundationICU_SourceDIR = " $SourceCache \swift-foundation-icu" ;
1719
- _SwiftCollections_SourceDIR = " $SourceCache \swift-collections"
1720
- } + $HostDefines + $TestingDefines )
1714
+ _SwiftCollections_SourceDIR = " $SourceCache \swift-collections" ;
1715
+ SwiftFoundation_MACRO = " $ ( Get-BuildProjectBinaryCache FoundationMacros) \bin"
1716
+ } + $TestingDefines )
1721
1717
}
1722
1718
}
1723
1719
}
1724
1720
1721
+ function Build-FoundationMacros () {
1722
+ [CmdletBinding (PositionalBinding = $false )]
1723
+ param
1724
+ (
1725
+ [Parameter (Position = 0 , Mandatory = $true )]
1726
+ [Platform ]$Platform ,
1727
+ [Parameter (Position = 1 , Mandatory = $true )]
1728
+ [hashtable ]$Arch ,
1729
+ [switch ] $Build = $false
1730
+ )
1731
+
1732
+ $FoundationMacrosBinaryCache = if ($Build ) {
1733
+ Get-BuildProjectBinaryCache FoundationMacros
1734
+ } else {
1735
+ Get-HostProjectBinaryCache FoundationMacros
1736
+ }
1737
+
1738
+ $SwiftSDK = $null
1739
+ if ($Build ) {
1740
+ $SwiftSDK = $HostArch.SDKInstallRoot
1741
+ }
1742
+
1743
+ $Targets = if ($Build ) {
1744
+ @ (" default" )
1745
+ } else {
1746
+ @ (" default" , " install" )
1747
+ }
1748
+
1749
+ $InstallDir = $null
1750
+ if (-not $Build ) {
1751
+ $InstallDir = " $ ( $Arch.ToolchainInstallRoot ) \usr"
1752
+ }
1753
+
1754
+ Build-CMakeProject `
1755
+ - Src $SourceCache \swift- foundation\Sources\FoundationMacros `
1756
+ - Bin $FoundationMacrosBinaryCache `
1757
+ - InstallTo:$InstallDir `
1758
+ - Arch $Arch `
1759
+ - Platform $Platform `
1760
+ - UseBuiltCompilers Swift `
1761
+ - SwiftSDK:$SwiftSDK `
1762
+ - BuildTargets $Targets `
1763
+ - Defines @ {
1764
+ SwiftSyntax_DIR = (Get-HostProjectCMakeModules Compilers);
1765
+ }
1766
+ }
1767
+
1725
1768
function Build-XCTest ([Platform ]$Platform , $Arch , [switch ]$Test = $false ) {
1726
1769
$DispatchBinaryCache = Get-TargetProjectBinaryCache $Arch Dispatch
1727
1770
$FoundationBinaryCache = Get-TargetProjectBinaryCache $Arch Foundation
@@ -2363,6 +2406,7 @@ if (-not $SkipBuild) {
2363
2406
# Build platform: SDK, Redist and XCTest
2364
2407
Invoke-BuildStep Build-Runtime Windows $Arch
2365
2408
Invoke-BuildStep Build-Dispatch Windows $Arch
2409
+ Invoke-BuildStep Build-FoundationMacros - Build Windows $BuildArch
2366
2410
Invoke-BuildStep Build-Foundation Windows $Arch
2367
2411
Invoke-BuildStep Build-XCTest Windows $Arch
2368
2412
Invoke-BuildStep Build-SwiftTesting Windows $Arch
@@ -2385,6 +2429,11 @@ if (-not $SkipBuild) {
2385
2429
}
2386
2430
}
2387
2431
2432
+ if (-not $SkipBuild ) {
2433
+ # Build Macros for distribution
2434
+ Invoke-BuildStep Build-FoundationMacros Windows $HostArch
2435
+ }
2436
+
2388
2437
if (-not $ToBatch ) {
2389
2438
if ($HostArch -in $WindowsSDKArchs ) {
2390
2439
$RuntimeInstallRoot = [IO.Path ]::Combine((Get-InstallDir $HostArch ), " Runtimes" , $ProductVersion )
0 commit comments