Skip to content

Commit b1d1db7

Browse files
committed
build.ps1: compute the proper SDK for building the runtime
Ensure that we properly use the platform information to select the SDK. We had a number of cases where we assumed that the platform was Windows. That no longer holds today as we build for more platforms.
1 parent 663ec93 commit b1d1db7

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

utils/build.ps1

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2681,7 +2681,7 @@ function Test-Dispatch {
26812681
-Src $SourceCache\swift-corelibs-libdispatch `
26822682
-Bin (Get-ProjectBinaryCache $BuildPlatform Dispatch) `
26832683
-Platform $BuildPlatform `
2684-
-SwiftSDK (Get-SwiftSDK Windows) `
2684+
-SwiftSDK (Get-SwiftSDK $BuildPlatform.OS) `
26852685
-BuildTargets default,ExperimentalTest `
26862686
-UseBuiltCompilers C,CXX,Swift `
26872687
-Defines @{
@@ -2770,7 +2770,7 @@ function Test-Foundation {
27702770
-Platform $BuildPlatform
27712771

27722772
Invoke-IsolatingEnvVars {
2773-
$env:DISPATCH_INCLUDE_PATH="$(Get-SwiftSDK Windows)/usr/include"
2773+
$env:DISPATCH_INCLUDE_PATH="$(Get-SwiftSDK $BuildPlatform.OS)/usr/include"
27742774
$env:LIBXML_LIBRARY_PATH="$BinaryCache/$($Platform.Triple)/usr/lib"
27752775
$env:LIBXML_INCLUDE_PATH="$BinaryCache/$($Platform.Triple)/usr/include/libxml2"
27762776
$env:ZLIB_LIBRARY_PATH="$BinaryCache/$($Platform.Triple)/usr/lib"
@@ -2984,7 +2984,7 @@ function Build-System([Hashtable] $Platform) {
29842984
-Bin (Get-ProjectBinaryCache $Platform System) `
29852985
-Platform $Platform `
29862986
-UseBuiltCompilers C,Swift `
2987-
-SwiftSDK (Get-SwiftSDK Windows) `
2987+
-SwiftSDK (Get-SwiftSDK $Platform.OS) `
29882988
-BuildTargets default `
29892989
-Defines @{
29902990
BUILD_SHARED_LIBS = "NO";
@@ -3003,7 +3003,7 @@ function Build-Build([Hashtable] $Platform) {
30033003
-InstallTo "$($Platform.ToolchainInstallRoot)\usr" `
30043004
-Platform $Platform `
30053005
-UseBuiltCompilers C,CXX,Swift `
3006-
-SwiftSDK (Get-SwiftSDK Windows) `
3006+
-SwiftSDK (Get-SwiftSDK $Platform.OS) `
30073007
-Defines (@{
30083008
BUILD_SHARED_LIBS = "YES";
30093009
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
@@ -3024,7 +3024,7 @@ function Build-ToolsSupportCore([Hashtable] $Platform) {
30243024
-InstallTo "$($Platform.ToolchainInstallRoot)\usr" `
30253025
-Platform $Platform `
30263026
-UseBuiltCompilers C,Swift `
3027-
-SwiftSDK (Get-SwiftSDK Windows) `
3027+
-SwiftSDK (Get-SwiftSDK $Platform.OS) `
30283028
-Defines @{
30293029
BUILD_SHARED_LIBS = "YES";
30303030
CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES";
@@ -3043,7 +3043,7 @@ function Build-LLBuild([Hashtable] $Platform) {
30433043
-Platform $Platform `
30443044
-UseMSVCCompilers CXX `
30453045
-UseBuiltCompilers Swift `
3046-
-SwiftSDK (Get-SwiftSDK Windows) `
3046+
-SwiftSDK (Get-SwiftSDK $Platform.OS) `
30473047
-Defines @{
30483048
BUILD_SHARED_LIBS = "YES";
30493049
LLBUILD_SUPPORT_BINDINGS = "Swift";
@@ -3070,7 +3070,7 @@ function Test-LLBuild {
30703070
-Platform $Platform `
30713071
-UseMSVCCompilers CXX `
30723072
-UseBuiltCompilers Swift `
3073-
-SwiftSDK (Get-SwiftSDK Windows) `
3073+
-SwiftSDK (Get-SwiftSDK $BuildPlatform.OS) `
30743074
-BuildTargets default,test-llbuild `
30753075
-Defines = @{
30763076
BUILD_SHARED_LIBS = "YES";
@@ -3090,7 +3090,7 @@ function Build-ArgumentParser([Hashtable] $Platform) {
30903090
-InstallTo "$($Platform.ToolchainInstallRoot)\usr" `
30913091
-Platform $Platform `
30923092
-UseBuiltCompilers Swift `
3093-
-SwiftSDK (Get-SwiftSDK Windows) `
3093+
-SwiftSDK (Get-SwiftSDK $Platform.OS) `
30943094
-Defines @{
30953095
BUILD_SHARED_LIBS = "YES";
30963096
BUILD_TESTING = "NO";
@@ -3105,7 +3105,7 @@ function Build-Driver([Hashtable] $Platform) {
31053105
-InstallTo "$($Platform.ToolchainInstallRoot)\usr" `
31063106
-Platform $Platform `
31073107
-UseBuiltCompilers C,CXX,Swift `
3108-
-SwiftSDK (Get-SwiftSDK Windows) `
3108+
-SwiftSDK (Get-SwiftSDK $Platform.OS) `
31093109
-Defines @{
31103110
BUILD_SHARED_LIBS = "YES";
31113111
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
@@ -3127,7 +3127,7 @@ function Build-Crypto([Hashtable] $Platform) {
31273127
-Bin (Get-ProjectBinaryCache $Platform Crypto) `
31283128
-Platform $Platform `
31293129
-UseBuiltCompilers ASM, C, CXX, Swift `
3130-
-SwiftSDK (Get-SwiftSDK Windows) `
3130+
-SwiftSDK (Get-SwiftSDK $Platform.OS) `
31313131
-BuildTargets default `
31323132
-Defines @{
31333133
BUILD_SHARED_LIBS = "NO";
@@ -3143,7 +3143,7 @@ function Build-Collections([Hashtable] $Platform) {
31433143
-InstallTo "$($Platform.ToolchainInstallRoot)\usr" `
31443144
-Platform $Platform `
31453145
-UseBuiltCompilers C,Swift `
3146-
-SwiftSDK (Get-SwiftSDK Windows) `
3146+
-SwiftSDK (Get-SwiftSDK $Platform.OS) `
31473147
-Defines @{
31483148
BUILD_SHARED_LIBS = "YES";
31493149
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
@@ -3156,7 +3156,7 @@ function Build-ASN1([Hashtable] $Platform) {
31563156
-Bin (Get-ProjectBinaryCache $Platform ASN1) `
31573157
-Platform $Platform `
31583158
-UseBuiltCompilers Swift `
3159-
-SwiftSDK (Get-SwiftSDK Windows) `
3159+
-SwiftSDK (Get-SwiftSDK $Platform.OS) `
31603160
-BuildTargets default `
31613161
-Defines @{
31623162
BUILD_SHARED_LIBS = "NO";
@@ -3170,7 +3170,7 @@ function Build-Certificates([Hashtable] $Platform) {
31703170
-Bin (Get-ProjectBinaryCache $Platform Certificates) `
31713171
-Platform $Platform `
31723172
-UseBuiltCompilers Swift `
3173-
-SwiftSDK (Get-SwiftSDK Windows) `
3173+
-SwiftSDK (Get-SwiftSDK $Platform.OS) `
31743174
-BuildTargets default `
31753175
-Defines @{
31763176
BUILD_SHARED_LIBS = "NO";
@@ -3193,7 +3193,7 @@ function Build-PackageManager([Hashtable] $Platform) {
31933193
-InstallTo "$($Platform.ToolchainInstallRoot)\usr" `
31943194
-Platform $Platform `
31953195
-UseBuiltCompilers C,Swift `
3196-
-SwiftSDK (Get-SwiftSDK Windows) `
3196+
-SwiftSDK (Get-SwiftSDK $Platform.OS) `
31973197
-Defines @{
31983198
BUILD_SHARED_LIBS = "YES";
31993199
CMAKE_Swift_FLAGS = @("-DCRYPTO_v2");
@@ -3221,7 +3221,7 @@ function Build-Markdown([Hashtable] $Platform) {
32213221
-InstallTo "$($Platform.ToolchainInstallRoot)\usr" `
32223222
-Platform $Platform `
32233223
-UseBuiltCompilers C,Swift `
3224-
-SwiftSDK (Get-SwiftSDK Windows) `
3224+
-SwiftSDK (Get-SwiftSDK $Platform.OS) `
32253225
-Defines @{
32263226
BUILD_SHARED_LIBS = "NO";
32273227
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
@@ -3238,7 +3238,7 @@ function Build-Format([Hashtable] $Platform) {
32383238
-Platform $Platform `
32393239
-UseMSVCCompilers C `
32403240
-UseBuiltCompilers Swift `
3241-
-SwiftSDK (Get-SwiftSDK Windows) `
3241+
-SwiftSDK (Get-SwiftSDK $Platform.OS) `
32423242
-Defines @{
32433243
BUILD_SHARED_LIBS = "YES";
32443244
ArgumentParser_DIR = (Get-ProjectCMakeModules $Platform ArgumentParser);
@@ -3301,13 +3301,13 @@ function Build-IndexStoreDB([Hashtable] $Platform) {
33013301
-Bin (Get-ProjectBinaryCache $Platform IndexStoreDB) `
33023302
-Platform $Platform `
33033303
-UseBuiltCompilers C,CXX,Swift `
3304-
-SwiftSDK (Get-SwiftSDK Windows) `
3304+
-SwiftSDK (Get-SwiftSDK $Platform.OS) `
33053305
-BuildTargets default `
33063306
-Defines @{
33073307
BUILD_SHARED_LIBS = "NO";
33083308
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
3309-
CMAKE_C_FLAGS = @("-I$(Get-SwiftSDK Windows)\usr\include", "-I$(Get-SwiftSDK Windows)\usr\include\Block");
3310-
CMAKE_CXX_FLAGS = @("-I$(Get-SwiftSDK Windows)\usr\include", "-I$(Get-SwiftSDK Windows)\usr\include\Block");
3309+
CMAKE_C_FLAGS = @("-I$(Get-SwiftSDK $Platform.OS)\usr\include", "-I$(Get-SwiftSDK $Platform.OS)\usr\include\Block");
3310+
CMAKE_CXX_FLAGS = @("-I$(Get-SwiftSDK $Platform.OS)\usr\include", "-I$(Get-SwiftSDK $Platform.OS)\usr\include\Block");
33113311
LMDB_DIR = (Get-ProjectCMakeModules $Platform LMDB);
33123312
}
33133313
}
@@ -3319,7 +3319,7 @@ function Build-SourceKitLSP([Hashtable] $Platform) {
33193319
-InstallTo "$($Platform.ToolchainInstallRoot)\usr" `
33203320
-Platform $Platform `
33213321
-UseBuiltCompilers C,Swift `
3322-
-SwiftSDK (Get-SwiftSDK Windows) `
3322+
-SwiftSDK (Get-SwiftSDK $Platform.OS) `
33233323
-Defines @{
33243324
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
33253325
SwiftSyntax_DIR = (Get-ProjectCMakeModules $Platform Compilers);

0 commit comments

Comments
 (0)