@@ -926,7 +926,7 @@ function Build-CMakeProject {
926
926
[string ] $Src ,
927
927
[string ] $Bin ,
928
928
[string ] $InstallTo = " " ,
929
- [Platform ] $Platform = " Windows" ,
929
+ [Platform ] $Platform = [ Platform ]:: Windows,
930
930
[hashtable ] $Arch ,
931
931
[string ] $Generator = " Ninja" ,
932
932
[string ] $CacheScript = " " ,
@@ -952,7 +952,7 @@ function Build-CMakeProject {
952
952
# Enter the developer command shell early so we can resolve cmake.exe
953
953
# for version checks.
954
954
Isolate- EnvVars {
955
- if ($Platform -eq " Windows" ) {
955
+ if ($Platform -eq [ Platform ]:: Windows) {
956
956
Invoke-VsDevShell $Arch
957
957
}
958
958
@@ -973,7 +973,7 @@ function Build-CMakeProject {
973
973
# Add additional defines (unless already present)
974
974
$Defines = $Defines.Clone ()
975
975
976
- if (($Platform -ne " Windows" ) -or ($Arch.CMakeName -ne $BuildArch.CMakeName )) {
976
+ if (($Platform -ne [ Platform ]:: Windows) -or ($Arch.CMakeName -ne $BuildArch.CMakeName )) {
977
977
TryAdd- KeyValue $Defines CMAKE_SYSTEM_NAME $Platform
978
978
TryAdd- KeyValue $Defines CMAKE_SYSTEM_PROCESSOR $Arch.CMakeName
979
979
}
@@ -1020,14 +1020,14 @@ function Build-CMakeProject {
1020
1020
}
1021
1021
1022
1022
$CXXFlags = @ ()
1023
- if ($Platform -eq " Windows" ) {
1023
+ if ($Platform -eq [ Platform ]:: Windows) {
1024
1024
$CXXFlags += $CFlags.Clone () + @ (" /Zc:__cplusplus" )
1025
1025
}
1026
1026
1027
1027
if ($UseMSVCCompilers.Contains (" C" ) -Or $UseMSVCCompilers.Contains (" CXX" ) -Or
1028
1028
$UseBuiltCompilers.Contains (" C" ) -Or $UseBuiltCompilers.Contains (" CXX" ) -Or
1029
1029
$UsePinnedCompilers.Contains (" C" ) -Or $UsePinnedCompilers.Contains (" CXX" )) {
1030
- if ($DebugInfo -and $Platform -eq " Windows" ) {
1030
+ if ($DebugInfo -and $Platform -eq [ Platform ]:: Windows) {
1031
1031
Append- FlagsDefine $Defines CMAKE_MSVC_DEBUG_INFORMATION_FORMAT Embedded
1032
1032
Append- FlagsDefine $Defines CMAKE_POLICY_CMP0141 NEW
1033
1033
# Add additional linker flags for generating the debug info.
@@ -1065,7 +1065,7 @@ function Build-CMakeProject {
1065
1065
TryAdd- KeyValue $Defines CMAKE_ASM_COMPILER (Get-PinnedToolchainTool $Driver )
1066
1066
}
1067
1067
Append- FlagsDefine $Defines CMAKE_ASM_FLAGS " --target=$ ( $Arch.LLVMTarget ) "
1068
- if ($Platform -eq " Windows" ) {
1068
+ if ($Platform -eq [ Platform ]:: Windows) {
1069
1069
TryAdd- KeyValue $Defines CMAKE_ASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL " /MD"
1070
1070
}
1071
1071
}
@@ -1078,7 +1078,7 @@ function Build-CMakeProject {
1078
1078
}
1079
1079
TryAdd- KeyValue $Defines CMAKE_C_COMPILER_TARGET $Arch.LLVMTarget
1080
1080
1081
- if (-not (Test-CMakeAtLeast - Major 3 - Minor 26 - Patch 3 ) -and $Platform -eq " Windows" ) {
1081
+ if (-not (Test-CMakeAtLeast - Major 3 - Minor 26 - Patch 3 ) -and $Platform -eq [ Platform ]:: Windows) {
1082
1082
# Workaround for https://github.com/ninja-build/ninja/issues/2280
1083
1083
TryAdd- KeyValue $Defines CMAKE_CL_SHOWINCLUDES_PREFIX " Note: including file: "
1084
1084
}
@@ -1097,7 +1097,7 @@ function Build-CMakeProject {
1097
1097
}
1098
1098
TryAdd- KeyValue $Defines CMAKE_CXX_COMPILER_TARGET $Arch.LLVMTarget
1099
1099
1100
- if (-not (Test-CMakeAtLeast - Major 3 - Minor 26 - Patch 3 ) -and $Platform -eq " Windows" ) {
1100
+ if (-not (Test-CMakeAtLeast - Major 3 - Minor 26 - Patch 3 ) -and $Platform -eq [ Platform ]:: Windows) {
1101
1101
# Workaround for https://github.com/ninja-build/ninja/issues/2280
1102
1102
TryAdd- KeyValue $Defines CMAKE_CL_SHOWINCLUDES_PREFIX " Note: including file: "
1103
1103
}
@@ -1117,7 +1117,7 @@ function Build-CMakeProject {
1117
1117
} else {
1118
1118
TryAdd- KeyValue $Defines CMAKE_Swift_COMPILER (Get-PinnedToolchainTool " swiftc.exe" )
1119
1119
}
1120
- if (-not ( $Platform -eq " Windows" ) ) {
1120
+ if ($Platform -ne [ Platform ]:: Windows) {
1121
1121
TryAdd- KeyValue $Defines CMAKE_Swift_COMPILER_WORKS = " YES"
1122
1122
}
1123
1123
TryAdd- KeyValue $Defines CMAKE_Swift_COMPILER_TARGET $Arch.LLVMTarget.Replace (" $AndroidAPILevel " , " " )
@@ -1166,7 +1166,7 @@ function Build-CMakeProject {
1166
1166
1167
1167
# Debug Information
1168
1168
if ($DebugInfo ) {
1169
- if ($Platform -eq " Windows" ) {
1169
+ if ($Platform -eq [ Platform ]:: Windows) {
1170
1170
if ($SwiftDebugFormat -eq " dwarf" ) {
1171
1171
$SwiftArgs += @ (" -g" , " -Xlinker" , " /DEBUG:DWARF" , " -use-ld=lld-link" )
1172
1172
} else {
@@ -1179,7 +1179,7 @@ function Build-CMakeProject {
1179
1179
$SwiftArgs += " -gnone"
1180
1180
}
1181
1181
1182
- if ($Platform -eq " Windows" ) {
1182
+ if ($Platform -eq [ Platform ]:: Windows) {
1183
1183
$SwiftArgs += @ (" -Xlinker" , " /INCREMENTAL:NO" )
1184
1184
# Swift requires COMDAT folding and de-duplication
1185
1185
$SwiftArgs += @ (" -Xlinker" , " /OPT:REF" )
@@ -1784,9 +1784,9 @@ function Build-CURL([Platform]$Platform, $Arch) {
1784
1784
CURL_USE_LIBSSH2 = " NO" ;
1785
1785
CURL_USE_MBEDTLS = " NO" ;
1786
1786
CURL_USE_OPENSSL = " NO" ;
1787
- CURL_USE_SCHANNEL = if ($Platform -eq " Windows" ) { " YES" } else { " NO" };
1787
+ CURL_USE_SCHANNEL = if ($Platform -eq [ Platform ]:: Windows) { " YES" } else { " NO" };
1788
1788
CURL_USE_WOLFSSL = " NO" ;
1789
- CURL_WINDOWS_SSPI = if ($Platform -eq " Windows" ) { " YES" } else { " NO" };
1789
+ CURL_WINDOWS_SSPI = if ($Platform -eq [ Platform ]:: Windows) { " YES" } else { " NO" };
1790
1790
CURL_ZLIB = " YES" ;
1791
1791
CURL_ZSTD = " NO" ;
1792
1792
ENABLE_ARES = " NO" ;
@@ -1807,8 +1807,8 @@ function Build-CURL([Platform]$Platform, $Arch) {
1807
1807
USE_NGTCP2 = " NO" ;
1808
1808
USE_QUICHE = " NO" ;
1809
1809
USE_OPENSSL_QUIC = " NO" ;
1810
- USE_WIN32_IDN = if ($Platform -eq " Windows" ) { " YES" } else { " NO" };
1811
- USE_WIN32_LARGE_FILES = if ($Platform -eq " Windows" ) { " YES" } else { " NO" };
1810
+ USE_WIN32_IDN = if ($Platform -eq [ Platform ]:: Windows) { " YES" } else { " NO" };
1811
+ USE_WIN32_LARGE_FILES = if ($Platform -eq [ Platform ]:: Windows) { " YES" } else { " NO" };
1812
1812
USE_WIN32_LDAP = " NO" ;
1813
1813
ZLIB_ROOT = " $LibraryRoot \zlib-1.3.1\usr" ;
1814
1814
ZLIB_LIBRARY = " $LibraryRoot \zlib-1.3.1\usr\lib\$Platform \$ArchName \zlibstatic.lib" ;
@@ -1855,7 +1855,7 @@ function Build-Runtime([Platform]$Platform, $Arch) {
1855
1855
SWIFT_NATIVE_SWIFT_TOOLS_PATH = (Join-Path - Path $CompilersBinaryCache - ChildPath " bin" );
1856
1856
SWIFT_PATH_TO_LIBDISPATCH_SOURCE = " $SourceCache \swift-corelibs-libdispatch" ;
1857
1857
SWIFT_PATH_TO_STRING_PROCESSING_SOURCE = " $SourceCache \swift-experimental-string-processing" ;
1858
- CMAKE_SHARED_LINKER_FLAGS = if ($Platform -eq " Windows" ) { @ (" /INCREMENTAL:NO" , " /OPT:REF" , " /OPT:ICF" ) } else { @ () };
1858
+ CMAKE_SHARED_LINKER_FLAGS = if ($Platform -eq [ Platform ]:: Windows) { @ (" /INCREMENTAL:NO" , " /OPT:REF" , " /OPT:ICF" ) } else { @ () };
1859
1859
})
1860
1860
}
1861
1861
@@ -1921,13 +1921,13 @@ function Build-Foundation([Platform]$Platform, $Arch, [switch]$Test = $false) {
1921
1921
$ShortArch = $Arch.LLVMName
1922
1922
1923
1923
Isolate- EnvVars {
1924
- $SDKRoot = if ($Platform -eq " Windows" ) {
1924
+ $SDKRoot = if ($Platform -eq [ Platform ]:: Windows) {
1925
1925
" "
1926
1926
} else {
1927
1927
(Get-Variable " ${Platform} $ ( $Arch.ShortName ) " - ValueOnly).SDKInstallRoot
1928
1928
}
1929
1929
1930
- $SDKRoot = if ($Platform -eq " Windows" ) {
1930
+ $SDKRoot = if ($Platform -eq [ Platform ]:: Windows) {
1931
1931
" "
1932
1932
} else {
1933
1933
(Get-Variable " ${Platform} $ ( $Arch.ShortName ) " - ValueOnly).SDKInstallRoot
@@ -1943,11 +1943,11 @@ function Build-Foundation([Platform]$Platform, $Arch, [switch]$Test = $false) {
1943
1943
- SwiftSDK:$SDKRoot `
1944
1944
- Defines (@ {
1945
1945
ENABLE_TESTING = " NO" ;
1946
- FOUNDATION_BUILD_TOOLS = if ($Platform -eq " Windows" ) { " YES" } else { " NO" };
1946
+ FOUNDATION_BUILD_TOOLS = if ($Platform -eq [ Platform ]:: Windows) { " YES" } else { " NO" };
1947
1947
CMAKE_FIND_PACKAGE_PREFER_CONFIG = " YES" ;
1948
1948
CURL_DIR = " $LibraryRoot \curl-8.9.1\usr\lib\$Platform \$ShortArch \cmake\CURL" ;
1949
1949
LibXml2_DIR = " $LibraryRoot \libxml2-2.11.5\usr\lib\$Platform \$ShortArch \cmake\libxml2-2.11.5" ;
1950
- ZLIB_LIBRARY = if ($Platform -eq " Windows" ) {
1950
+ ZLIB_LIBRARY = if ($Platform -eq [ Platform ]:: Windows) {
1951
1951
" $LibraryRoot \zlib-1.3.1\usr\lib\$Platform \$ShortArch \zlibstatic.lib"
1952
1952
} else {
1953
1953
" $LibraryRoot \zlib-1.3.1\usr\lib\$Platform \$ShortArch \libz.a"
0 commit comments