fix: fix Windows CI build failures - #273
Merged
Merged
Conversation
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.
Why
The Windows CI builds on this repo are broken in two places:
Python Bindings Test (
python_binding.yml,build (windows-latest, 3.12)): fails at the "Build and install" step withThe Windows runner ships CMake 4.x, which removed compatibility with
cmake_minimum_required(VERSION < 3.5). The pinned nlohmann/json v3.11.2 declarescmake_minimum_required(VERSION 3.1), so CMake 4.x rejects it while configuring the FetchContent dependency. Ubuntu is unaffected because its CMake is still 3.x.CI (
ci.yml,Windows Latest (MSVC 19.29)): fails at the "Configuring CMake files" step withThe
windows-latestrunner has Visual Studio installed, but the MSVC compiler (cl.exe) andnmakeare not on thePATHuntil the MSVC developer environment is activated. The job rancmake ..without activating it.What changed
setup.py: add-DCMAKE_POLICY_VERSION_MINIMUM=3.5to the CMake arguments. It is the official escape hatch suggested by the CMake 4.x error message, allowing the oldcmake_minimum_required(VERSION 3.1)declaration of nlohmann/json v3.11.2 to be accepted. The json version is left untouched, so the pybind11 v2.11.1 compatibility is preserved..github/workflows/ci.yml: add a "Set up MSVC environment" step usingilammy/msvc-dev-cmd@v1right after the CMake setup in the Windows job, so CMake can findnmakeand the MSVC compiler. The action is MIT-licensed, widely used, and already approved in the Apache org action allowlist.Verification