conformance build.ps1: find Visual Studio's CMake and name no Visual Studio version #229

Open
github-bot wants to merge 2 commits from github-bot/gh-229 into main AGit
Owner

@⁠Andretuta on GitHub · 2026-11-24 02:49 UTC · original
ubiquitarianism:old-pr/9962 → main · +153 −3 · 2 files · 2 commits · draft

Carried over from old PR 9962 by leeahmy in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/9962, exactly that PR's last commit. All carried-over PRs are listed in #17.
Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it.
leeahmy: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one.


Original description (mentions and #N references are disabled; the numbers refer to the old repository):

Claimed in the coordination issue as: https://github.com/ProjectLeonida/Leonida/issues/9677#issuecomment-7116616512

What and why

tools/conformance/native/scripts/build.ps1 fails on a PC with only Visual Studio Build Tools:

  • It takes CMake from PATH or C:\Program Files\CMake only, so without either it ends with The term 'C:\Program Files\CMake\bin\cmake.exe' is not recognized, although Visual Studio includes CMake. Found by evilclanker9000: https://github.com/ProjectLeonida/Leonida/issues/9401#issuecomment-7114627674
  • It always asks for Visual Studio 17 2022, which fails where only Visual Studio 2026 is installed.

The script now looks for CMake in the order scripts/build_runtime.ps1 does (Visual Studio's through vswhere, then one on PATH with Visual Studio generators), then in %ProgramFiles%\CMake. It passes no -G, so CMake takes the newest Visual Studio it knows. CMAKE_GENERATOR is unset for the configure, because -G used to override it. With no CMake at all it prints one line and exits 1.

Behaviour change: Visual Studio's CMake is now preferred to one on PATH. negative-control.ps1 has the same lookup and generator and is not changed here.

Tested

Windows 11 (10.0.26200), Visual Studio 2026 Build Tools (CMake 4.1.2), Windows PowerShell 5.1, no CMake on PATH, NVIDIA GeForce RTX 5080 (610.88 / 32.0.16.1088), main 2d53a8055. AMD was not run.

  • The script builds conform_native with the Visual Studio 18 2026 generator, exit 0, and the result passes 36 of 36 checks (18 readback, 18 PNG). main's script exits 1 before it configures.
  • The same with CMAKE_GENERATOR=Ninja set, in a clean folder and in an existing build folder.
  • Also run for real: a checkout path with spaces, brackets and non-ASCII characters; from another folder; CMake on PATH with no vswhere; no CMake at all (one line, exit 1); a compile error and a configure error (exit 1). CMAKE_GENERATOR is restored in the calling session.
  • Commit 42e44cf08 merged onto main d083a2cc3 (clean merge): the script builds, 36 of 36 checks pass, and the new test (5 of 5), test_conformance_run_script.py (7 of 7) and, with the executable this script built, test_conformance_native_paths.py (7 of 7) pass.
  • New tests/test_conformance_build_script.py: 5 of 5. It runs a copy of the script with stand-ins for CMake and builds nothing. Control: with main's script, all 5 fail.
  • All 460 standalone tests/test_*.py on 2d53a8055: the same 28 fail as on main, none new. The pytest-only files were not run.
  • check_no_game_data.py, compileall and git diff --check are clean.
  • Not run: a PC with Visual Studio 2022, PowerShell 7, and scripts/verify.ps1 (it expects the author's adapters).

AI-assisted: yes (Claude Code)

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (Not applicable: no translator rule.)

🤖 Generated with Claude Code

**@⁠Andretuta** on GitHub · 2026-11-24 02:49 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/229) `ubiquitarianism:old-pr/9962` → `main` · +153 −3 · 2 files · 2 commits · draft > Carried over from **old PR 9962** by `leeahmy` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/9962`, exactly that PR's last commit. All carried-over PRs are listed in #17. > Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it. > `leeahmy`: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one. --- Original description (mentions and `#N` references are disabled; the numbers refer to the old repository): Claimed in the coordination issue as: https://github.com/ProjectLeonida/Leonida/issues/9677#issuecomment-7116616512 ### What and why `tools/conformance/native/scripts/build.ps1` fails on a PC with only Visual Studio Build Tools: - It takes CMake from `PATH` or `C:\Program Files\CMake` only, so without either it ends with `The term 'C:\Program Files\CMake\bin\cmake.exe' is not recognized`, although Visual Studio includes CMake. Found by evilclanker9000: https://github.com/ProjectLeonida/Leonida/issues/9401#issuecomment-7114627674 - It always asks for `Visual Studio 17 2022`, which fails where only Visual Studio 2026 is installed. The script now looks for CMake in the order `scripts/build_runtime.ps1` does (Visual Studio's through `vswhere`, then one on `PATH` with Visual Studio generators), then in `%ProgramFiles%\CMake`. It passes no `-G`, so CMake takes the newest Visual Studio it knows. `CMAKE_GENERATOR` is unset for the configure, because `-G` used to override it. With no CMake at all it prints one line and exits 1. Behaviour change: Visual Studio's CMake is now preferred to one on `PATH`. `negative-control.ps1` has the same lookup and generator and is not changed here. ### Tested Windows 11 (10.0.26200), Visual Studio 2026 Build Tools (CMake 4.1.2), Windows PowerShell 5.1, no CMake on `PATH`, NVIDIA GeForce RTX 5080 (610.88 / 32.0.16.1088), `main` `2d53a8055`. AMD was not run. - The script builds `conform_native` with the `Visual Studio 18 2026` generator, exit 0, and the result passes 36 of 36 checks (18 readback, 18 PNG). `main`'s script exits 1 before it configures. - The same with `CMAKE_GENERATOR=Ninja` set, in a clean folder and in an existing build folder. - Also run for real: a checkout path with spaces, brackets and non-ASCII characters; from another folder; CMake on `PATH` with no `vswhere`; no CMake at all (one line, exit 1); a compile error and a configure error (exit 1). `CMAKE_GENERATOR` is restored in the calling session. - Commit `42e44cf08` merged onto `main` `d083a2cc3` (clean merge): the script builds, 36 of 36 checks pass, and the new test (5 of 5), `test_conformance_run_script.py` (7 of 7) and, with the executable this script built, `test_conformance_native_paths.py` (7 of 7) pass. - New `tests/test_conformance_build_script.py`: 5 of 5. It runs a copy of the script with stand-ins for CMake and builds nothing. Control: with `main`'s script, all 5 fail. - All 460 standalone `tests/test_*.py` on `2d53a8055`: the same 28 fail as on `main`, none new. The pytest-only files were not run. - `check_no_game_data.py`, `compileall` and `git diff --check` are clean. - Not run: a PC with Visual Studio 2022, PowerShell 7, and `scripts/verify.ps1` (it expects the author's adapters). AI-assisted: yes (Claude Code) ### Checklist - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (Not applicable: no translator rule.) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The script took CMake from PATH or C:/Program Files/CMake only, so it failed on
a Visual Studio Build Tools install, which includes its own. It also always
asked for Visual Studio 2022. Look for CMake as scripts/build_runtime.ps1 does
and leave the generator to CMake.

The CMake lookup was found by evilclanker9000.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The stand-in's batch file held the log path, and paths came back through the
console code page. Found by Osis78.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:49:37 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/229/head:github-bot/gh-229'
git switch 'github-bot/gh-229'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-229'
git switch 'github-bot/gh-229'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-229'
git switch 'github-bot/gh-229'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-229'
git switch 'main'
git merge --squash 'github-bot/gh-229'
git switch 'main'
git merge --ff-only 'github-bot/gh-229'
git switch 'main'
git merge 'github-bot/gh-229'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.