Skip to content

Commit 911a0ca

Browse files
committed
utils: build Foundation macros for distribution
This adds a build of the Foundation macros for distribution in the toolchain.
1 parent f4d6eda commit 911a0ca

File tree

1 file changed

+23
-11
lines changed

1 file changed

+23
-11
lines changed

utils/build.ps1

+23-11
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,8 @@ function Get-TargetProjectBinaryCache($Arch, [TargetComponent]$Project) {
395395

396396
enum HostComponent {
397397
Compilers = 5
398-
System = 10
398+
FoundationMacros = 10
399+
System
399400
ToolsSupportCore
400401
LLBuild
401402
Yams
@@ -1664,7 +1665,6 @@ function Build-Foundation([Platform]$Platform, $Arch, [switch]$Test = $false) {
16641665
}
16651666
} else {
16661667
$DispatchBinaryCache = Get-TargetProjectBinaryCache $Arch Dispatch
1667-
$SwiftSyntaxDir = Get-HostProjectCMakeModules Compilers
16681668
$FoundationBinaryCache = Get-TargetProjectBinaryCache $Arch Foundation
16691669
$ShortArch = $Arch.LLVMName
16701670

@@ -1673,12 +1673,6 @@ function Build-Foundation([Platform]$Platform, $Arch, [switch]$Test = $false) {
16731673
$Targets = @("default")
16741674
$InstallPath = "$($Arch.SDKInstallRoot)\usr"
16751675

1676-
if ($Platform -eq "Android") {
1677-
$HostDefines = @{ CMAKE_HOST_Swift_FLAGS = "-sdk `"$($HostArch.SDKInstallRoot)`"" }
1678-
} else {
1679-
$HostDefines = @{}
1680-
}
1681-
16821676
Build-CMakeProject `
16831677
-Src $SourceCache\swift-corelibs-foundation `
16841678
-Bin $FoundationBinaryCache `
@@ -1688,6 +1682,7 @@ function Build-Foundation([Platform]$Platform, $Arch, [switch]$Test = $false) {
16881682
-UseBuiltCompilers ASM,C,CXX,Swift `
16891683
-BuildTargets $Targets `
16901684
-Defines (@{
1685+
CMAKE_HOST_Swift_FLAGS = "-sdk `"$($HostArch.SDKInstallRoot)`"";
16911686
FOUNDATION_BUILD_TOOLS = if ($Platform -eq "Windows") { "YES" } else { "NO" };
16921687
CURL_DIR = "$LibraryRoot\curl-8.5.0\usr\lib\$Platform\$ShortArch\cmake\CURL";
16931688
LIBXML2_LIBRARY = if ($Platform -eq "Windows") {
@@ -1704,15 +1699,29 @@ function Build-Foundation([Platform]$Platform, $Arch, [switch]$Test = $false) {
17041699
};
17051700
ZLIB_INCLUDE_DIR = "$LibraryRoot\zlib-1.3.1\usr\include";
17061701
dispatch_DIR = "$DispatchBinaryCache\cmake\modules";
1707-
SwiftSyntax_DIR = "$SwiftSyntaxDir";
1702+
SwiftSyntax_DIR = (Get-HostProjectCMakeModules Compilers);
17081703
_SwiftFoundation_SourceDIR = "$SourceCache\swift-foundation";
17091704
_SwiftFoundationICU_SourceDIR = "$SourceCache\swift-foundation-icu";
1710-
_SwiftCollections_SourceDIR = "$SourceCache\swift-collections"
1711-
} + $HostDefines + $TestingDefines)
1705+
_SwiftCollections_SourceDIR = "$SourceCache\swift-collections";
1706+
} + $TestingDefines)
17121707
}
17131708
}
17141709
}
17151710

1711+
function Build-FoundationMacros([Platform]$Platform, $Arch) {
1712+
Build-CMakeProject `
1713+
-Src $SourceCache\swift-foundation\Sources\FoundationMacros `
1714+
-Bin (Get-HostProjectBinaryCache FoundationMacros) `
1715+
-InstallTo "$($Arch.ToolchainInstallRoot)\usr" `
1716+
-Arch $Arch `
1717+
-Platform $Platform `
1718+
-UseBuiltCompilers Swift `
1719+
-BuildTargets @("default", "install") `
1720+
-Defines @{
1721+
SwiftSyntax_DIR = (Get-HostProjectCMakeModules Compilers);
1722+
}
1723+
}
1724+
17161725
function Build-XCTest([Platform]$Platform, $Arch, [switch]$Test = $false) {
17171726
$DispatchBinaryCache = Get-TargetProjectBinaryCache $Arch Dispatch
17181727
$FoundationBinaryCache = Get-TargetProjectBinaryCache $Arch Foundation
@@ -2378,6 +2387,9 @@ if (-not $ToBatch) {
23782387
}
23792388

23802389
if (-not $SkipBuild) {
2390+
# Build Macros for distribution
2391+
Invoke-BuildStep Build-FoundationMacros Windows $HostArch
2392+
23812393
Invoke-BuildStep Build-SQLite $HostArch
23822394
Invoke-BuildStep Build-System $HostArch
23832395
Invoke-BuildStep Build-ToolsSupportCore $HostArch

0 commit comments

Comments
 (0)