Generate-Ninja, or GN, is a meta-build system that generates Ninja build files so that you can build your project with Ninja.
GN is, originally, part of the Chromium source tree. However, this is a fork of the original GN, which has been extracted from the Chromium tree so that it may be built standalone.
The original source code was imported from Chromium
with the following files/directories exported directly via git archive
:
- .gn
- BUILD.gn
- LICENSE
- LICENSE.chromium_os
- base
- build
- build_overrides
- tools/gn
- testing/gmock
- testing/gtest
- testing/perf
- testing/libfuzzer
- testing/test.gni
- testing/*.h
- testing/*.cc
- testing/*.mm
- third_party/apple_apsl
- third_party/ced
- third_party/googletest
- third_party/libxml
- third_party/modp_b64
- third_party/tcmalloc
- third_party/win_build_output
- third_party/zlib
and the following git sub-repos exported into their respective directories:
- third_party/ced/src
- third_party/icu
- third_party/googletest/src
Furthermore, this fork adds some minor features as well as some bug fixes:
- Create build dir when necessary if it does not exist
- Change ordering of libs and config flags such that dependent libs and config flags have the least precedence
- Fix bootstrap builds
- Fix unresolved dependencies for sub-configs
- Fix invalid characters list for ninja rule names
- Fix help messages title for GN commands
- Fix duplicate pch ninja rules
- Fix action targets not using substitutions
- Fix errors when root build dir equals source root
- Fix static library link order to fix unresolved symbol link errors
- Fix
--all-toolchains
flag forgn ls
andgn refs
- Fix
gn args
regenerating ninja files with different command-line switches - Support binary targets for
get_target_outputs
function - Support source substitutions for binary targets
- Support for
command
in action targets - Support for
description
in action targets - Support for
sys_include_dirs
- Support for
cppflags
andasmppflags
- Support for source extension substitution
- Support specifying tool source file extentions
- Support specifying object file extentions
- Support specifying linker script extentions
- Support custom interpreter for action scripts and exec scripts
- Support custom interpreter for JSON IDE scripts
- Support
--all-toolchains
option for QtCreator generator - Add
define_switch
andinclude_switch
variables to toolchain function - Add
color_console
built-in variable - Add
console_pool
built-in variable - Add
gn_version
built-in variable - Allow
gn desc
to support multiple target labels - Allow clobbering in
forward_variables_from
- Use console pool to regenerate ninja files
- Use abs path for sources when output dir is outside root dir
For more information on GN and Ninja, please refer to the following links:
- Quick Start Guide
- FAQ
- Language and Operation Details
- Reference The built-in
gn help
documentation - Style Guide
- Cross compiling and toolchains
- Ninja Manual