Misplaced Pages

Ninja (build system)

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
Free build automation software
Ninja
Ninja being used to compile dav1d, in conjunction with Meson configuration
Developer(s)Evan Martin
Initial release2012; 13 years ago (2012)
Stable release1.12.1 Edit this on Wikidata / 11 May 2024; 7 months ago (11 May 2024)
Repository
Written inC++, Python
Operating systemLinux, macOS, Windows
TypeSoftware development tools
LicenseApache License 2.0
Websiteninja-build.org Edit this on Wikidata

Ninja is a build system developed by Evan Martin, a Google employee. Ninja has a focus on speed and it differs from other build systems in two major respects: it is designed to have its input files generated by a higher-level build system, and it is designed to run builds as fast as possible.

Build system

In essence, Ninja is meant to replace Make, which is slow when performing incremental (or no-op) builds. This can considerably slow down developers working on large projects, such as Google Chrome which compiles 40,000 input files into a single executable. In fact, Google Chrome is a main user and motivation for Ninja. It's also used to build Android (via Makefile translation by Kati), and is used by most developers working on LLVM.

In contrast to Make, Ninja lacks features such as string manipulation, as Ninja build files are not meant to be written by hand. Instead, a "build generator" should be used to generate Ninja build files. Gyp, CMake, Meson, and gn are popular build management software tools which support creating build files for Ninja.

Example

rule cc
  command = gcc -c -o $out $in
  description = CC $out
rule link
  command = gcc -o $out $in
  description = LINK $out
build source1.o: cc source1.c
build source2.o: cc source2.c
build myprogram: link source1.o source2.o

References

  1. Martin, Evan. "Google Groups: ninja-build". Retrieved 18 June 2017.
  2. "Release 1.12.1". 11 May 2024. Retrieved 23 May 2024.
  3. "COPYING". Github. Retrieved 5 September 2019.
  4. "Google man open sources Chrome build system".
  5. Röthlisberger, David. "The Ninja build tool". LWN. Retrieved 18 June 2017.
  6. "Ninja". The Performance Of Open Source Applications. Retrieved 18 June 2017.
  7. "aosp mailing list".
  8. "LLVM documentation".
  9. "gn - Git at Google".
  10. Kitware. "cmake Documentation". Retrieved 18 June 2017.

External links

Categories: