Commands (type "gn help <command>" for more help):
analyze: Analyze which targets are affected by a list of files.
args: Display or configure arguments declared by the build.
check: Check header dependencies.
clean: Cleans the output directory.
desc: Show lots of insightful information about a target or config.
format: Format .gn file.
gen: Generate ninja files.
help: Does what you think.
ls: List matching targets.
path: Find paths between two targets.
refs: Find stuff referencing a target or file.
Target declarations (type "gn help <function>" for more help):
action: Declare a target that runs a script a single time.
action_foreach: Declare a target that runs a script over a set of files.
bundle_data: [iOS/macOS] Declare a target without output.
copy: Declare a target that copies files.
create_bundle: [iOS/macOS] Build an iOS or macOS bundle.
executable: Declare an executable target.
group: Declare a named group of targets.
loadable_module: Declare a loadable module target.
shared_library: Declare a shared library target.
source_set: Declare a source set target.
static_library: Declare a static library target.
target: Declare an target with the given programmatic type.
Buildfile functions (type "gn help <function>" for more help):
assert: Assert an expression is true at generation time.
config: Defines a configuration object.
declare_args: Declare build arguments.
defined: Returns whether an identifier is defined.
exec_script: Synchronously run a script and return the output.
foreach: Iterate over a list.
forward_variables_from: Copies variables from a different scope.
get_label_info: Get an attribute from a target's label.
get_path_info: Extract parts of a file or directory name.
get_target_outputs: [file list] Get the list of outputs from a target.
getenv: Get an environment variable.
import: Import a file into the current scope.
not_needed: Mark variables from scope as not needed.
pool: Defines a pool object.
print: Prints to the console.
process_file_template: Do template expansion over a list of files.
read_file: Read a file into a variable.
rebase_path: Rebase a file or directory to another location.
set_default_toolchain: Sets the default toolchain name.
set_defaults: Set default values for a target type.
set_sources_assignment_filter: Set a pattern to filter source files.
split_list: Splits a list into N different sub-lists.
template: Define a template rule.
tool: Specify arguments to a toolchain tool.
toolchain: Defines a toolchain.
write_file: Write a file to disk.
Built-in predefined variables (type "gn help <variable>" for more help):
current_cpu: [string] The processor architecture of the current toolchain.
current_os: [string] The operating system of the current toolchain.
current_toolchain: [string] Label of the current toolchain.
default_toolchain: [string] Label of the default toolchain.
host_cpu: [string] The processor architecture that GN is running on.
host_os: [string] The operating system that GN is running on.
invoker: [string] The invoking scope inside a template.
python_path: [string] Absolute path of Python.
root_build_dir: [string] Directory where build commands are run.
root_gen_dir: [string] Directory for the toolchain's generated files.
root_out_dir: [string] Root directory for toolchain output files.
target_cpu: [string] The desired cpu architecture for the build.
target_gen_dir: [string] Directory for a target's generated files.
target_name: [string] The name of the current target.
target_os: [string] The desired operating system for the build.
target_out_dir: [string] Directory for target output files.
Variables you set in targets (type "gn help <variable>" for more help):
all_dependent_configs: [label list] Configs to be forced on dependents.
allow_circular_includes_from: [label list] Permit includes from deps.
arflags: [string list] Arguments passed to static_library archiver.
args: [string list] Arguments passed to an action.
asmflags: [string list] Flags passed to the assembler.
assert_no_deps: [label pattern list] Ensure no deps on these targets.
bundle_contents_dir: Expansion of {{bundle_contents_dir}} in create_bundle.
bundle_deps_filter: [label list] A list of labels that are filtered out.
bundle_executable_dir: Expansion of {{bundle_executable_dir}} in create_bundle
bundle_plugins_dir: Expansion of {{bundle_plugins_dir}} in create_bundle.
bundle_resources_dir: Expansion of {{bundle_resources_dir}} in create_bundle.
bundle_root_dir: Expansion of {{bundle_root_dir}} in create_bundle.
cflags: [string list] Flags passed to all C compiler variants.
cflags_c: [string list] Flags passed to the C compiler.
cflags_cc: [string list] Flags passed to the C++ compiler.
cflags_objc: [string list] Flags passed to the Objective C compiler.
cflags_objcc: [string list] Flags passed to the Objective C++ compiler.
check_includes: [boolean] Controls whether a target's files are checked.
code_signing_args: [string list] Arguments passed to code signing script.
code_signing_outputs: [file list] Output files for code signing step.
code_signing_script: [file name] Script for code signing.
code_signing_sources: [file list] Sources for code signing step.
complete_static_lib: [boolean] Links all deps into a static library.
configs: [label list] Configs applying to this target or config.
data: [file list] Runtime data file dependencies.
data_deps: [label list] Non-linked dependencies.
defines: [string list] C preprocessor defines.
depfile: [string] File name for input dependencies for actions.
deps: [label list] Private linked dependencies.
friend: [label pattern list] Allow targets to include private headers.
include_dirs: [directory list] Additional include directories.
inputs: [file list] Additional compile-time dependencies.
ldflags: [string list] Flags passed to the linker.
lib_dirs: [directory list] Additional library directories.
libs: [string list] Additional libraries to link.
output_dir: [directory] Directory to put output file in.
output_extension: [string] Value to use for the output's file extension.
output_name: [string] Name for the output file other than the default.
output_prefix_override: [boolean] Don't use prefix for output name.
outputs: [file list] Output files for actions and copy targets.
partial_info_plist: [filename] Path plist from asset catalog compiler.
pool: [string] Label of the pool used by the action.
precompiled_header: [string] Header file to precompile.
precompiled_header_type: [string] "gcc" or "msvc".
precompiled_source: [file name] Source file to precompile.
product_type: [string] Product type for Xcode projects.
public: [file list] Declare public header files for a target.
public_configs: [label list] Configs applied to dependents.
public_deps: [label list] Declare public dependencies.
response_file_contents: [string list] Contents of .rsp file for actions.
script: [file name] Script file for actions.
sources: [file list] Source files for a target.
testonly: [boolean] Declares a target must only be used for testing.
visibility: [label list] A list of labels that can depend on a target.
write_runtime_deps: Writes the target's runtime_deps to the given path.
xcode_extra_attributes: [scope] Extra attributes for Xcode projects.
test_application_name: [string] Test application name for unit or ui test target.
Other help topics:
all: Print all the help at once
buildargs: How build arguments work.
dotfile: Info about the toplevel .gn file.
execution: Build graph and execution overview.
grammar: Language and grammar for GN build files.
input_conversion: Processing input from exec_script and read_file.
label_pattern: Matching more than one label.
labels: About labels.
ninja_rules: How Ninja build rules are named.
nogncheck: Annotating includes for checking.
runtime_deps: How runtime dependency computation works.
source_expansion: Map sources to outputs for scripts.
switches: Show available command-line switches.