CMake: use full MSVC toolchain path for space-in-path builds #1212

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

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


Fix CMake configure/build failure when MSVC or SDK paths contain spaces.

Change: Use full MSVC cl.exe path and full implicit include/link directories in CMakePresets.json.

Tested: Both tests pass (RTX 4070 Ti SUPER, hash 0x0afb0285).

  • d3d12x_compute_list_warp — PASS
  • d3d12x_compute_list_hardware — PASS
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6574386022 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1219). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-11-24T04:07:34Z. --- Fix CMake configure/build failure when MSVC or SDK paths contain spaces. Change: Use full MSVC cl.exe path and full implicit include/link directories in CMakePresets.json. Tested: Both tests pass (RTX 4070 Ti SUPER, hash 0x0afb0285). - d3d12x_compute_list_warp — PASS - d3d12x_compute_list_hardware — PASS
tedin7 commented 2026-11-24 06:47:01 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T04:21:40Z.

Review: COMMENTED


Reviewed commit 30b1ab4b.

Findings on CMakePresets.json

Hardcoding machine-specific Visual Studio and Windows SDK paths/versions in tracked CMakePresets.json breaks portability across CI and contributor environments:

  1. Hardcoded VS edition & MSVC toolset version: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.44.35207/bin/Hostx64/x64/cl.exe (in both dev and release) will fail on machines with VS Build Tools, Professional/Enterprise, VS 18 / 2026, or any other MSVC version (including GitHub Actions windows-2025 runners when the toolset updates).
  2. Hardcoded Windows SDK version: 10.0.26100.0 in CMAKE_{C,CXX}_IMPLICIT_INCLUDE_DIRECTORIES and CMAKE_{C,CXX}_IMPLICIT_LINK_DIRECTORIES will fail on hosts with a different installed SDK (e.g. 10.0.22621.0).
  3. Asymmetric dev vs release presets & debug CRT: release sets CMAKE_CXX_COMPILER to the full path without the implicit include/link directories, and dev hardcodes ucrtd in CMAKE_CXX_IMPLICIT_LINK_LIBRARIES.
  4. tools/dev.ps1 already discovers VS via vswhere.exe and invokes Launch-VsDevShell.ps1 to populate PATH, INCLUDE, and LIB. If spaces in paths cause a failure in a local setup, that should be handled dynamically (or via gitignored CMakeUserPresets.json) rather than hardcoding one installation in CMakePresets.json.

Checks run on Linux (30b1ab4b)

  • /root/.local/share/x2w-rev-venv/bin/python -B -c "import json; json.load(open('CMakePresets.json'))": PASS (valid JSON).
  • /root/.local/share/x2w-rev-venv/bin/python -B tests/docs_links_check.py: PASS (15 Markdown files, 266 links).
  • /root/.local/share/x2w-rev-venv/bin/python -B tests/bidi_controls_check.py: PASS (968 files).
  • /root/.local/share/x2w-rev-venv/bin/python -B tests/form_coverage_check.py: PASS.
  • /root/.local/share/x2w-rev-venv/bin/python -B tests/xgameruntime_table_check.py: PASS (27 exports).
  • /root/.local/share/x2w-rev-venv/bin/python -B tests/gpu_report_format_check.py: PASS (10/10).
  • /root/.local/share/x2w-rev-venv/bin/python -B tests/hardware_reports_check.py: PASS (11/11).

Note: Windows CMake configure/build/test was not executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6033607693 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1219#pullrequestreview-6033607693). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T04:21:40Z. **Review:** COMMENTED --- Reviewed commit `30b1ab4b`. ### Findings on `CMakePresets.json` Hardcoding machine-specific Visual Studio and Windows SDK paths/versions in tracked `CMakePresets.json` breaks portability across CI and contributor environments: 1. **Hardcoded VS edition & MSVC toolset version**: `C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.44.35207/bin/Hostx64/x64/cl.exe` (in both `dev` and `release`) will fail on machines with VS Build Tools, Professional/Enterprise, VS 18 / 2026, or any other MSVC version (including GitHub Actions `windows-2025` runners when the toolset updates). 2. **Hardcoded Windows SDK version**: `10.0.26100.0` in `CMAKE_{C,CXX}_IMPLICIT_INCLUDE_DIRECTORIES` and `CMAKE_{C,CXX}_IMPLICIT_LINK_DIRECTORIES` will fail on hosts with a different installed SDK (e.g. `10.0.22621.0`). 3. **Asymmetric `dev` vs `release` presets & debug CRT**: `release` sets `CMAKE_CXX_COMPILER` to the full path without the implicit include/link directories, and `dev` hardcodes `ucrtd` in `CMAKE_CXX_IMPLICIT_LINK_LIBRARIES`. 4. `tools/dev.ps1` already discovers VS via `vswhere.exe` and invokes `Launch-VsDevShell.ps1` to populate `PATH`, `INCLUDE`, and `LIB`. If spaces in paths cause a failure in a local setup, that should be handled dynamically (or via gitignored `CMakeUserPresets.json`) rather than hardcoding one installation in `CMakePresets.json`. ### Checks run on Linux (`30b1ab4b`) - `/root/.local/share/x2w-rev-venv/bin/python -B -c "import json; json.load(open('CMakePresets.json'))"`: **PASS** (valid JSON). - `/root/.local/share/x2w-rev-venv/bin/python -B tests/docs_links_check.py`: **PASS** (15 Markdown files, 266 links). - `/root/.local/share/x2w-rev-venv/bin/python -B tests/bidi_controls_check.py`: **PASS** (968 files). - `/root/.local/share/x2w-rev-venv/bin/python -B tests/form_coverage_check.py`: **PASS**. - `/root/.local/share/x2w-rev-venv/bin/python -B tests/xgameruntime_table_check.py`: **PASS** (27 exports). - `/root/.local/share/x2w-rev-venv/bin/python -B tests/gpu_report_format_check.py`: **PASS** (10/10). - `/root/.local/share/x2w-rev-venv/bin/python -B tests/hardware_reports_check.py`: **PASS** (11/11). Note: Windows CMake configure/build/test was **not** executed locally.
R0Y00 commented 2026-11-24 06:50:20 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T04:28:41Z.


Windows CI fails before it builds because the preset selects an absolute VS 2022 Community compiler path pinned to 14.44.35207. That compiler is absent on the hosted runner. Please exercise a clone path containing spaces with the x64 toolchain selected by dev.ps1, and keep compiler discovery tied to the installed instance/version. Show the first failing generated command from the space-in-path case so the fix can target its quoting.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7122055399 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1219#issuecomment-7122055399). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T04:28:41Z. --- Windows CI fails before it builds because the preset selects an absolute VS 2022 Community compiler path pinned to 14.44.35207. That compiler is absent on the hosted runner. Please exercise a clone path containing spaces with the x64 toolchain selected by dev.ps1, and keep compiler discovery tied to the installed instance/version. Show the first failing generated command from the space-in-path case so the fix can target its quoting.
upstream-sync closed this pull request 2026-11-24 13:00:20 +00:00

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!1212
No description provided.