Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/evmar/n2
n2 ("into"), a ninja compatible build system
https://github.com/evmar/n2
build-system ninja
Last synced: 7 days ago
JSON representation
n2 ("into"), a ninja compatible build system
- Host: GitHub
- URL: https://github.com/evmar/n2
- Owner: evmar
- License: apache-2.0
- Created: 2021-08-27T00:20:54.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-07-16T15:34:21.000Z (5 months ago)
- Last Synced: 2024-12-09T04:09:09.095Z (14 days ago)
- Topics: build-system, ninja
- Language: Rust
- Homepage:
- Size: 560 KB
- Stars: 364
- Watchers: 15
- Forks: 28
- Open Issues: 25
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# n2, an alternative ninja implementation
![CI status](https://github.com/evmar/n2/actions/workflows/ci.yml/badge.svg)
n2 (pronounced "into") implements enough of [Ninja](https://ninja-build.org/) to
successfully build some projects that build with Ninja. Compared to Ninja, n2
missing some features but is faster to build and has a better UI; see
[a more detailed comparison](doc/comparison.md).> [Here's a small demo](https://asciinema.org/a/F2E7a6nX4feoSSWVI4oFAm21T) of n2
> building some of Clang.## Install
```
$ cargo install --locked --git https://github.com/evmar/n2
# (installs into ~/.cargo/bin/)$ n2 -C some/build/dir some-target
```### Using with CMake
When CMake generates Ninja files it attempts run a program named `ninja` with
some particular Ninja behaviors. In particular, it attempts to inform Ninja/n2
that its generated build files are up to date so that the build system doesn't
attempt to rebuild them.n2 can emulate the expected CMake behavior when invoked as `ninja`. To do this
you create a symlink named `ninja` somewhere in your `$PATH`, such that CMake
can discover it.- UNIX: `ln -s path/to/n2 ninja`
- Windows(cmd): `mklink ninja.exe path\to\n2`
- Windows(PowerShell): `New-Item -Type Symlink ninja.exe -Target path\to\n2`> **Warning**\
> If you don't have Ninja installed at all, you must install such a symlink
> because CMake attempts to invoke `ninja` itself!## The console output
While building, n2 displays build progress like this:
```
[=========================--------- ] 2772/4459 done, 8/930 running
Building foo/bar (2s)
Building foo/baz
```The progress bar always covers all build steps needed for the targets,
regardless of whether they need to be executed or not.The bar shows three categories of state:
- **Done:** The `=` signs show the build steps that are already up to date.
- **In progress:** The `-` signs show steps that are in-progress; if you had
enough CPUs they would all be executing. The `8/930 running` after shows that
n2 is currently executing 8 of the 930 available steps.
- **Unknown:** The remaining empty space indicates steps whose status is yet to
be known, as they depend on the in progress steps. For example, if an
intermediate step doesn't write its outputs n2 may not need to execute the
dependent steps.The lines below the progress bar show some build steps that are currrently
running, along with how long they've been running if it has been a while. Their
text is controlled by the input `build.ninja` file.## More reading
I wrote n2 to
[explore some alternative ideas](http://neugierig.org/software/blog/2022/03/n2.html)
I had around how to structure a build system. In a very real sense the
exploration is more important than the actual software itself, so you can view
the design notes as one of the primary artifacts of this.- [Design notes](doc/design_notes.md).
- [Development tips](doc/development.md).
- [Comparison with Ninja / missing features](doc/comparison.md).