Describe the new feature:
Sometimes the build gets so complicated with so many build files that the Makefile can be quite slow. I have had a good experience with the Ninja build system in speed. What if we supported Ninja by generating a build.ninja file instead of a Makefile? I think it's worth investigating. It may be faster or it may be slower, we don't yet know.
Similarly, it may be worthwhile seeing how a generated Makefile would be if we flattened it out and did not require a large parsing effort - similar to how CMake generates Makefiles.
Suggested change:
Investigate supporting Ninja build files instead of Makefiles. I suggest this be implemented as an optional flag for flit update and flit init. The flag would be something like --generator Ninja or -G Ninja, similar to how CMake does it. Then we would generate a build.ninja file.
Since we already have the capability of retrieving Makefile variables, we can still use the custom.mk file from the user (provided they are only adding to Makefile variables). We can extract these values, then put them in an autogenerated build.ninja file.
The Ninja project provides a python module called ninja_syntax that we could include in our project or have as an optional dependency. This file allows an easy interface for programmatically generating a Ninja file.
Alternative approaches:
We could roll our own generator for Ninja files, or we could piggy-back on another meta-build system that can also generate Ninja build files, such as CMake or Meson.
Feature Request
Describe the new feature: Sometimes the build gets so complicated with so many build files that the Makefile can be quite slow. I have had a good experience with the Ninja build system in speed. What if we supported Ninja by generating a
build.ninja
file instead of aMakefile
? I think it's worth investigating. It may be faster or it may be slower, we don't yet know.Similarly, it may be worthwhile seeing how a generated
Makefile
would be if we flattened it out and did not require a large parsing effort - similar to how CMake generatesMakefile
s.Suggested change: Investigate supporting Ninja build files instead of Makefiles. I suggest this be implemented as an optional flag for
flit update
andflit init
. The flag would be something like--generator Ninja
or-G Ninja
, similar to how CMake does it. Then we would generate abuild.ninja
file.Since we already have the capability of retrieving Makefile variables, we can still use the
custom.mk
file from the user (provided they are only adding to Makefile variables). We can extract these values, then put them in an autogeneratedbuild.ninja
file.The Ninja project provides a python module called
ninja_syntax
that we could include in our project or have as an optional dependency. This file allows an easy interface for programmatically generating a Ninja file.Alternative approaches: We could roll our own generator for Ninja files, or we could piggy-back on another meta-build system that can also generate Ninja build files, such as CMake or Meson.