build: hardcode VS2022 toolchain in CMake presets #1512

Closed
KelboLive wants to merge 0 commits from upstream-pr/1519 into main
KelboLive commented 2026-11-24 13:30:34 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by KelboLive on 2026-11-24T13:30:34Z.



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

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6582903912 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1519). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-11-24T13:30:34Z. --- --- 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
R0Y00 commented 2026-11-24 14:03:07 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T13:40:35Z.

Review: CHANGES_REQUESTED


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6040213916 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1519#pullrequestreview-6040213916). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T13:40:35Z. **Review:** CHANGES_REQUESTED --- 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.
upstream-sync closed this pull request 2026-11-24 16:02:59 +00:00
KelboLive commented 2026-11-24 16:03:32 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by KelboLive on 2026-11-24T15:06:56Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7135482436 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1519#issuecomment-7135482436). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-11-24T15:06:56Z. --- 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.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!1512
No description provided.