Skip to content

Commit 3054eab

Browse files
committed
Fix cross-compile build failure.
In Build-FoundationMacros, use the build Swift SDK for the build case and when cross-compiling, use the swift syntax build from the build arch binary cache as opposed to the host arch binary cache or else the architecture mismatch will happen.
1 parent 840ed6a commit 3054eab

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

utils/build.ps1

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1752,7 +1752,7 @@ function Build-FoundationMacros() {
17521752

17531753
$SwiftSDK = $null
17541754
if ($Build) {
1755-
$SwiftSDK = $HostArch.SDKInstallRoot
1755+
$SwiftSDK = $BuildArch.SDKInstallRoot
17561756
}
17571757

17581758
$Targets = if ($Build) {
@@ -1766,6 +1766,12 @@ function Build-FoundationMacros() {
17661766
$InstallDir = "$($Arch.ToolchainInstallRoot)\usr"
17671767
}
17681768

1769+
$SwiftSyntaxCMakeModules = if ($Build -and $HostArch -ne $BuildArch) {
1770+
Get-BuildProjectCMakeModules Compilers
1771+
} else {
1772+
Get-HostProjectCMakeModules Compilers
1773+
}
1774+
17691775
Build-CMakeProject `
17701776
-Src $SourceCache\swift-foundation\Sources\FoundationMacros `
17711777
-Bin $FoundationMacrosBinaryCache `
@@ -1776,7 +1782,7 @@ function Build-FoundationMacros() {
17761782
-SwiftSDK:$SwiftSDK `
17771783
-BuildTargets $Targets `
17781784
-Defines @{
1779-
SwiftSyntax_DIR = (Get-HostProjectCMakeModules Compilers);
1785+
SwiftSyntax_DIR = $SwiftSyntaxCMakeModules;
17801786
}
17811787
}
17821788

0 commit comments

Comments
 (0)