@@ -926,7 +926,7 @@ function Build-CMakeProject {
926926 [string ] $Src ,
927927 [string ] $Bin ,
928928 [string ] $InstallTo = " " ,
929- [Platform ] $Platform = " Windows" ,
929+ [Platform ] $Platform = [ Platform ]:: Windows,
930930 [hashtable ] $Arch ,
931931 [string ] $Generator = " Ninja" ,
932932 [string ] $CacheScript = " " ,
@@ -952,7 +952,7 @@ function Build-CMakeProject {
952952 # Enter the developer command shell early so we can resolve cmake.exe
953953 # for version checks.
954954 Isolate- EnvVars {
955- if ($Platform -eq " Windows" ) {
955+ if ($Platform -eq [ Platform ]:: Windows) {
956956 Invoke-VsDevShell $Arch
957957 }
958958
@@ -973,7 +973,7 @@ function Build-CMakeProject {
973973 # Add additional defines (unless already present)
974974 $Defines = $Defines.Clone ()
975975
976- if (($Platform -ne " Windows" ) -or ($Arch.CMakeName -ne $BuildArch.CMakeName )) {
976+ if (($Platform -ne [ Platform ]:: Windows) -or ($Arch.CMakeName -ne $BuildArch.CMakeName )) {
977977 TryAdd- KeyValue $Defines CMAKE_SYSTEM_NAME $Platform
978978 TryAdd- KeyValue $Defines CMAKE_SYSTEM_PROCESSOR $Arch.CMakeName
979979 }
@@ -1020,14 +1020,14 @@ function Build-CMakeProject {
10201020 }
10211021
10221022 $CXXFlags = @ ()
1023- if ($Platform -eq " Windows" ) {
1023+ if ($Platform -eq [ Platform ]:: Windows) {
10241024 $CXXFlags += $CFlags.Clone () + @ (" /Zc:__cplusplus" )
10251025 }
10261026
10271027 if ($UseMSVCCompilers.Contains (" C" ) -Or $UseMSVCCompilers.Contains (" CXX" ) -Or
10281028 $UseBuiltCompilers.Contains (" C" ) -Or $UseBuiltCompilers.Contains (" CXX" ) -Or
10291029 $UsePinnedCompilers.Contains (" C" ) -Or $UsePinnedCompilers.Contains (" CXX" )) {
1030- if ($DebugInfo -and $Platform -eq " Windows" ) {
1030+ if ($DebugInfo -and $Platform -eq [ Platform ]:: Windows) {
10311031 Append- FlagsDefine $Defines CMAKE_MSVC_DEBUG_INFORMATION_FORMAT Embedded
10321032 Append- FlagsDefine $Defines CMAKE_POLICY_CMP0141 NEW
10331033 # Add additional linker flags for generating the debug info.
@@ -1065,7 +1065,7 @@ function Build-CMakeProject {
10651065 TryAdd- KeyValue $Defines CMAKE_ASM_COMPILER (Get-PinnedToolchainTool $Driver )
10661066 }
10671067 Append- FlagsDefine $Defines CMAKE_ASM_FLAGS " --target=$ ( $Arch.LLVMTarget ) "
1068- if ($Platform -eq " Windows" ) {
1068+ if ($Platform -eq [ Platform ]:: Windows) {
10691069 TryAdd- KeyValue $Defines CMAKE_ASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL " /MD"
10701070 }
10711071 }
@@ -1078,7 +1078,7 @@ function Build-CMakeProject {
10781078 }
10791079 TryAdd- KeyValue $Defines CMAKE_C_COMPILER_TARGET $Arch.LLVMTarget
10801080
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) {
10821082 # Workaround for https://github.com/ninja-build/ninja/issues/2280
10831083 TryAdd- KeyValue $Defines CMAKE_CL_SHOWINCLUDES_PREFIX " Note: including file: "
10841084 }
@@ -1097,7 +1097,7 @@ function Build-CMakeProject {
10971097 }
10981098 TryAdd- KeyValue $Defines CMAKE_CXX_COMPILER_TARGET $Arch.LLVMTarget
10991099
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) {
11011101 # Workaround for https://github.com/ninja-build/ninja/issues/2280
11021102 TryAdd- KeyValue $Defines CMAKE_CL_SHOWINCLUDES_PREFIX " Note: including file: "
11031103 }
@@ -1117,7 +1117,7 @@ function Build-CMakeProject {
11171117 } else {
11181118 TryAdd- KeyValue $Defines CMAKE_Swift_COMPILER (Get-PinnedToolchainTool " swiftc.exe" )
11191119 }
1120- if (-not ( $Platform -eq " Windows" ) ) {
1120+ if ($Platform -ne [ Platform ]:: Windows) {
11211121 TryAdd- KeyValue $Defines CMAKE_Swift_COMPILER_WORKS = " YES"
11221122 }
11231123 TryAdd- KeyValue $Defines CMAKE_Swift_COMPILER_TARGET $Arch.LLVMTarget.Replace (" $AndroidAPILevel " , " " )
@@ -1166,7 +1166,7 @@ function Build-CMakeProject {
11661166
11671167 # Debug Information
11681168 if ($DebugInfo ) {
1169- if ($Platform -eq " Windows" ) {
1169+ if ($Platform -eq [ Platform ]:: Windows) {
11701170 if ($SwiftDebugFormat -eq " dwarf" ) {
11711171 $SwiftArgs += @ (" -g" , " -Xlinker" , " /DEBUG:DWARF" , " -use-ld=lld-link" )
11721172 } else {
@@ -1179,7 +1179,7 @@ function Build-CMakeProject {
11791179 $SwiftArgs += " -gnone"
11801180 }
11811181
1182- if ($Platform -eq " Windows" ) {
1182+ if ($Platform -eq [ Platform ]:: Windows) {
11831183 $SwiftArgs += @ (" -Xlinker" , " /INCREMENTAL:NO" )
11841184 # Swift requires COMDAT folding and de-duplication
11851185 $SwiftArgs += @ (" -Xlinker" , " /OPT:REF" )
@@ -1784,9 +1784,9 @@ function Build-CURL([Platform]$Platform, $Arch) {
17841784 CURL_USE_LIBSSH2 = " NO" ;
17851785 CURL_USE_MBEDTLS = " NO" ;
17861786 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" };
17881788 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" };
17901790 CURL_ZLIB = " YES" ;
17911791 CURL_ZSTD = " NO" ;
17921792 ENABLE_ARES = " NO" ;
@@ -1807,8 +1807,8 @@ function Build-CURL([Platform]$Platform, $Arch) {
18071807 USE_NGTCP2 = " NO" ;
18081808 USE_QUICHE = " NO" ;
18091809 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" };
18121812 USE_WIN32_LDAP = " NO" ;
18131813 ZLIB_ROOT = " $LibraryRoot \zlib-1.3.1\usr" ;
18141814 ZLIB_LIBRARY = " $LibraryRoot \zlib-1.3.1\usr\lib\$Platform \$ArchName \zlibstatic.lib" ;
@@ -1855,7 +1855,7 @@ function Build-Runtime([Platform]$Platform, $Arch) {
18551855 SWIFT_NATIVE_SWIFT_TOOLS_PATH = (Join-Path - Path $CompilersBinaryCache - ChildPath " bin" );
18561856 SWIFT_PATH_TO_LIBDISPATCH_SOURCE = " $SourceCache \swift-corelibs-libdispatch" ;
18571857 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 { @ () };
18591859 })
18601860 }
18611861
@@ -1921,13 +1921,13 @@ function Build-Foundation([Platform]$Platform, $Arch, [switch]$Test = $false) {
19211921 $ShortArch = $Arch.LLVMName
19221922
19231923 Isolate- EnvVars {
1924- $SDKRoot = if ($Platform -eq " Windows" ) {
1924+ $SDKRoot = if ($Platform -eq [ Platform ]:: Windows) {
19251925 " "
19261926 } else {
19271927 (Get-Variable " ${Platform} $ ( $Arch.ShortName ) " - ValueOnly).SDKInstallRoot
19281928 }
19291929
1930- $SDKRoot = if ($Platform -eq " Windows" ) {
1930+ $SDKRoot = if ($Platform -eq [ Platform ]:: Windows) {
19311931 " "
19321932 } else {
19331933 (Get-Variable " ${Platform} $ ( $Arch.ShortName ) " - ValueOnly).SDKInstallRoot
@@ -1943,11 +1943,11 @@ function Build-Foundation([Platform]$Platform, $Arch, [switch]$Test = $false) {
19431943 - SwiftSDK:$SDKRoot `
19441944 - Defines (@ {
19451945 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" };
19471947 CMAKE_FIND_PACKAGE_PREFER_CONFIG = " YES" ;
19481948 CURL_DIR = " $LibraryRoot \curl-8.9.1\usr\lib\$Platform \$ShortArch \cmake\CURL" ;
19491949 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) {
19511951 " $LibraryRoot \zlib-1.3.1\usr\lib\$Platform \$ShortArch \zlibstatic.lib"
19521952 } else {
19531953 " $LibraryRoot \zlib-1.3.1\usr\lib\$Platform \$ShortArch \libz.a"
0 commit comments