Much better support for ninja cmake backend#5005
Conversation
|
You can preview documentation at https://esmci.github.io/cime/branch/jgfouca/more_ninja_stuff/html/index.html |
There was a problem hiding this comment.
Pull request overview
This PR improves CMake build backend flexibility (with a focus on Ninja) by shifting away from hard-coded GNU Make invocations and adding configuration / CLI support for selecting a backend, along with documentation and schema updates to support a new CMAKE_BACKEND machine setting.
Changes:
- Replace direct
gmake/ninjacalls withcmake --buildin several build paths to better support multiple CMake generators. - Add CLI options to select Ninja vs gmake in
case.buildandcreate_test, plus a new machine/case settingCMAKE_BACKEND. - Update machine env handling to expose Ninja on
PATHwhen vendored, and update schemas/docs to includeCMAKE_BACKEND.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| doc/source/ccs/model-configuration/variables/machine.rst | Documents new CMAKE_BACKEND machine variable in the machine variables reference and schema examples. |
| doc/source/ccs/building-a-case.rst | Documents CMAKE_BACKEND as a build-affecting variable and adds a note about backend availability. |
| CIME/XML/env_mach_specific.py | Prepends vendored Ninja to PATH during env setup for cases. |
| CIME/Tools/case.build | Adds --ninja/--gmake flags and uses CMAKE_BACKEND defaulting behavior when no flag is provided. |
| CIME/test_scheduler.py | Propagates backend selection into scheduled build phases by appending --ninja/--gmake to case.build invocations. |
| CIME/SystemTests/hommebaseclass.py | Switches HOMME build/run targets to use cmake --build rather than direct make invocations. |
| CIME/scripts/create_test.py | Adds backend selection flags and passes them through to the test scheduler. |
| CIME/data/config/xml_schemas/config_machines.xsd | Adds CMAKE_BACKEND to v2 schema. |
| CIME/data/config/xml_schemas/config_machines_version3.xsd | Adds CMAKE_BACKEND to v3 schema. |
| CIME/data/config/xml_schemas/config_machines_template.xml | Documents optional CMAKE_BACKEND in the machine template. |
| CIME/build.py | Refactors model and clean build commands to use cmake --build and uses CMAKE_GENERATOR instead of a CIME-specific Ninja env var. |
| CIME/build_scripts/buildlib.cprnc | Uses cmake --build for cprnc build step instead of gmake. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
bartgol
left a comment
There was a problem hiding this comment.
Looks good to me. I would also consider renaming GMAKE_J to something like BUILD_J...
| self._namelists_only = namelists_only | ||
|
|
||
| self._ninja = ninja | ||
| self._gmake = gmake |
There was a problem hiding this comment.
Should we check that only one between gmake and ninja is true?
There was a problem hiding this comment.
Yes, that happens at the case.build level. I can add it here too.
Description
Add much better support for different cmake backends, specifically ninja.
Change list:
cmake --build .which will flexibly work for any backendCIME_SHAREDLIB_NINJAas a magic var, use the env that is known to CMake (CMAKE_GENERATOR).CMAKE_BACKENDChecklist