Files
skate-3-rust-engine/scripts/Ensure-CMake.ps1
T
Hails 3d485c8dfa Input: SDL3 gamepad backend with XInput fallback
Implements issue #14. A dedicated thread owns SDL3 (3.4.16, statically
linked via sdl3 =0.20.0) and publishes per-slot snapshots re-expressed as
the XInput-shaped XboxState, so the TU3 conversion in skate-core is
unchanged. Conversions are exact for XInput-backed pads (stick Y via
bitwise NOT, trigger round-to-nearest). SKATE3_INPUT=xinput selects the
original transport, which is also the fallback if SDL fails to start.
Optional settings/controller.json maps paddles to XInput buttons.

Build: scripts/Ensure-CMake.ps1 locates CMake (PATH or Visual Studio's
copy) for the SDL source build. sdl3-sys is vendored with a build.rs
patch setting CMAKE_MSVC_RUNTIME_LIBRARY from crt-static, because SDL's
CMake (policy CMP0091) ignores cmake-rs' -MT and the static-CRT release
build failed with unresolved __imp_* symbols.

See docs/hails-additions/03-sdl3-gamepad-input.md and vendor/README.md.
2026-09-30 19:26:50 -06:00

17 lines
840 B
PowerShell

# Locate CMake for the statically linked SDL3 build (sdl3-sys build-from-source).
# CI runners have cmake on PATH; local installs often only have Visual Studio's copy.
$ErrorActionPreference = 'Stop'
if ($env:CMAKE -and (Test-Path -LiteralPath $env:CMAKE)) { return }
if (Get-Command cmake -ErrorAction SilentlyContinue) { return }
$vswhere = Join-Path ${env:ProgramFiles(x86)} 'Microsoft Visual Studio\Installer\vswhere.exe'
if (Test-Path -LiteralPath $vswhere) {
$cmake = & $vswhere -latest -products * -find 'Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe' |
Select-Object -First 1
if ($cmake -and (Test-Path -LiteralPath $cmake)) {
$env:CMAKE = $cmake
return
}
}
throw 'CMake is required to build SDL3. Install CMake, or the "C++ CMake tools for Windows" Visual Studio component.'