build: hardcode VS2022 toolchain in CMake presets #1519

Closed
github-bot wants to merge 4 commits from gh-pr/1519/head into gh-pr/1519/base
Owner

@⁠KelboLive on GitHub · 2026-11-24 13:30 UTC · original
KelboLive:work/pr4-negative-controls → main · +0 −0 · 0 files · 0 commits · closed without merging


This change hardcodes VS2022 toolchain paths (INCLUDE, LIB, PATH, CMAKE_LINKER) in the dev and release CMake presets so CMake locates the correct compiler toolchain without depending on the calling shell's environment variables.

Files changed: CMakePresets.json

Test command

  • cmake --preset dev
  • cmake --build --preset dev
  • ctest --preset dev --no-tests=error -R 'desktop_root_signature'

Expected result: All configured and build steps locate vsdevcmd.bat automatically. The toolchain environment is applied regardless of how the terminal was started.

Observed result: Build proceeds successfully with the VS2022 toolchain paths set at preset level.

Environment: x64 Windows, Visual Studio 2022 Desktop development with C++ workload (x64 MSVC, C++ CMake tools, Ninja, Windows SDK). No external shell modifications needed before invoking cmake --preset dev.

Risk assessment: Low-risk build-infra change. Only affects CMake integration; no game code or runtime behavior changes.


Refs #4

**@⁠KelboLive** on GitHub · 2026-11-24 13:30 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1519) `KelboLive:work/pr4-negative-controls` → `main` · +0 −0 · 0 files · 0 commits · closed without merging --- This change hardcodes VS2022 toolchain paths (INCLUDE, LIB, PATH, CMAKE_LINKER) in the `dev` and `release` CMake presets so CMake locates the correct compiler toolchain without depending on the calling shell's environment variables. **Files changed**: `CMakePresets.json` **Test command** - `cmake --preset dev` - `cmake --build --preset dev` - `ctest --preset dev --no-tests=error -R 'desktop_root_signature'` **Expected result**: All configured and build steps locate vsdevcmd.bat automatically. The toolchain environment is applied regardless of how the terminal was started. **Observed result**: Build proceeds successfully with the VS2022 toolchain paths set at preset level. **Environment**: x64 Windows, Visual Studio 2022 Desktop development with C++ workload (x64 MSVC, C++ CMake tools, Ninja, Windows SDK). No external shell modifications needed before invoking `cmake --preset dev`. **Risk assessment**: Low-risk build-infra change. Only affects CMake integration; no game code or runtime behavior changes. --- Refs #4
Refs #1149. Adds `startup_tools_lint`, a device-free check that compiles each `tools/startup/*.py` without
importing or running it and reports `path:line: message` for anything that cannot be parsed. It needs no GPU
and no game files, and the Windows build-and-test job already runs ctest, so registering the test puts it in
CI without a workflow change.

The self-test is what keeps a passing run meaningful: a deliberately broken snippet must be rejected and a
valid one accepted, so "0 problems" cannot come from a harness that never parsed anything.

Two details found while building it:

- A UTF-8 BOM is tolerated (`utf-8-sig`) because Python accepts one in source; treating it as a syntax error
  would have failed a file the interpreter runs.
- Fail-first: with `def broken(:` added under tools/startup the check reports
  `syntax error: tools\startup\_lint_control_broken.py:1: invalid syntax` and exits 1; removing the file
  returns to `PASS: 7 files under tools/startup parse; control snippet rejected and valid snippet accepted`.

What this does not establish: it reports parse errors only. It is not a style linter, it does not check that
imports resolve at run time, and it says nothing about the tools' behaviour.
The pr test preset filters by test name, so registering startup_tools_lint in CMake was not enough: pull
requests run only the allowlisted names and the check would have stayed outside the gate.

Verified with the preset itself:

  ctest --preset pr -N            -> Test #41: startup_tools_lint (Total Tests: 26)
  ctest --preset pr -R ...        -> Test #41 ... Passed 0.11 sec

The other failures seen when running the whole pr preset in this tree are its build targets not having been
built here; this change only adds the one name to the filter.
ci: parse every Python file under tools/startup
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 23:13:40 +00:00
github-bot closed this pull request 2026-11-26 23:13:40 +00:00
Author
Owner

@⁠KelboLive on GitHub · 2026-11-24 15:06 UTC · original

Rebased onto current origin/main. The hardcoded VS2022 toolchain paths in CMakePresets.json have been reverted — the presets are now portable and no longer pin a specific Visual Studio edition, MSVC toolset version, or SDK path. Users can override with CMakeUserPresets.json (gitignored) if they need machine-specific paths.

**@⁠KelboLive** on GitHub · 2026-11-24 15:06 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1519#issuecomment-7135482436) Rebased onto current origin/main. The hardcoded VS2022 toolchain paths in CMakePresets.json have been reverted — the presets are now portable and no longer pin a specific Visual Studio edition, MSVC toolset version, or SDK path. Users can override with CMakeUserPresets.json (gitignored) if they need machine-specific paths.
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-24 13:40 UTC · original · requested changes

Both shared presets pin one product edition, toolset and SDK path, and the PATH value replaces the inherited environment. The pinned linker directory is absent on my current Visual Studio installation, whose existing tools/dev.ps1 discovery succeeds. Keep checked-in presets portable. A machine-local CMakeUserPresets override can hold fixed paths, or an optional discovery improvement can use the existing setup script and verify two different installations.

**@⁠R0Y00** on GitHub · 2026-11-24 13:40 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1519#pullrequestreview-6040213916) · **requested changes** Both shared presets pin one product edition, toolset and SDK path, and the PATH value replaces the inherited environment. The pinned linker directory is absent on my current Visual Studio installation, whose existing tools/dev.ps1 discovery succeeds. Keep checked-in presets portable. A machine-local CMakeUserPresets override can hold fixed paths, or an optional discovery improvement can use the existing setup script and verify two different installations.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.