@@ -395,7 +395,8 @@ function Get-TargetProjectBinaryCache($Arch, [TargetComponent]$Project) {
395
395
396
396
enum HostComponent {
397
397
Compilers = 5
398
- System = 10
398
+ FoundationMacros = 10
399
+ System
399
400
ToolsSupportCore
400
401
LLBuild
401
402
Yams
@@ -426,6 +427,7 @@ function Get-HostProjectCMakeModules([HostComponent]$Project) {
426
427
enum BuildComponent {
427
428
BuildTools
428
429
Compilers
430
+ FoundationMacros
429
431
}
430
432
431
433
function Get-BuildProjectBinaryCache ([BuildComponent ]$Project ) {
@@ -1664,7 +1666,6 @@ function Build-Foundation([Platform]$Platform, $Arch, [switch]$Test = $false) {
1664
1666
}
1665
1667
} else {
1666
1668
$DispatchBinaryCache = Get-TargetProjectBinaryCache $Arch Dispatch
1667
- $SwiftSyntaxDir = Get-HostProjectCMakeModules Compilers
1668
1669
$FoundationBinaryCache = Get-TargetProjectBinaryCache $Arch Foundation
1669
1670
$ShortArch = $Arch.LLVMName
1670
1671
@@ -1673,12 +1674,6 @@ function Build-Foundation([Platform]$Platform, $Arch, [switch]$Test = $false) {
1673
1674
$Targets = @ (" default" )
1674
1675
$InstallPath = " $ ( $Arch.SDKInstallRoot ) \usr"
1675
1676
1676
- if ($Platform -eq " Android" ) {
1677
- $HostDefines = @ { CMAKE_HOST_Swift_FLAGS = " -sdk `" $ ( $HostArch.SDKInstallRoot ) `" " }
1678
- } else {
1679
- $HostDefines = @ {}
1680
- }
1681
-
1682
1677
Build-CMakeProject `
1683
1678
- Src $SourceCache \swift- corelibs- foundation `
1684
1679
- Bin $FoundationBinaryCache `
@@ -1704,15 +1699,63 @@ function Build-Foundation([Platform]$Platform, $Arch, [switch]$Test = $false) {
1704
1699
};
1705
1700
ZLIB_INCLUDE_DIR = " $LibraryRoot \zlib-1.3.1\usr\include" ;
1706
1701
dispatch_DIR = " $DispatchBinaryCache \cmake\modules" ;
1707
- SwiftSyntax_DIR = " $SwiftSyntaxDir " ;
1702
+ SwiftSyntax_DIR = ( Get-HostProjectCMakeModules Compilers) ;
1708
1703
_SwiftFoundation_SourceDIR = " $SourceCache \swift-foundation" ;
1709
1704
_SwiftFoundationICU_SourceDIR = " $SourceCache \swift-foundation-icu" ;
1710
- _SwiftCollections_SourceDIR = " $SourceCache \swift-collections"
1711
- } + $HostDefines + $TestingDefines )
1705
+ _SwiftCollections_SourceDIR = " $SourceCache \swift-collections" ;
1706
+ SwiftFoundation_MACRO = " $ ( Get-BuildProjectBinaryCache FoundationMacros) \bin"
1707
+ } + $TestingDefines )
1712
1708
}
1713
1709
}
1714
1710
}
1715
1711
1712
+ function Build-FoundationMacros () {
1713
+ [CmdletBinding (PositionalBinding = $false )]
1714
+ param
1715
+ (
1716
+ [Parameter (Position = 0 , Mandatory = $true )]
1717
+ [Platform ]$Platform ,
1718
+ [Parameter (Position = 1 , Mandatory = $true )]
1719
+ [hashtable ]$Arch ,
1720
+ [switch ] $Build = $false
1721
+ )
1722
+
1723
+ $FoundationMacrosBinaryCache = if ($Build ) {
1724
+ Get-BuildProjectBinaryCache FoundationMacros
1725
+ } else {
1726
+ Get-HostProjectBinaryCache FoundationMacros
1727
+ }
1728
+
1729
+ $SwiftSDK = $null
1730
+ if ($Build ) {
1731
+ $SwiftSDK = $HostArch.SDKInstallRoot
1732
+ }
1733
+
1734
+ $Targets = if ($Build ) {
1735
+ @ (" default" )
1736
+ } else {
1737
+ @ (" default" , " install" )
1738
+ }
1739
+
1740
+ $InstallDir = $null
1741
+ if (-not $Build ) {
1742
+ $InstallDir = " $ ( $Arch.ToolchainInstallRoot ) \usr"
1743
+ }
1744
+
1745
+ Build-CMakeProject `
1746
+ - Src $SourceCache \swift- foundation\Sources\FoundationMacros `
1747
+ - Bin $FoundationMacrosBinaryCache `
1748
+ - InstallTo:$InstallDir `
1749
+ - Arch $Arch `
1750
+ - Platform $Platform `
1751
+ - UseBuiltCompilers Swift `
1752
+ - SwiftSDK:$SwiftSDK `
1753
+ - BuildTargets $Targets `
1754
+ - Defines @ {
1755
+ SwiftSyntax_DIR = (Get-HostProjectCMakeModules Compilers);
1756
+ }
1757
+ }
1758
+
1716
1759
function Build-XCTest ([Platform ]$Platform , $Arch , [switch ]$Test = $false ) {
1717
1760
$DispatchBinaryCache = Get-TargetProjectBinaryCache $Arch Dispatch
1718
1761
$FoundationBinaryCache = Get-TargetProjectBinaryCache $Arch Foundation
@@ -2341,6 +2384,7 @@ if (-not $SkipBuild) {
2341
2384
# Build platform: SDK, Redist and XCTest
2342
2385
Invoke-BuildStep Build-Runtime Windows $Arch
2343
2386
Invoke-BuildStep Build-Dispatch Windows $Arch
2387
+ Invoke-BuildStep Build-FoundationMacros - Build Windows $BuildArch
2344
2388
Invoke-BuildStep Build-Foundation Windows $Arch
2345
2389
Invoke-BuildStep Build-XCTest Windows $Arch
2346
2390
}
@@ -2359,6 +2403,11 @@ if (-not $SkipBuild) {
2359
2403
}
2360
2404
}
2361
2405
2406
+ if (-not $SkipBuild ) {
2407
+ # Build Macros for distribution
2408
+ Invoke-BuildStep Build-FoundationMacros Windows $HostArch
2409
+ }
2410
+
2362
2411
if (-not $ToBatch ) {
2363
2412
if ($HostArch -in $WindowsSDKArchs ) {
2364
2413
$RuntimeInstallRoot = [IO.Path ]::Combine((Get-InstallDir $HostArch ), " Runtimes" , $ProductVersion )
0 commit comments