fix(build): find MSVC, CMake, Ninja and dxc instead of fixed paths #15

Manually merged
github merged 1 commit from gh-pr/15/head into gh-pr/15/base 2026-11-26 19:10:50 +00:00
Owner

@⁠marquezinii on GitHub · 2026-11-22 07:33 UTC · original
marquezinii:fix/build-cmd-toolchain-discovery → main · +39 −3 · 1 files · 1 commits · merged 2026-11-22 08:08 UTC

build.cmd only works on a machine with VS 2022 Community at its default path and the E:\ScarlettX-dev toolchain. Anywhere else vcvars64.bat isn't found, so CMake gets no compiler (CMAKE_C_COMPILER not set).

This change:

  • keeps an already initialised developer prompt (cl.exe on PATH);
  • otherwise asks vswhere for the newest install with the x64 C++ tools (Community, Professional, Enterprise or Build Tools, any version), falling back to the old VS 2022 Community path;
  • puts the Installer folder on PATH first, because vcvars64.bat calls vswhere.exe by name and prints an error without it;
  • uses the CMake and Ninja that ship with that Visual Studio;
  • takes dxc.exe from the newest installed Windows SDK instead of 10.0.26100.0 only;
  • still puts the pinned E:\ScarlettX-dev CMake and Ninja first when they exist, so the existing setup behaves as before.

build_wt.cmd is left alone since it's tied to the E:\OpenScarlett worktree layout.

Tested

Windows 11 26H2 (26300), VS Build Tools 18 (MSVC 14.52.37025), Windows SDK 10.0.26100.0, RTX 5070 (driver 621.24):

  • build.cmd from a plain cmd window: configure + full build, 0 warnings, ctest 42/42 passed.
  • build.cmd where cl ninja cmake dxc resolves the Build Tools cl.exe, the VS-bundled ninja.exe/cmake.exe and the SDK dxc.exe.
**@⁠marquezinii** on GitHub · 2026-11-22 07:33 UTC · [original](https://github.com/californiaAlmonds/OpenScarlett/pull/15) `marquezinii:fix/build-cmd-toolchain-discovery` → `main` · +39 −3 · 1 files · 1 commits · merged 2026-11-22 08:08 UTC `build.cmd` only works on a machine with VS 2022 Community at its default path and the `E:\ScarlettX-dev` toolchain. Anywhere else `vcvars64.bat` isn't found, so CMake gets no compiler (`CMAKE_C_COMPILER not set`). This change: - keeps an already initialised developer prompt (`cl.exe` on PATH); - otherwise asks `vswhere` for the newest install with the x64 C++ tools (Community, Professional, Enterprise or Build Tools, any version), falling back to the old VS 2022 Community path; - puts the Installer folder on PATH first, because `vcvars64.bat` calls `vswhere.exe` by name and prints an error without it; - uses the CMake and Ninja that ship with that Visual Studio; - takes `dxc.exe` from the newest installed Windows SDK instead of `10.0.26100.0` only; - still puts the pinned `E:\ScarlettX-dev` CMake and Ninja first when they exist, so the existing setup behaves as before. `build_wt.cmd` is left alone since it's tied to the `E:\OpenScarlett` worktree layout. ### Tested Windows 11 26H2 (26300), VS Build Tools 18 (MSVC 14.52.37025), Windows SDK 10.0.26100.0, RTX 5070 (driver 621.24): - `build.cmd` from a plain `cmd` window: configure + full build, 0 warnings, `ctest` 42/42 passed. - `build.cmd where cl ninja cmake dxc` resolves the Build Tools `cl.exe`, the VS-bundled `ninja.exe`/`cmake.exe` and the SDK `dxc.exe`.
build.cmd only worked with VS 2022 Community and the E:\ScarlettX-dev
toolchain. Look up the newest Visual Studio with the x64 C++ tools through
vswhere (any edition, Build Tools included), keep an already initialised
developer prompt, use the CMake and Ninja bundled with that install, and take
dxc.exe from the newest Windows SDK. The pinned E:\ tools are still used
first when they exist.

Checked on Windows 11 with VS Build Tools 18 (MSVC 14.52): configure and full
build succeed, 0 warnings, ctest 42/42.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 19:10:48 +00:00
github manually merged commit db26565bac into gh-pr/15/base 2026-11-26 19:10:50 +00:00
Author
Owner

@⁠californiaAlmonds on GitHub · 2026-11-22 08:08 UTC · original · approved these changes

Reviewed and verified on host toolchain (vswhere + VS Build Tools/Community + Windows SDK dxc.exe discovery while preserving E:\ScarlettX-dev priority). Merging!

**@⁠californiaAlmonds** on GitHub · 2026-11-22 08:08 UTC · [original](https://github.com/californiaAlmonds/OpenScarlett/pull/15#pullrequestreview-6011165694) · **approved these changes** Reviewed and verified on host toolchain (vswhere + VS Build Tools/Community + Windows SDK dxc.exe discovery while preserving E:\ScarlettX-dev priority). Merging!
This discussion has been locked. Commenting is limited to contributors.
No description provided.