-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #303 from PRUNERS/issue302-ninja-build
Issue302 ninja build
- Loading branch information
Showing
10 changed files
with
1,365 additions
and
26 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# Experimental Features | ||
|
||
[Prev](analyze-results.md) | ||
| | ||
[Table of Contents](README.md) | ||
| | ||
[Next](autogenerated-tests.md) | ||
|
||
There are experimental featues not yet ready for prime-time. They may end up | ||
in flit as a permanent thing or they may be deemed too much work or not useful | ||
enough to become a full feature. Those features may stay as experimental | ||
features, or they may disappear entirely. | ||
|
||
Currently supported experimental features: | ||
|
||
* [Ninja Generator](#ninja-generator) | ||
|
||
## Ninja Generator | ||
|
||
[Ninja](https://ninja-build.org) is a build tool similar to GNU Make that | ||
focuses on simplicity, readability, speed, and parallelism. This experimental | ||
feature instead generates a `build.ninja` file to be compiled with `ninja` | ||
instead of the generated `Makefile`. | ||
|
||
You can invoke the Ninja generator using | ||
|
||
```bash | ||
flit experimental ninja | ||
``` | ||
|
||
Call it with the `--help` option to see more documentation about the usage and | ||
flags available. | ||
|
||
### Benefits | ||
|
||
The generated `build.ninja` will be much larger than the generated `Makefile`. | ||
This is because each compilation is explicitly specified. For example, for a | ||
project with 120 source files and 305 specified compilations, the generated | ||
`Makefile` is only 20 Kilobytes. For that same project, the generated | ||
`build.ninja` file is 5.6 Megabytes at over 100,000 lines of generated code. | ||
|
||
That extra used disk space may not seem like much of a benefit, but honestly, | ||
disk space is cheap, and 5.6 megabytes is nothing in comparison to the size of | ||
the compiled object files you are going to generate. | ||
|
||
The true benefit is in the speed. If you want to do a clean of your build | ||
system, you may see a significant speedup with the Ninja system, despite the | ||
bigger file size. If you just want to view the help documentation using the | ||
`help` target, you will notice a significant improvement with the Ninja system. | ||
The actual build time for large projects is primarily dominated by the time it | ||
takes to compile, so for doing a full compilation, you may not notice much of a | ||
difference. | ||
|
||
I'm not sure the benefits of this approach are significant enough to warrant | ||
the effort to make it a regular feature in FLiT. But it was a worthwhile | ||
experiment. Use this feature if you find use for it. | ||
|
||
### Inputs to the Ninja Generator | ||
|
||
This generator reads in configuration information from `flit-config.toml` and | ||
reads variables defined in `custom.mk`. It then goes on to generate | ||
`build.ninja` from that information. | ||
|
||
The `custom.mk` file does not need to exist. If it does, this tool will only | ||
read variables if they are present. The variables read from `custom.mk` are | ||
|
||
* `SOURCE`: list of source files | ||
* `CXXFLAGS`: C++ compile flags to use in all compilations | ||
* `LDFLAGS`: link flags to use in all compilations (e.g., "-L/usr/local/lib64") | ||
* `LDLIBS`: link libraries to use in all compilations (e.g., "-lm") | ||
* `RUN_WRAPPER`: command to wrap around the test executable when run | ||
|
||
This `custom.mk` file is in GNU Makefile format. Any additional variables and | ||
rules defined inside are completely ignored. Feel free to use anything from | ||
GNU Make including `if` statements and things like `$(wildcard ../src/*.cpp)`. | ||
|
||
|
||
|
||
[Prev](analyze-results.md) | ||
| | ||
[Table of Contents](README.md) | ||
| | ||
[Next](autogenerated-tests.md) |
This file contains 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
Oops, something went wrong.