From e250056b7b9d58c9974e7df8a0ca5874c228d072 Mon Sep 17 00:00:00 2001 From: Johnny D Date: Fri, 18 Sep 2026 17:18:15 -0400 Subject: [PATCH 1/3] Fix Switch2Kit Windows builds selecting incompatible VS 2026 tools --- Tools/build-switch2kit-windows.ps1 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Tools/build-switch2kit-windows.ps1 b/Tools/build-switch2kit-windows.ps1 index ccdf0a453545..1397660abeda 100644 --- a/Tools/build-switch2kit-windows.ps1 +++ b/Tools/build-switch2kit-windows.ps1 @@ -10,8 +10,11 @@ foreach ($tool in @('git', 'cmake', 'ninja', 'swift', 'swiftc')) { } $vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" if (-not (Test-Path $vswhere)) { throw 'Install Visual Studio 2022 Desktop development with C++ and a Windows SDK.' } -$vs = & $vswhere -latest -products '*' -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath -if (-not $vs) { throw 'Visual C++ x64 tools were not found.' } +# Swift 6.2.1 bundles Clang 19. VS 2026's STL requires Clang 20 or newer. +# Select VS 2022 explicitly, including on hosts with both versions installed. +$vs = & $vswhere -latest -version '[17.0,18.0)' -products '*' -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath +if ($LASTEXITCODE -ne 0 -or -not $vs) { throw 'Visual Studio 2022 C++ x64 tools were not found. Install the Desktop development with C++ workload and a Windows SDK; VS 2026 is not compatible with Swift 6.2.1.' } +Write-Host "Using Visual Studio 2022: $vs" cmd /c "`"$vs\Common7\Tools\VsDevCmd.bat`" -arch=x64 -host_arch=x64 >nul && set" | ForEach-Object { if ($_ -match '^([^=]+)=(.*)$') { [Environment]::SetEnvironmentVariable($Matches[1], $Matches[2], 'Process') } } From bf6c2375cad105238684d570914ac72a556c7161 Mon Sep 17 00:00:00 2001 From: Johnny D Date: Fri, 18 Sep 2026 17:19:56 -0400 Subject: [PATCH 2/3] Run pinned Swift 6.2.1 Windows CI on compatible VS 2022 image --- .github/workflows/switch2kit-windows.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/switch2kit-windows.yml b/.github/workflows/switch2kit-windows.yml index fb51cad2de88..ac90e904dd87 100644 --- a/.github/workflows/switch2kit-windows.yml +++ b/.github/workflows/switch2kit-windows.yml @@ -9,7 +9,8 @@ concurrency: cancel-in-progress: true jobs: windows: - runs-on: windows-2025-vs2026 + # Swift 6.2.1 bundles Clang 19; VS 2026 requires Clang 20 for its STL. + runs-on: windows-2022 timeout-minutes: 120 env: VCPKG_MAX_CONCURRENCY: 3 From b1596ec36d8d645eaaab50925702abe3afd6050a Mon Sep 17 00:00:00 2001 From: Johnny D Date: Fri, 18 Sep 2026 17:20:43 -0400 Subject: [PATCH 3/3] Guard Windows Swift/MSVC compatibility without weakening native CI coverage --- Tools/test_switch2kit.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Tools/test_switch2kit.py b/Tools/test_switch2kit.py index 9c6fffece48b..58e80c78bb85 100644 --- a/Tools/test_switch2kit.py +++ b/Tools/test_switch2kit.py @@ -115,6 +115,34 @@ def test_platform_and_backend_configuration(self): self.assertEqual(marker.exists(), accepted, result.stdout + result.stderr) self.assertEqual(result.returncode == 0, accepted, result.stdout + result.stderr) + def test_windows_ci_uses_swift_compatible_runner(self): + workflow = self.read(".github/workflows/switch2kit-windows.yml") + # Swift 6.2.1 uses Clang 19; VS 2026's STL requires Clang 20. + # Keep these pins paired until a newer toolchain is qualified together. + self.assertIn(" runs-on: windows-2022\n", workflow) + self.assertIn("swift-version: swift-6.2.1-release", workflow) + self.assertIn("swift-build: 6.2.1-RELEASE", workflow) + + def test_windows_build_selects_only_visual_studio_2022(self): + script = self.read("Tools/build-switch2kit-windows.ps1") + selection = next(line for line in script.splitlines() + if line.startswith("$vs = & $vswhere ")) + self.assertIn("-version '[17.0,18.0)'", selection) + self.assertIn("-requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64", selection) + self.assertIn("if ($LASTEXITCODE -ne 0 -or -not $vs) { throw", script) + self.assertLess(script.index(selection), script.index("VsDevCmd.bat")) + + def test_windows_fix_keeps_native_build_and_launch_required(self): + script = self.read("Tools/build-switch2kit-windows.ps1") + workflow = self.read(".github/workflows/switch2kit-windows.yml") + self.assertIn("-DENABLE_SWITCH2KIT=ON", script) + self.assertIn("--target dolphin-emu", script) + self.assertIn("Switch2KitC.dll", script) + self.assertIn("./Tools/build-switch2kit-windows.ps1", workflow) + self.assertIn("./Tools/test_switch2kit_windows_launch.ps1", workflow) + self.assertNotIn("continue-on-error", workflow) + self.assertNotIn("_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH", script + workflow) + def test_ordered_lifecycle_and_bundle(self): backend = self.read("Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp") self.assertLess(backend.index("ShutdownSwitch2Kit();"), backend.index("SDL_Quit();"))