Skip to content

Build Windows CI with Ninja - #900

Open
mjcarroll wants to merge 1 commit into
masterfrom
mjcarroll/windows-ninja
Open

Build Windows CI with Ninja#900
mjcarroll wants to merge 1 commit into
masterfrom
mjcarroll/windows-ninja

Conversation

@mjcarroll

@mjcarroll mjcarroll commented Sep 9, 2026

Copy link
Copy Markdown
Member

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-type are unchanged; the rest now say Release explicitly, which is what colcon was building with --config Release before. Packaging jobs keep the Visual Studio generator.

ninja comes from the buildfarm environment in ros2/ros2#1854, so the image installs and runs -e buildfarm rather 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 overruns MAX_PATH on the longest rosidl generated sources. Paths are therefore shortened unconditionally on Windows — build space b, workspace substed onto W: — rather than depending on long path support, which the image sets under CurrentControlSet and Windows regenerates when a container starts. An explicit --build-space still wins.

Depends on ros2/ros2#1854.

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

mjcarroll commented Sep 10, 2026

Copy link
Copy Markdown
Member Author

Unspecified Type (Release): Build Status

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant