Skip to content

Commit 9148485

Browse files
authored
Merge pull request swiftlang#83952 from compnerd/SDKROOT
build.ps1: extract SDKROOT for multi-reference use
2 parents 94753e5 + 52f04d0 commit 9148485

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

utils/build.ps1

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2122,7 +2122,7 @@ function Get-CompilersDefines([Hashtable] $Platform, [string] $Variant, [switch]
21222122
SWIFT_ENABLE_VOLATILE = "YES";
21232123
SWIFT_PATH_TO_LIBDISPATCH_SOURCE = "$SourceCache\swift-corelibs-libdispatch";
21242124
SWIFT_PATH_TO_STRING_PROCESSING_SOURCE = "$SourceCache\swift-experimental-string-processing";
2125-
SWIFT_PATH_TO_SWIFT_SDK = (Get-PinnedToolchainSDK);
2125+
SWIFT_PATH_TO_SWIFT_SDK = (Get-PinnedToolchainSDK -OS $Platform.OS);
21262126
SWIFT_PATH_TO_SWIFT_SYNTAX_SOURCE = "$SourceCache\swift-syntax";
21272127
SWIFT_STDLIB_ASSERTIONS = "NO";
21282128
SWIFTSYNTAX_ENABLE_ASSERTIONS = "NO";
@@ -2139,7 +2139,7 @@ function Build-Compilers([Hashtable] $Platform, [string] $Variant) {
21392139
-Platform $Platform `
21402140
-UseMSVCCompilers $(if ($UseHostToolchain) { @("C", "CXX") } else { @("") }) `
21412141
-UsePinnedCompilers $(if ($UseHostToolchain) { @("Swift") } else { @("C", "CXX", "Swift") }) `
2142-
-SwiftSDK (Get-PinnedToolchainSDK) `
2142+
-SwiftSDK (Get-PinnedToolchainSDK -OS $Platform.OS) `
21432143
-BuildTargets @("install-distribution") `
21442144
-CacheScript $SourceCache\swift\cmake\caches\Windows-$($Platform.Architecture.LLVMName).cmake `
21452145
-Defines (Get-CompilersDefines $Platform $Variant)
@@ -2207,7 +2207,7 @@ function Test-Compilers([Hashtable] $Platform, [string] $Variant, [switch] $Test
22072207
-Platform $Platform `
22082208
-UseMSVCCompilers $(if ($UseHostToolchain) { @("C", "CXX") } else { @("") }) `
22092209
-UsePinnedCompilers $(if ($UseHostToolchain) { @("Swift") } else { @("C", "CXX", "Swift") }) `
2210-
-SwiftSDK (Get-PinnedToolchainSDK) `
2210+
-SwiftSDK (Get-PinnedToolchainSDK -OS $Platform.OS) `
22112211
-BuildTargets $Targets `
22122212
-CacheScript $SourceCache\swift\cmake\caches\Windows-$($Platform.Architecture.LLVMName).cmake `
22132213
-Defines $TestingDefines
@@ -3602,6 +3602,7 @@ function Build-LMDB([Hashtable] $Platform) {
36023602
}
36033603

36043604
function Build-IndexStoreDB([Hashtable] $Platform) {
3605+
$SDKROOT = Get-SwiftSDK $Platform.OS
36053606
Build-CMakeProject `
36063607
-Src $SourceCache\indexstore-db `
36073608
-Bin (Get-ProjectBinaryCache $Platform IndexStoreDB) `
@@ -3612,8 +3613,8 @@ function Build-IndexStoreDB([Hashtable] $Platform) {
36123613
-Defines @{
36133614
BUILD_SHARED_LIBS = "NO";
36143615
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
3615-
CMAKE_C_FLAGS = @("-I$(Get-SwiftSDK $Platform.OS)\usr\include", "-I$(Get-SwiftSDK $Platform.OS)\usr\include\Block");
3616-
CMAKE_CXX_FLAGS = @("-I$(Get-SwiftSDK $Platform.OS)\usr\include", "-I$(Get-SwiftSDK $Platform.OS)\usr\include\Block");
3616+
CMAKE_C_FLAGS = @("-I$SDKROOT\usr\include", "-I$SDKROOT\usr\include\Block");
3617+
CMAKE_CXX_FLAGS = @("-I$SDKROOT\usr\include", "-I$SDKROOT\usr\include\Block");
36173618
LMDB_DIR = (Get-ProjectCMakeModules $Platform LMDB);
36183619
}
36193620
}
@@ -3781,6 +3782,8 @@ function Build-Inspect([Hashtable] $Platform) {
37813782
$InstallPath = "$(Get-PlatformRoot $Platform.OS)\Developer\Library\$(Get-ModuleTriple $Platform)"
37823783
}
37833784

3785+
$SDKROOT = Get-SwiftSDK $Platform.OS
3786+
37843787
Build-CMakeProject `
37853788
-Src $SourceCache\swift\tools\swift-inspect `
37863789
-Bin (Get-ProjectBinaryCache $Platform SwiftInspect)`
@@ -3790,10 +3793,10 @@ function Build-Inspect([Hashtable] $Platform) {
37903793
-SwiftSDK (Get-SwiftSDK $Platform.OS) `
37913794
-Defines @{
37923795
CMAKE_Swift_FLAGS = @(
3793-
"-Xcc", "-I$(Get-SwiftSDK $Platform.OS)\usr\include",
3794-
"-Xcc", "-I$(Get-SwiftSDK $Platform.OS)\usr\lib\swift",
3795-
"-Xcc", "-I$(Get-SwiftSDK $Platform.OS)\usr\include\swift\SwiftRemoteMirror",
3796-
"-L$(Get-SwiftSDK $Platform.OS)\usr\lib\swift\$($Platform.OS.ToString())\$($Platform.Architecture.LLVMName)"
3796+
"-Xcc", "-I$SDKROOT\usr\include",
3797+
"-Xcc", "-I$SDKROOT\usr\lib\swift",
3798+
"-Xcc", "-I$SDKROOT\usr\include\swift\SwiftRemoteMirror",
3799+
"-L$SDKROOT\usr\lib\swift\$($Platform.OS.ToString())\$($Platform.Architecture.LLVMName)"
37973800
);
37983801
ArgumentParser_DIR = $ArgumentParserDir;
37993802
}

0 commit comments

Comments
 (0)