Build Windows CI with Ninja - #900
Open
mjcarroll wants to merge 1 commit into
Open
Conversation
Windows jobs have been generating a Visual Studio solution and building it with MSBuild. Switch them to Ninja. The reason is that this is what a compiler cache needs: CMake honours CMAKE_<LANG>_COMPILER_LAUNCHER only under the Ninja and Makefile generators, and under Visual Studio it accepts the setting and then ignores it. The cache itself is a separate change; this one alters how everything is built and is worth landing, and bisecting, on its own. Ninja is single configuration, so the build type has to be named at configure time. Jobs that already pass --cmake-build-type are unchanged; for the rest the generator was building '--config Release', so they now say Release explicitly and go on producing what they produced before. The packaging jobs keep the Visual Studio generator. ninja comes from the buildfarm environment added in ros2/ros2#1854, so the image installs and runs that environment rather than the default one. That environment is the default feature plus the build tooling, so nothing else in the image changes -- and installing only it means the default environment is not built into the image at all. Ninja also spends about 37 more characters per object file, writing to CMakeFiles/<target>.dir/<hash>/ where the old generator wrote <target>.dir/<config>/. That is enough to overrun MAX_PATH on the longest rosidl generated sources. So shorten the paths unconditionally, in every Windows job: default the build space to 'b', and subst the workspace onto W:. Together that is ten characters, which is what the file build 744 died on needed. Doing it always, rather than detecting or enabling long path support and hoping it took effect, is the point -- the image sets LongPathsEnabled under CurrentControlSet, which Windows regenerates from ControlSet001 when a container starts, so that setting cannot be relied on from inside the container. Short paths do not need it. An explicit --build-space still wins. If the mapping fails the build runs from the long path with a warning.
mjcarroll
force-pushed
the
mjcarroll/windows-ninja
branch
from
September 9, 2026 21:57
fb3ad92 to
70e12c9
Compare
Member
Author
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.
First of two: switches the Windows CI jobs from the Visual Studio generator to Ninja. The compiler cache that motivated it is #899, stacked on this.
Ninja is single configuration, so the build type is named at configure time. Jobs already passing
--cmake-build-typeare unchanged; the rest now sayReleaseexplicitly, which is what colcon was building with--config Releasebefore. Packaging jobs keep the Visual Studio generator.ninjacomes from thebuildfarmenvironment in ros2/ros2#1854, so the image installs and runs-e buildfarmrather than the default environment.Ninja also spends ~37 more characters per object file, writing to
CMakeFiles/<target>.dir/<hash>/where the old generator wrote<target>.dir/<config>/, which overrunsMAX_PATHon the longest rosidl generated sources. Paths are therefore shortened unconditionally on Windows — build spaceb, workspacesubsted ontoW:— rather than depending on long path support, which the image sets underCurrentControlSetand Windows regenerates when a container starts. An explicit--build-spacestill wins.Depends on ros2/ros2#1854.