Ninja Build System

Ninja Build System

github.com

2

About this website

Ninja is a free and open-source build system designed to be small, fast, and focused on the specific task of transforming input files into output files as quickly as possible. Created by Evan Martin (a Google Chrome engineer) in 2010 to accelerate the Chrome build process, Ninja serves as a backend build system that is generated by higher-level build generators (like CMake, GN, or Meson) rather than being written directly by developers. Key features: speed: Ninja is designed for incremental builds. It can build large projects (like Chrome, with over 40,000 source files) in seconds. Ninja achieves this by minimizing startup overhead, using a compact build file format, and parallelizing build steps aggressively. Simple build files: Ninja build files (build.ninja) are intentionally simple and low-level, describing rules (command templates) and edges (inputs, outputs, and the rule to apply). Unlike Makefiles, Ninja files are meant to be generated, not hand-written. No conditionals, variables, or functions in build files. Dependency scanning: Ninja automatically discovers header dependencies at build time using the compiler's dependency output (GCC/Clang -MD -MF), ensuring correct incremental builds without manual dependency tracking. Parallelism: defaults to running N+1 parallel jobs (where N is the number of CPU cores), and all build steps are independent and parallel by default. Minimal rebuilds: tracks file timestamps and build command hashes. Only outputs whose inputs or commands changed are rebuilt. Subtool feature (ninja -t): list all targets, find dependency paths, browse dependency graph, clean outputs. Integration: generated by CMake (most popular choice), GN (Chrome/Fuchsia), Meson, and many other build systems. Cross-platform: Linux, macOS, Windows. C++. Apache-2.0.

Tags & Categories

Tags

Statistics

2
Views
0
Clicks
0
Like
0
Dislike

Comments

Log In to post a comment

No comments yet. Be the first!