@@ -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
}
@@ -1021,14 +1021,14 @@ function Build-CMakeProject {
1021
1021
}
1022
1022
1023
1023
$CXXFlags = @ ()
1024
- if ($Platform -eq " Windows" ) {
1024
+ if ($Platform -eq [ Platform ]:: Windows) {
1025
1025
$CXXFlags += $CFlags.Clone () + @ (" /Zc:__cplusplus" )
1026
1026
}
1027
1027
1028
1028
if ($UseMSVCCompilers.Contains (" C" ) -Or $UseMSVCCompilers.Contains (" CXX" ) -Or
1029
1029
$UseBuiltCompilers.Contains (" C" ) -Or $UseBuiltCompilers.Contains (" CXX" ) -Or
1030
1030
$UsePinnedCompilers.Contains (" C" ) -Or $UsePinnedCompilers.Contains (" CXX" )) {
1031
- if ($DebugInfo -and $Platform -eq " Windows" ) {
1031
+ if ($DebugInfo -and $Platform -eq [ Platform ]:: Windows) {
1032
1032
Append- FlagsDefine $Defines CMAKE_MSVC_DEBUG_INFORMATION_FORMAT Embedded
1033
1033
Append- FlagsDefine $Defines CMAKE_POLICY_CMP0141 NEW
1034
1034
# Add additional linker flags for generating the debug info.
@@ -1066,7 +1066,7 @@ function Build-CMakeProject {
1066
1066
TryAdd- KeyValue $Defines CMAKE_ASM_COMPILER (Get-PinnedToolchainTool $Driver )
1067
1067
}
1068
1068
Append- FlagsDefine $Defines CMAKE_ASM_FLAGS " --target=$ ( $Arch.LLVMTarget ) "
1069
- if ($Platform -eq " Windows" ) {
1069
+ if ($Platform -eq [ Platform ]:: Windows) {
1070
1070
TryAdd- KeyValue $Defines CMAKE_ASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL " /MD"
1071
1071
}
1072
1072
}
@@ -1079,7 +1079,7 @@ function Build-CMakeProject {
1079
1079
}
1080
1080
TryAdd- KeyValue $Defines CMAKE_C_COMPILER_TARGET $Arch.LLVMTarget
1081
1081
1082
- if (-not (Test-CMakeAtLeast - Major 3 - Minor 26 - Patch 3 ) -and $Platform -eq " Windows" ) {
1082
+ if (-not (Test-CMakeAtLeast - Major 3 - Minor 26 - Patch 3 ) -and $Platform -eq [ Platform ]:: Windows) {
1083
1083
# Workaround for https://github.com/ninja-build/ninja/issues/2280
1084
1084
TryAdd- KeyValue $Defines CMAKE_CL_SHOWINCLUDES_PREFIX " Note: including file: "
1085
1085
}
@@ -1098,7 +1098,7 @@ function Build-CMakeProject {
1098
1098
}
1099
1099
TryAdd- KeyValue $Defines CMAKE_CXX_COMPILER_TARGET $Arch.LLVMTarget
1100
1100
1101
- if (-not (Test-CMakeAtLeast - Major 3 - Minor 26 - Patch 3 ) -and $Platform -eq " Windows" ) {
1101
+ if (-not (Test-CMakeAtLeast - Major 3 - Minor 26 - Patch 3 ) -and $Platform -eq [ Platform ]:: Windows) {
1102
1102
# Workaround for https://github.com/ninja-build/ninja/issues/2280
1103
1103
TryAdd- KeyValue $Defines CMAKE_CL_SHOWINCLUDES_PREFIX " Note: including file: "
1104
1104
}
@@ -1118,7 +1118,7 @@ function Build-CMakeProject {
1118
1118
} else {
1119
1119
TryAdd- KeyValue $Defines CMAKE_Swift_COMPILER (Get-PinnedToolchainTool " swiftc.exe" )
1120
1120
}
1121
- if (-not ( $Platform -eq " Windows" ) ) {
1121
+ if ($Platform -ne [ Platform ]:: Windows) {
1122
1122
TryAdd- KeyValue $Defines CMAKE_Swift_COMPILER_WORKS = " YES"
1123
1123
}
1124
1124
TryAdd- KeyValue $Defines CMAKE_Swift_COMPILER_TARGET $Arch.LLVMTarget.Replace (" $AndroidAPILevel " , " " )
@@ -1167,7 +1167,7 @@ function Build-CMakeProject {
1167
1167
1168
1168
# Debug Information
1169
1169
if ($DebugInfo ) {
1170
- if ($Platform -eq " Windows" ) {
1170
+ if ($Platform -eq [ Platform ]:: Windows) {
1171
1171
if ($SwiftDebugFormat -eq " dwarf" ) {
1172
1172
$SwiftArgs += @ (" -g" , " -Xlinker" , " /DEBUG:DWARF" , " -use-ld=lld-link" )
1173
1173
} else {
@@ -1180,7 +1180,7 @@ function Build-CMakeProject {
1180
1180
$SwiftArgs += " -gnone"
1181
1181
}
1182
1182
1183
- if ($Platform -eq " Windows" ) {
1183
+ if ($Platform -eq [ Platform ]:: Windows) {
1184
1184
$SwiftArgs += @ (" -Xlinker" , " /INCREMENTAL:NO" )
1185
1185
# Swift requires COMDAT folding and de-duplication
1186
1186
$SwiftArgs += @ (" -Xlinker" , " /OPT:REF" )
@@ -1781,9 +1781,9 @@ function Build-CURL([Platform]$Platform, $Arch) {
1781
1781
CURL_USE_LIBSSH2 = " NO" ;
1782
1782
CURL_USE_MBEDTLS = " NO" ;
1783
1783
CURL_USE_OPENSSL = " NO" ;
1784
- CURL_USE_SCHANNEL = if ($Platform -eq " Windows" ) { " YES" } else { " NO" };
1784
+ CURL_USE_SCHANNEL = if ($Platform -eq [ Platform ]:: Windows) { " YES" } else { " NO" };
1785
1785
CURL_USE_WOLFSSL = " NO" ;
1786
- CURL_WINDOWS_SSPI = if ($Platform -eq " Windows" ) { " YES" } else { " NO" };
1786
+ CURL_WINDOWS_SSPI = if ($Platform -eq [ Platform ]:: Windows) { " YES" } else { " NO" };
1787
1787
CURL_ZLIB = " YES" ;
1788
1788
CURL_ZSTD = " NO" ;
1789
1789
ENABLE_ARES = " NO" ;
@@ -1804,8 +1804,8 @@ function Build-CURL([Platform]$Platform, $Arch) {
1804
1804
USE_NGTCP2 = " NO" ;
1805
1805
USE_QUICHE = " NO" ;
1806
1806
USE_OPENSSL_QUIC = " NO" ;
1807
- USE_WIN32_IDN = if ($Platform -eq " Windows" ) { " YES" } else { " NO" };
1808
- USE_WIN32_LARGE_FILES = if ($Platform -eq " Windows" ) { " YES" } else { " NO" };
1807
+ USE_WIN32_IDN = if ($Platform -eq [ Platform ]:: Windows) { " YES" } else { " NO" };
1808
+ USE_WIN32_LARGE_FILES = if ($Platform -eq [ Platform ]:: Windows) { " YES" } else { " NO" };
1809
1809
USE_WIN32_LDAP = " NO" ;
1810
1810
ZLIB_ROOT = " $LibraryRoot \zlib-1.3.1\usr" ;
1811
1811
ZLIB_LIBRARY = " $LibraryRoot \zlib-1.3.1\usr\lib\$Platform \$ArchName \zlibstatic.lib" ;
@@ -1852,7 +1852,7 @@ function Build-Runtime([Platform]$Platform, $Arch) {
1852
1852
SWIFT_NATIVE_SWIFT_TOOLS_PATH = (Join-Path - Path $CompilersBinaryCache - ChildPath " bin" );
1853
1853
SWIFT_PATH_TO_LIBDISPATCH_SOURCE = " $SourceCache \swift-corelibs-libdispatch" ;
1854
1854
SWIFT_PATH_TO_STRING_PROCESSING_SOURCE = " $SourceCache \swift-experimental-string-processing" ;
1855
- CMAKE_SHARED_LINKER_FLAGS = if ($Platform -eq " Windows" ) { @ (" /INCREMENTAL:NO" , " /OPT:REF" , " /OPT:ICF" ) } else { @ () };
1855
+ CMAKE_SHARED_LINKER_FLAGS = if ($Platform -eq [ Platform ]:: Windows) { @ (" /INCREMENTAL:NO" , " /OPT:REF" , " /OPT:ICF" ) } else { @ () };
1856
1856
})
1857
1857
}
1858
1858
@@ -1918,13 +1918,13 @@ function Build-Foundation([Platform]$Platform, $Arch, [switch]$Test = $false) {
1918
1918
$ShortArch = $Arch.LLVMName
1919
1919
1920
1920
Isolate- EnvVars {
1921
- $SDKRoot = if ($Platform -eq " Windows" ) {
1921
+ $SDKRoot = if ($Platform -eq [ Platform ]:: Windows) {
1922
1922
" "
1923
1923
} else {
1924
1924
(Get-Variable " ${Platform} $ ( $Arch.ShortName ) " - ValueOnly).SDKInstallRoot
1925
1925
}
1926
1926
1927
- $SDKRoot = if ($Platform -eq " Windows" ) {
1927
+ $SDKRoot = if ($Platform -eq [ Platform ]:: Windows) {
1928
1928
" "
1929
1929
} else {
1930
1930
(Get-Variable " ${Platform} $ ( $Arch.ShortName ) " - ValueOnly).SDKInstallRoot
@@ -1940,16 +1940,16 @@ function Build-Foundation([Platform]$Platform, $Arch, [switch]$Test = $false) {
1940
1940
- SwiftSDK:$SDKRoot `
1941
1941
- Defines (@ {
1942
1942
ENABLE_TESTING = " NO" ;
1943
- FOUNDATION_BUILD_TOOLS = if ($Platform -eq " Windows" ) { " YES" } else { " NO" };
1943
+ FOUNDATION_BUILD_TOOLS = if ($Platform -eq [ Platform ]:: Windows) { " YES" } else { " NO" };
1944
1944
CURL_DIR = " $LibraryRoot \curl-8.9.1\usr\lib\$Platform \$ShortArch \cmake\CURL" ;
1945
- LIBXML2_LIBRARY = if ($Platform -eq " Windows" ) {
1945
+ LIBXML2_LIBRARY = if ($Platform -eq [ Platform ]:: Windows) {
1946
1946
" $LibraryRoot \libxml2-2.11.5\usr\lib\$Platform \$ShortArch \libxml2s.lib" ;
1947
1947
} else {
1948
1948
" $LibraryRoot \libxml2-2.11.5\usr\lib\$Platform \$ShortArch \libxml2.a" ;
1949
1949
};
1950
1950
LIBXML2_INCLUDE_DIR = " $LibraryRoot \libxml2-2.11.5\usr\include\libxml2" ;
1951
1951
LIBXML2_DEFINITIONS = " -DLIBXML_STATIC" ;
1952
- ZLIB_LIBRARY = if ($Platform -eq " Windows" ) {
1952
+ ZLIB_LIBRARY = if ($Platform -eq [ Platform ]:: Windows) {
1953
1953
" $LibraryRoot \zlib-1.3.1\usr\lib\$Platform \$ShortArch \zlibstatic.lib"
1954
1954
} else {
1955
1955
" $LibraryRoot \zlib-1.3.1\usr\lib\$Platform \$ShortArch \libz.a"
0 commit comments