windows: build with Visual Studio 2026 / newer MSVC toolsets#4328
Open
exzile wants to merge 6 commits into
Open
windows: build with Visual Studio 2026 / newer MSVC toolsets#4328exzile wants to merge 6 commits into
exzile wants to merge 6 commits into
Conversation
- Auto-detect Visual Studio via vswhere instead of hardcoding VS 2022 BuildTools, the "Visual Studio 17 2022" CMake generator, and the 14.44.35207 toolset (windows_install_build_dependencies.bat, windows_build.bat, windows_setupvars.bat, windows_test.bat). - .bazelrc: suppress MSVC C5285 (/wd5285) so newer toolsets (14.51+, VS 2026) can compile XLA's std::is_signed specializations, which XLA builds with /WX. - OpenCV: drop hardcoded -T v142 (use the generator default toolset) and pass PYTHON3_EXECUTABLE / disable the python bindings to avoid a CMake 4.x python-detection error. - Use mklink /j (junction) instead of /d (symlink) for the openvino link so the dependency install works without admin / Developer Mode. Tested end-to-end on Visual Studio 2026 (MSVC 14.51). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Updates OVMS Windows build tooling to work on newer Visual Studio/MSVC installations by detecting the installed VS instance/toolset at runtime and addressing newer-toolchain build breakages (notably XLA warnings treated as errors).
Changes:
- Auto-detect Visual Studio installation path via
vswherein Windows.batscripts instead of hardcoding VS 2022 Build Tools paths. - Auto-detect the installed MSVC toolset version in build/setup/test scripts instead of pinning a specific version.
- Allow MSVC 14.51+ to compile XLA by suppressing warning C5285 in Windows Bazel config.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
windows_install_build_dependencies.bat |
Detects VS + generator via vswhere, switches GenAI link to junction, adjusts CMake/OpenCV configuration for newer toolchains. |
windows_build.bat |
Detects VS via vswhere and auto-detects MSVC toolset version for Bazel builds. |
windows_setupvars.bat |
Detects VS via vswhere and auto-detects MSVC toolset version for environment setup. |
windows_test.bat |
Detects VS via vswhere and auto-detects MSVC toolset version for Bazel test builds. |
.bazelrc |
Suppresses MSVC warning C5285 on Windows to prevent /WX failures in XLA builds on newer toolsets. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Address PR review: - Fail fast with a clear error if no MSVC toolset is found under %BAZEL_VC%\Tools\MSVC (build/test/setupvars), instead of leaving BAZEL_VC_FULL_VERSION empty and producing confusing later failures. - Pass the detected -G "%CMAKE_GEN%" to the OpenCV configure step so it builds with the same generator/toolset as the other dependencies. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4333.
The Windows build scripts hardcode Visual Studio 2022 Build Tools and a specific MSVC toolset version, so a machine with only Visual Studio 2026 (v18) cannot build OVMS. This PR detects the installed Visual Studio and toolset, and fixes a couple of newer-toolchain breakages it surfaced.
Changes
1. Auto-detect Visual Studio via
vswhere(windows_install_build_dependencies.bat,windows_build.bat,windows_setupvars.bat,windows_test.bat)C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildToolswithvswhere -latest -requires ...VC.Tools.x86.x64 -property installationPath(works with BuildTools/Community/Pro/Enterprise).Visual Studio <major> <year>) from the detected major version instead of the literal"Visual Studio 17 2022".14.44.35207.2. Allow newer MSVC toolsets to compile XLA (
.bazelrc)std::is_signedis forbidden") on TensorFlow/XLA's quantized-type specializations (xla/tsl/framework/type_traits.h). XLA builds with/WX, so it becomes a fatalC2220. Addedbuild:windows --copt=/wd5285(+--host_copt) to suppress this benign upstream warning. Without it, only the older14.44toolset builds.3. OpenCV generator default toolset / CMake 4.x (
windows_install_build_dependencies.bat)-T v142(VS 2019 toolset, absent on a VS 2026 box); cmake uses the generator's default (installed) toolset.-D PYTHON3_EXECUTABLEand disable the OpenCV python bindings — newer CMake (4.x) errors in OpenCV's python auto-detection (find_package called with invalid argument "OFF"); OVMS only needs the C++ libs.4. Non-privileged GenAI link (
windows_install_build_dependencies.bat)mklink /d→mklink /jfor theopenvinolink. A directory junction is functionally equivalent here and does not requireSeCreateSymbolicLinkPrivilege(admin / Developer Mode), so the dependency install works in a non-elevated shell.Testing
ovms.exeend-to-end on Visual Studio 2026 (18.7, MSVC 14.51) withwindows_install_build_dependencies.bat+windows_build.bat opt --with_python— produces a working server (OpenVINO Model Server 2026.3.0).vswhere/generator/toolset detection resolves the 2022 values by the same logic, and the/wd5285+ OpenCV changes are no-ops on the older toolset.Notes
PATH(the VS "C++ CMake tools" component or a standalone install).