Generate-Ninja, or GN, is a meta-build system that generates Ninja build files so that you can build your project with Ninja.
GN was, originally, part of the Chromium source tree, and has since been extracted into its own standalone repo. However, this is a fork of the official GN, adding 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
- Separate bootstrap vs integration 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-toolchainsflag forgn lsandgn refs - Fix
gn argsregenerating ninja files with different command-line switches - Fix
gn descwhen showingoutputsonly - Allow
gn descto support multiple target labels - Support binary targets for
get_target_outputsfunction - Support source substitutions for binary targets
- Support for
commandin action targets - Support for
descriptionin action targets - Support for
sys_include_dirs - Support for
cppflagsandasmppflags - 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-toolchainsoption for QtCreator generator - Support separate compilation database per toolchain
- Add
define_switchandinclude_switchvariables to toolchain function - Add
color_consolebuilt-in variable - Add
console_poolbuilt-in variable - Add
gn_versionbuilt-in variable - Allow
gn descto 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
- Add
build_argstobuild_settingsin JSON project file
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 helpdocumentation - Style Guide
- Cross compiling and toolchains
- Ninja Manual