Lines Matching +full:rust +full:- +full:embedded
3 *This page is automatically generated from* `gn help --markdown all`.
32 * [rust_library: Declare a Rust library target.](#func_rust_library)
33 * [rust_proc_macro: Declare a Rust procedural macro target.](#func_rust_proc_macro)
65 * [split_list: Splits a list into N different sub-lists.](#func_split_list)
73 * [Built-in predefined variables](#predefined_variables)
92 * [aliased_deps: [scope] Set of crate-dependency pairs.](#var_aliased_deps)
99 * [bridge_header: [string] Path to C/Objective-C compatibility header.](#var_bridge_header)
111 …* [code_signing_args: [string list] [deprecated] Args for the post-processing script.](#var_code…
112 …* [code_signing_outputs: [file list] [deprecated] Outputs of the post-processing step.](#var_cod…
113 …* [code_signing_script: [file name] [deprecated] Script for the post-processing step.](#var_code…
114 …* [code_signing_sources: [file list] [deprecated] Sources for the post-processing step.](#var_co…
122 * [data_deps: [label list] Non-linked dependencies.](#var_data_deps)
127 * [externs: [scope] Set of Rust crate-dependency pairs.](#var_externs)
133 * [inputs: [file list] Additional compile-time dependencies.](#var_inputs)
148 …* [post_processing_args: [string list] Args for the post-processing script.](#var_post_processin…
149 …* [post_processing_outputs: [file list] Outputs of the post-processing step.](#var_post_processi…
150 …* [post_processing_script: [file name] Script for the post-processing step.](#var_post_processin…
151 …* [post_processing_sources: [file list] Sources for the post-processing step.](#var_post_process…
161 * [rustflags: [string list] Flags passed to the Rust compiler.](#var_rustflags)
190 * [switches: Show available command-line switches.](#switch_list)
205 - "files": A list of the filenames to check.
207 - "test_targets": A list of the labels for targets that are needed to run
210 - "additional_compile_targets" (optional): A list of the labels for targets
219 pseudo-group that contains every root target in the build graph.
226 If input_path is -, input is read from stdin.
232 - "compile_targets": A list of the labels derived from the input
237 - "test_targets": A list of the labels from the input test_targets list that
241 - "invalid_targets": A list of any names from the input that do not exist in
242 the build graph. If this list is non-empty, the "error" field will also be
245 - "status": A string containing one of three values:
247 - "Found dependency"
248 - "No dependency"
249 - "Found dependency (all)"
257 - "error": This will only be present if an error occurred, and will contain
261 If output_path is -, output is written to stdout.
266 "error" key is non-empty and a non-fatal error occurred. In other words, it
270 ### <a name="cmd_args"></a>**gn args**: (command-line tool)
275 gn args <out_dir> [--list] [--short] [--args] [--overrides-only]
277 See also "gn help buildargs" for a more high-level overview of how
299 gn args <out_dir> --list[=<exact_arg>] [--short] [--overrides-only] [--json]
308 If --short is specified, only the names and current values will be
311 If --overrides-only is specified, only the names and current values of
312 arguments that have been overridden (i.e. non-default arguments) will
315 If --json is specified, the output will be emitted in json format.
342 gn args out/Debug --list --short
346 gn args out/Debug --list --short --overrides-only
349 gn args out/Debug --list=target_cpu
354 gn args --list --args="os=\"android\" enable_doom_melon=true"
359 …cmd_check"></a>**gn check <out_dir> [<label_pattern>] [\--force] [\--check-generated]**
362 GN's include header checker validates that the includes for C-like source
365 "gn check" is the same thing as "gn gen" with the "--check" flag except that
374 #### **Command-specific switches**
377 --check-generated
382 --check-system
386 --default-toolchain
391 Non-wildcard inputs with no explicit toolchain specification will
394 --force
408 Targets can opt-out from checking with "check_includes = false" (see
413 - GN opens all C-like source files in the targets to be checked and scans
416 - Generated files (that might not exist yet) are ignored unless
417 the --check-generated flag is provided.
419 - Includes with a "nogncheck" annotation are skipped (see
422 - Includes using "quotes" are always checked.
426 - Include paths are assumed to be relative to any of the "include_dirs" for
429 - GN does not run the preprocessor so will not understand conditional
432 - Only includes matching known files in the build are checked: includes
437 - The included file must be in the current target, or there must be a path
441 - There can be multiple targets with an included file: only one needs to be
444 - If there are only "sources" in a target, all are considered to be public
447 - If a target lists files as "public", only those files are able to be
451 - Outputs from actions are treated like public sources on that target.
453 - A target can include headers from a target that depends on it if the
477 no-op from a build perspective, but will give a central place to refer to
503 ### <a name="cmd_clean_stale"></a>**gn clean_stale [\--ninja-executable=...] <out_dir>...**
512 executable must be provided by the --ninja-executable switch.
518 --ninja-executable=<string>
524 gn desc <out_dir> <label or pattern> [<what to show>] [--blame]
525 [--format=json]
542 arflags [--blame]
544 cflags [--blame]
545 cflags_c [--blame]
546 cflags_cc [--blame]
548 configs [--tree] (see below)
550 defines [--blame]
552 deps [--all] [--tree] (see below)
555 include_dirs [--blame]
557 ldflags [--blame]
580 "--blame" to see the source of the dependency.
586 --default-toolchain
591 Non-wildcard inputs with no explicit toolchain specification will
594 --format=json
601 --blame
616 Configs can have child configs. Specifying --tree will show the hierarchy.
633 --all
635 usable with --tree (see below).
637 --as=(buildfile|label|output)
649 --testonly=(true|false)
654 --tree
656 but when --all and -tree are used together, no eliding will be performed.
661 Tree output can not be used with the filtering or output flags: --as,
662 --type, --testonly.
664 --type=(action|copy|executable|group|loadable_module|shared_library|
685 gn desc out/Foo :base_unittests deps --tree
689 gn desc out/Debug //base defines --blame
693 ### <a name="cmd_format"></a>**gn format [\--dump-tree] (\--stdin | <list of build_files...>)…
712 --dry-run
714 anything to disk. This is useful for presubmit/lint-type checks.
715 - Exit code 0: successful format, matches on disk.
716 - Exit code 1: general failure (parse error, etc.)
717 - Exit code 2: successful format, but differs from on disk.
719 --dump-tree[=( text | json )]
723 --stdin
725 in-place.
727 --read-tree=json
728 Reads an AST from stdin in the format output by --dump-tree=json and
729 uses that as the parse tree. (The only read-tree format currently
739 gn format --stdin
740 gn format --read-tree=json //rewritten/BUILD.gn
742 ### <a name="cmd_gen"></a>**gn gen [\--check] [<ide options>] <out_dir>**
748 The output directory can be a source-repo-absolute path name such as:
753 "gn gen --check" is the same as running "gn check". "gn gen --check=system" is
754 the same as running "gn check --check-system". See "gn help check" for
757 See "gn help switches" for the common command-line switches.
763 --ninja-executable=<string>
767 restat on generated ninja files and for use with --clean-stale.
769 --clean-stale
774 provided by the --ninja-executable switch. Also see "gn help clean_stale".
783 --ide=<ide_name>
785 "eclipse" - Eclipse CDT settings file.
786 "vs" - Visual Studio project/solution files.
788 "vs2013" - Visual Studio 2013 project/solution files.
789 "vs2015" - Visual Studio 2015 project/solution files.
790 "vs2017" - Visual Studio 2017 project/solution files.
791 "vs2019" - Visual Studio 2019 project/solution files.
792 "vs2022" - Visual Studio 2022 project/solution files.
793 "xcode" - Xcode workspace/solution files.
794 "qtcreator" - QtCreator project files.
795 "json" - JSON file containing target information
797 --filters=<path_prefixes>
798 Semicolon-separated list of label patterns used to limit the set of
807 --sln=<file_name>
811 --no-deps
813 --filters option works. Only directly matching targets are included.
815 --winsdk=<sdk_version>
820 --ninja-executable=<string>
823 --ninja-extra-args=<string>
825 command-line. Can be used to configure ninja flags, like "-j".
831 --xcode-project=<file_name>
835 --xcode-build-system=<value>
838 "legacy" - Legacy Build system
839 "new" - New Build System
841 --xcode-configs=<config_name_list>
843 project. If specified, must be a list of semicolon-separated strings.
847 --xcode-config-build-dir=<string>
858 --xcode-additional-files-patterns=<pattern_list>
859 If present, must be a list of semicolon-separated file patterns. It
864 --xcode-additional-files-roots=<path_list>
865 If present, must be a list of semicolon-separated paths. It will be used
869 --ninja-executable=<string>
872 --ninja-extra-args=<string>
874 command-line. Can be used to configure ninja flags, like "-j".
876 --ide-root-target=<target_name>
884 --ide-root-target=<target_name>
910 --json-file-name=<json_file_name>
913 --json-ide-script=<path_to_python_script>
919 --json-ide-script-args=<argument>
926 The --ninja-outputs-file=<FILE> option dumps a JSON file that maps GN labels
941 --ninja-outputs-script=<path_to_python_script>
947 --ninja-outputs-script-args=<argument>
954 --export-rust-project
955 Produces a rust-project.json file in the root of the build directory
956 This is used for various tools in the Rust ecosystem allowing for the
960 --add-export-compile-commands=<label_pattern>
971 --add-export-compile-commands=//tools:my_tool
972 --add-export-compile-commands="//base/*"
974 --export-compile-commands[=<target_name1,target_name2...>]
976 Please use --add-export-compile-commands for per-user configuration, and
977 the "export_compile_commands" value in the project-level .gn file (see
978 "gn help dotfile") for per-project configuration.
981 "gn help dotfile") as well as the --add-export-compile-commands switch.
986 - "//path/to/src:foo"
987 - "//other/path:foo"
988 - "//foo:foo"
990 - "//foo:bar"
1004 --markdown
1011 gn help --markdown all
1014 …e="cmd_ls"></a>**gn ls <out_dir> [<label_pattern>] [\--default-toolchain] [\--as=...]**
1016 [--type=...] [--testonly=...]
1030 --as=(buildfile|label|output)
1042 --default-toolchain
1047 Non-wildcard inputs with no explicit toolchain specification will
1050 --testonly=(true|false)
1055 --type=(action|copy|executable|group|loadable_module|shared_library|
1073 gn ls out/Debug //base --as=output
1076 gn ls out/Debug --type=executable
1079 gn ls out/Debug "//base/*" --as=output | xargs ninja -C out/Debug
1085 gn meta <out_dir> <target>* --data=<key>[,<key>*]* [--walk=<key>[,<key>*]*]
1086 [--rebase=<dest dir>]
1100 --data
1101 A comma-separated list of keys from which to extract data. In each target
1106 --walk (optional)
1107 A comma-separated list of keys from which to control the walk. In each
1114 --rebase (optional)
1123 gn meta out/Debug "//base/foo" --data=files
1127 gn meta out/Debug "//base/foo" --data=files,other
1131 gn meta out/Debug "//base/foo" --data=files --walk=stop
1135 gn meta out/Debug "//base/foo" --data=files --rebase="/"
1149 - The input target/file names are relative to the current directory.
1151 - The output file names are relative to the root build directory.
1188 gn outputs out/debug src/project/my_file.cc | xargs ninja -C out/debug
1191 git diff --name-only | xargs gn outputs out/x64 | xargs ninja -C out/x64
1205 --with-data is specified, data deps will also be considered. If there are
1213 very high level and a common low-level target. To make the output more useful
1214 (and terminate in a reasonable time), GN will not revisit sub-paths
1221 --all
1224 by non-public paths in order of increasing length.
1226 --public
1227 Considers only public paths. Can't be used with --with-data.
1229 --with-data
1231 linked deps will be followed. Can't be used with --public.
1242 gn refs <out_dir> (<label_pattern>|<label>|<file>|@<response_file>)* [--all]
1243 [--default-toolchain] [--as=...] [--testonly=...] [--type=...]
1248 - Target label: The result will be which targets depend on it.
1250 - Config label: The result will be which targets list the given config in
1253 - Label pattern: The result will be which targets depend on any target
1257 - File name: The result will be which targets list the given file in its
1262 - Response file: If the input starts with an "@", it will be interpreted as
1271 --all
1272 When used without --tree, will recurse and display all unique
1278 When used with --tree, turns off eliding to show a complete tree.
1280 --as=(buildfile|label|output)
1292 --default-toolchain
1297 Non-wildcard inputs with no explicit toolchain specification will
1300 -q
1305 --testonly=(true|false)
1310 --tree
1312 be elided. Combine with --all to see a full dependency tree.
1314 Tree output can not be used with the filtering or output flags: --as,
1315 --type, --testonly.
1317 --type=(action|copy|executable|group|loadable_module|shared_library|
1329 gn refs out/Debug //base:i18n --as=buildfile | xargs gvim
1332 gn refs out/Debug //base --all
1343 gn refs out/Debug //base --tree
1353 gn refs out/Debug //base/macros.h --tree
1357 gn refs out/Debug //base/macros.h //base/at_exit.h --all
1361 gn refs out/Debug //base/macros.h --testonly=true --type=executable
1362 --all --as=output
1402 implement custom compiler-like tools.
1409 for runtime-only dependencies.
1476 args = [ "--out", rebase_path(target_gen_dir, root_build_dir) ] +
1483 This target type allows you to run a script once-per-file over a set of
1513 for runtime-only dependencies.
1590 "-o",
1607 generate iOS/macOS bundle. In cross-platform projects, it is advised to put it
1627 Bundle-specific: sources*, outputs*
1649 "src/MaterialTypography.bundle/Roboto-Bold.ttf",
1650 "src/MaterialTypography.bundle/Roboto-Italic.ttf",
1651 "src/MaterialTypography.bundle/Roboto-Regular.ttf",
1652 "src/MaterialTypography.bundle/Roboto-Thin.ttf",
1699 # Write a rule that copies a checked-in DLL to the output directory.
1736 well-know structure). This target does not define any sources, instead they
1745 generate iOS or macOS bundle. In cross-platform projects, it is advised to put
1755 #### **Post-processing**
1758 Some bundle needs to be post-processed as part of the build (e.g. on iOS all
1767 be defined and non-empty to inform when the script needs to be re-run. The
1775 The post-processing step used to be limited to code-signing. The properties
1848 product_type = "com.apple.product-type.application"
1877 "$bundle_root_dir/embedded.mobileprovision",
1881 "-i=" + ios_post_processing_identity,
1882 "-b=" + rebase_path(
1884 "-e=" + rebase_path(
1886 "-e=" + rebase_path(
1904 multiple compiler-incompatible languages are not allowed (e.g. a
1906 target containing C and Rust sources is not).
1922 Rust variables: aliased_deps, crate_root, crate_name
2060 This target type allows you to create meta-targets that just collect a set of
2103 multiple compiler-incompatible languages are not allowed (e.g. a
2105 target containing C and Rust sources is not).
2121 Rust variables: aliased_deps, crate_root, crate_name, crate_type
2123 ### <a name="func_rust_library"></a>**rust_library**: Declare a Rust library target.
2126 A Rust library is an archive containing additional rust-c provided metadata.
2128 extension, and are the intermediate step for most Rust-based binaries.
2136 multiple compiler-incompatible languages are not allowed (e.g. a
2138 target containing C and Rust sources is not).
2154 Rust variables: aliased_deps, crate_root, crate_name
2156 ### <a name="func_rust_proc_macro"></a>**rust_proc_macro**: Declare a Rust procedural macro target.
2159 A Rust procedural macro allows creating syntax extensions as execution of a
2163 Their use is the same as of other Rust libraries, but their build has some
2172 multiple compiler-incompatible languages are not allowed (e.g. a
2174 target containing C and Rust sources is not).
2190 Rust variables: aliased_deps, crate_root, crate_name
2207 multiple compiler-incompatible languages are not allowed (e.g. a
2209 target containing C and Rust sources is not).
2225 Rust variables: aliased_deps, crate_root, crate_name, crate_type
2230 Only C-language source sets are supported at the moment.
2233 #### **C-language source_sets**
2296 Rust variables: aliased_deps, crate_root, crate_name
2300 multiple compiler-incompatible languages are not allowed (e.g. a
2302 target containing C and Rust sources is not).
2309 The target() function is a way to invoke a built-in target or template with a
2313 Only templates and built-in target functions are supported for the
2383 3. Public_configs from a breadth-first traversal of the dependency tree in
2385 4. All dependent configs from a breadth-first traversal of the dependency
2392 Configs solve a problem where the build system needs to have a higher-level
2396 de-duplicate flags even though raw command-line parameters can't always be
2401 so can be de-duplicated. It allows related settings to be grouped so they
2404 having to hard-coding every compiler's flags each time they are referred to.
2442 will not override command-line values.
2457 3. User-defined overrides are applied. Anything set in "gn args" now
2463 - You should not perform difficult work inside a declare_args block since
2466 want to have a script-defined default, set some default "undefined" value
2467 like [], "", or -1, and after the declare_args block, call exec_script if
2470 - Because you cannot read the value of a variable defined in the same
2472 on the possibly-overridden value of another, write two separate
2479 # Bar defaults to same user-overridden state as foo.
2493 gn --args="enable_doom_melon=true enable_teleporter=true"
2564 File name of script to execute. Non-absolute names will be treated as
2581 re-run.
2712 variables defined in the template invocation to a template-defined target.
2729 If variables_to_not_forward_list is non-empty, then it must contains a list
2902 relative to the current directory, and then the source- absolute version
2903 will be returned. If the input is system- absolute, the same input will
2911 system-absolute, see rebase_path().
2923 # Extract the source-absolute directory name,
2985 case-sensitive.
3250 If you want to convert a file path to be source-absolute (that is, beginning
3254 it can't also generate source-absolute paths without more special-cases.
3268 to the current BUILD-file's directory).
3271 paths will be converted to system-absolute native style paths with system
3278 current BUILD-file's directory.
3285 a list of strings). All relative and source-absolute file names will be
3286 converted to be relative to the requested output System-absolute paths will
3319 "--data",
3321 "--rel",
3337 separately for each toolchain, this function will be a no-op when called
3338 under any non-default toolchains.
3341 environment. If the current environment is 32-bit and somebody references a
3342 target with a 64-bit toolchain, we wouldn't want processing of the build
3343 config file for the 64-bit toolchain to reset the default toolchain to
3344 64-bit, we want to keep it 32-bits.
3379 set_defaults can be used for built-in target types ("executable",
3395 # The configs will be auto-populated as above. You can remove it if
3397 configs -= [ "//tools/mything:settings" ]
3400 ### <a name="func_split_list"></a>**split_list**: Splits a list into N different sub-lists.
3405 Given a list and a number N, splits the list into N sub-lists of
3406 approximately equal size. The return value is a list of the sub-lists. The
3434 string_join("", ["a", "b", "c"]) --> "abc"
3435 string_join("|", ["a", "b", "c"]) --> "a|b|c"
3436 string_join(", ", ["a", "b", "c"]) --> "a, b, c"
3437 string_join("s", ["", ""]) --> "s"
3475 string_split("") --> []
3476 string_split("a") --> ["a"]
3477 string_split(" aa bb") --> ["aa", "bb"]
3483 string_split("", "|") --> [""]
3484 string_split(" a b ", " ") --> ["", "", "a", "b", "", ""]
3485 string_split("aa+-bb+-c", "+-") --> ["aa", "bb", "c"]
3491 to add to the built-in target types.
3535 Your template should almost always define a built-in target with the name the
3562 You can use template to redefine a built-in target in which case your template
3563 takes a precedence over the built-in one. All uses of the target from within
3564 the template definition will refer to the built-in target which makes it
3565 possible to extend the behavior of the built-in target:
3687 Rust tools:
3688 "rust_bin": Tool for compiling Rust binaries
3689 "rust_cdylib": Tool for compiling C-compatible dynamic libraries.
3690 "rust_dylib": Tool for compiling Rust dynamic libraries.
3691 "rust_macro": Tool for compiling Rust procedural macros.
3692 "rust_rlib": Tool for compiling Rust libraries.
3693 "rust_staticlib": Tool for compiling Rust static libraries.
3723 potentially with target-specific overrides. It is the tool's job to use
3736 along, potentially with target-specific overrides. One would typically
3766 exe_output_extension [string, optional, rust tools only]
3767 rlib_output_extension [string, optional, rust tools only]
3768 dylib_output_extension [string, optional, rust tools only]
3769 cdylib_output_extension [string, optional, rust tools only]
3770 rust_proc_macro_output_extension [string, optional, rust tools only]
3771 Valid for: Rust tools
3775 ".rlib" for rlibs. Note that the Rust compiler complains with an error
3789 lib_switch = "-l"
3790 lib_dir_switch = "-L"
3794 "-lfreetype -lexpat".
3806 framework_switch = "-framework "
3807 weak_framework_switch = "-weak_framework "
3808 framework_dir_switch = "-F"
3814 "-F. -framework UIKit -framework Foo -weak_framework MediaPlayer"
3820 that are embedded in the linker output.
3823 swiftmodule_swift = "-Wl,-add_ast_path,"
3827 "-Wl,-add_ast_path,obj/foo/Foo.swiftmodule"
3901 Individual targets can opt-out of the output prefix by setting:
3918 "msvc"-style headers, a "precompiled_source" value. If the type is
3951 around OS command-line length limits.
3956 command = "link -o {{output}} {{ldflags}} @{{output}}.rsp"
3969 Valid for: Rust tools
3972 process, but may be used when generating metadata for rust-analyzer.
3973 (See --export-rust-project). It enables such metadata to include
3974 information about the Rust standard library.
3977 Valid for: Rust tools which link
3981 For ld-like linkers, -Clink-arg=-Bdynamic may be a good choice.
3983 listing any non-Rust dependencies. This may be necessary because
4034 with a set of compiler-specific flags. The following expansions are
4047 Example: "--enable-foo --enable-bar"
4049 Defines will be prefixed by "-D" and include directories will be
4050 prefixed by "-I" (these work with Posix tools as well as Microsoft
4092 take a "-filelist" flag which expects newline separated files, and some
4093 Microsoft tools have a fixed-sized buffer for parsing each line of a
4099 Example: "-m64 -fPIC -pthread -L/usr/local/mylib"
4105 Example: "-lfoo -lbar"
4139 Any Rust .rlibs which need to be linked into a final C++ target.
4149 {{frameworks}} and each item will be preceded by "-framework" or
4150 "-weak_framework".
4153 Swift .swiftmodule files that needs to be embedded into the binary.
4155 Swift compiler (the .swiftmodule file cannot be embedded in object
4209 Expands to the list of -I<path> for the target Swift module search
4215 Rust tools have the notion of a single input and a single output, along
4216 with a set of compiler-specific flags. The following expansions are
4228 Expands to the list of --extern flags needed to include addition Rust
4232 Expands to the list of -Ldependency=<path> strings needed to compile
4239 Expands to the list of strings representing Rust compiler flags.
4246 dependent targets be re-linked. If the shared library is changed but no
4252 can be used for triggering re-links, while the actual shared library would be
4280 lib_switch = "-l"
4281 lib_dir_switch = "-L"
4284 command = "gcc {{source}} -o {{output}}"
4289 command = "g++ {{source}} -o {{output}}"
4308 parameters of each target (or which targets exist) on a per-toolchain basis.
4327 2. Re-runs the master build configuration file, applying the arguments
4332 The toolchain configuration is two-way. In the default toolchain (i.e. the
4338 toolchain definition specifies the arguments to re-invoke the build.
4354 configuration file is re-interpreted in the context of that toolchain.
4377 When true, configs (public and all-dependent) will cross the boundary out
4408 use_doom_melon = true # Doom melon always required for 32-bit builds.
4426 #### **Example of cross-toolchain dependencies**
4429 If a 64-bit target wants to depend on a 32-bit binary, it would specify a
4431 runtime and aren't linked, since you can't link a 32-bit and a 64-bit
4437 # The 64-bit build needs this 32-bit helper.
4443 # Our helper library is only compiled in 32-bits.
4454 If data is a list, the list will be written one-item-per-line with no quoting
4478 ## <a name="predefined_variables"></a>Built-in predefined variables
4511 A fully-qualified label representing the current toolchain. You can use this
4512 to make toolchain-related decisions in the build. See also
4526 A fully-qualified label representing the default toolchain, which may not
4532 Corresponds to the number printed by `gn --version`.
4543 This is value is exposed so that cross-compile toolchains can access the host
4546 The value should generally be considered read-only, but it can be overridden
4548 values for the host architecture (e.g., if you can do either 32-bit or 64-bit
4555 - "x64"
4556 - "x86"
4561 This value is exposed so that cross-compiles can access the host build
4564 This value should generally be treated as read-only. It, however, is not used
4571 - "linux"
4572 - "mac"
4573 - "win"
4660 args = [ "-o", rebase_path(root_out_dir, root_build_dir) ]
4671 cross-compiles, this can be set to something different. This value is
4686 - "x86"
4687 - "x64"
4688 - "arm"
4689 - "arm64"
4690 - "mipsel"
4691 - "mips64el"
4692 - "s390x"
4693 - "ppc64"
4694 - "riscv32"
4695 - "riscv64"
4696 - "e2k"
4697 - "loong64"
4720 args = [ "-o", rebase_path(target_gen_dir, root_build_dir) ]
4770 cross-compiles, it may be different. This variable differs from "current_os"
4795 - "android"
4796 - "chromeos"
4797 - "ios"
4798 - "linux"
4799 - "nacl"
4800 - "mac"
4801 - "win"
4823 args = [ "-o", rebase_path(target_out_dir, root_build_dir) ]
4828 ### <a name="var_aliased_deps"></a>**aliased_deps**: [scope] Set of crate-dependency pairs.
4832 `shared_library` targets that contain Rust sources.
4845 `rustc ...command... --extern bar=<build_out_dir>/obj/bar`
4856 `rustc ...command... --extern bar_renamed=<build_out_dir>/obj/bar`
4869 force-added configs in their "configs" variable while the script is running,
4913 the --check flag to "gn gen" -- see "gn help check").
4974 any other target type will be a no-op. As with ldflags, you could put the
5009 allow actions that run compiler or compiler-like tools to access the results
5012 args = [ "{{defines}}", "{{include_dirs}}", "{{rustenv}}", "--input-file",
5059 non-distributable code).
5083 ### <a name="var_bridge_header"></a>**bridge_header**: [string] Path to C/Objective-C compatibility…
5088 Path to an header that includes C/Objective-C functions and types that
5197 "cflags_objc", and "cflags_objcc", respectively. These variant-specific
5201 See also "asmflags" for flags for assembly-language files, "swiftflags" for
5202 swift files, and "rustflags" for Rust files.
5231 "cflags_objc", and "cflags_objcc", respectively. These variant-specific
5235 See also "asmflags" for flags for assembly-language files, "swiftflags" for
5236 swift files, and "rustflags" for Rust files.
5265 "cflags_objc", and "cflags_objcc", respectively. These variant-specific
5269 See also "asmflags" for flags for assembly-language files, "swiftflags" for
5270 swift files, and "rustflags" for Rust files.
5299 "cflags_objc", and "cflags_objcc", respectively. These variant-specific
5303 See also "asmflags" for flags for assembly-language files, "swiftflags" for
5304 swift files, and "rustflags" for Rust files.
5333 "cflags_objc", and "cflags_objcc", respectively. These variant-specific
5337 See also "asmflags" for flags for assembly-language files, "swiftflags" for
5338 swift files, and "rustflags" for Rust files.
5362 --check flag) will check this target's sources and headers for proper
5386 …ng_args"></a>**code_signing_args**: [string list] [deprecated] Args for the post-processing script.
5390 pass to the post-processing script. Typically you would use source expansion
5399 …utputs"></a>**code_signing_outputs**: [file list] [deprecated] Outputs of the post-processing step.
5402 Outputs from the post-processing step of a create_bundle target. Must refer to
5411 …script"></a>**code_signing_script**: [file name] [deprecated] Script for the post-processing step."
5414 An absolute or buildfile-relative file name of a Python script to run for a
5415 create_bundle target to perform the post-processing step.
5423 …urces"></a>**code_signing_sources**: [file list] [deprecated] Sources for the post-processing step.
5426 A list of files used as input for the post-processing step of a create_bundle
5427 target. Non-absolute paths will be resolved relative to the current build
5454 GN treats non-complete static libraries as source sets when they are linked
5487 flag instead, you can put that flag in a one-off config and append that
5503 own values, and in order, the values from its sub-configs *before* anything
5506 - A target has no visibility into a config's sub-configs. Target code only
5507 sees the name of the composite config. It can't remove sub-configs or opt
5511 - You can get duplication of values if a config is listed twice, say, on a
5512 target and in a sub-config that also applies. In other cases, the configs
5513 applying to a target are de-duped. It's expected that if a config is
5514 listed as a sub-config that it is only used in that context. (Note that
5515 it's possible to fix this and de-dupe, but it's not normally relevant and
5543 configs -= [ "//build:no_rtti" ]
5574 `shared_library`, and `source_set` targets that contain Rust sources.
5582 `shared_library`, and `source_set` targets that contain Rust sources.
5595 `shared_library`, and `source_set` targets that contain Rust sources.
5597 Options for this field are "cdylib", "staticlib", "proc-macro", and "dylib".
5598 This field sets the `crate-type` attribute for the `rustc` tool on static
5601 crate type (where the Rust compiler produces what it thinks is the
5604 It should be noted that the "dylib" crate type in Rust is unstable in the set
5608 Static libraries, rust libraries, and executables have this field set
5624 "--runtime-deps-list-file".
5626 GN doesn't require data files to exist at build-time. So actions that produce
5640 ### <a name="var_data_deps"></a>**data_deps**: Non-linked dependencies.
5742 # Say our script uses "-o <d file>" to indicate the depfile.
5743 args = [ "{{source}}", "-o", rebase_path(depfile, root_build_dir)]
5760 Source sets, shared libraries, and non-complete static libraries will be
5761 propagated up the dependency tree across groups, non-complete static
5774 For Rust targets, deps ensures that Rust code can refer to the dependency
5776 be made available to Rust for `#[link]` directives.
5783 ### <a name="var_externs"></a>**externs**: [scope] Set of Rust crate-dependency pairs.
5787 to the Rust library.
5789 These libraries will be passed as `--extern crate_name=path` to compiler
5805 `--extern bar=path/to/bar.rlib`.
5976 ### <a name="var_inputs"></a>**inputs**: Additional compile-time dependencies.
5979 Inputs are compile-time dependencies of the current target. This means that
6003 running GN to determine the inputs, and is easier to keep in-sync than
6017 and all inputs are up to date, the script will not re-run and you will get a
6021 when it has changed in any way and the action will re-run.
6051 These flags are passed on the command-line to the linker and generally
6056 static libraries will be a no-op. If you want to apply ldflags to dependent
6153 specify the switch (like "-l"): this will be encoded in the "lib_switch"
6313 output prefix of a linker tool on a per- target basis. If you need more
6378 with the application Info.plist (usually done by the post-processing script).
6386 A fully-qualified label representing the pool that will be used for binary
6403 …t_processing_args"></a>**post_processing_args**: [string list] Args for the post-processing script.
6407 pass to the post-processing script. Typically you would use source expansion
6412 …ocessing_outputs"></a>**post_processing_outputs**: [file list] Outputs of the post-processing step.
6415 Outputs from the post-processing step of a create_bundle target. Must refer to
6420 …rocessing_script"></a>**post_processing_script**: [file name] Script for the post-processing step."
6423 An absolute or buildfile-relative file name of a Python script to run for a
6424 create_bundle target to perform the post-processing step.
6428 …cessing_sources"></a>**post_processing_sources**: [file list] Sources for the post-processing step.
6431 A list of files used as input for the post-processing step of a create_bundle
6432 target. Non-absolute paths will be resolved relative to the current build
6458 When using GCC-style precompiled headers, "precompiled_source" contains the
6462 The value of "precompiled_header" is not used with GCC-style precompiled
6469 When using MSVC-style precompiled headers, the "precompiled_header" value is
6477 this IS a GN-style file name, and tells GN which source file to compile to
6495 # first, or you can do this to force-include the header.
6514 "msvc"-style precompiled headers. It will be implicitly added to the sources
6526 "create_bundle" with a non-empty product_type will have a corresponding
6547 dependency A -> B -> C, then A can include C's public headers. However, the
6562 any compile-time dependencies up the dependency tree. In this case, the build
6565 A (shared library) -> B (shared library) -> C (action).
6624 force-added configs in their "configs" variable while the script is running,
6682 - public_configs that are part of the dependency are forwarded to direct
6685 - Public headers in the dependency are usable by dependents (includes do
6688 - If the current target is a shared library, other shared libraries that it
6698 Say you have three targets: A -> B -> C. C's visibility may allow B to depend
6744 command-line capabilities. This is especially the case on Windows where the
6745 maximum command-line length is less than 8K. A response file allows you to
6749 If the response_file_contents variable is defined and non-empty, the list
6771 # The script expects the name of the response file in --file-list.
6773 "--enable-foo",
6774 "--file-list={{response_file_name}}",
6778 ### <a name="var_rustflags"></a>**rustflags**: Flags passed to the Rust compiler.
6783 "rustflags" are passed to all invocations of the Rust compiler.
6788 An absolute or buildfile-relative file name of a Python script to run for a
6795 A list of files. Non-absolute paths will be resolved relative to the current
6815 For Rust targets that do not specify a crate_root, then the crate_root will
6820 #### **Sources for non-binary targets**
6866 other test-only targets. Otherwise, GN will issue an error that the
7014 help --runtime-deps-list-file").
7030 generating with --ide=xcode.
7065 built-in arguments are:
7066 - host_cpu
7067 - host_os
7068 - current_cpu
7069 - current_os
7070 - target_cpu
7071 - target_os
7073 Next, project-specific overrides are applied. These are specified inside
7076 If specified, arguments from the --args command line flag are used. If that
7080 Last, for targets being compiled with a non-default toolchain, the toolchain
7082 toolchain definition. The use-case for this is that a toolchain may be
7099 gn gen out/FooBar --args="enable_doom_melon=true os=\"android\""
7116 "import"-ed file if you want such arguments to apply to multiple buildfiles.
7123 this detection by using the --root command-line argument
7126 buildfile, but with very limited build setup-specific meaning.
7128 If you specify --root, by default GN will look for the file .gn in that
7130 --dotfile:
7132 gn gen out/Debug --root=/home/build --dotfile=/home/my_gn_file.gn
7148 "gn check" or "gn gen --check". If neither check_targets or
7159 running "gn check" or "gn gen --check". All other targets will be checked.
7169 when running "gn check" or "gn gen --check". System style includes are
7173 "gn check --check-system" or "gn gen --check=system"
7201 This is used for Clang-based tooling and some editor integration. See
7204 The switch --add-export-compile-commands to "gn gen" (see "gn help gen")
7205 appends to this value which provides a per-user way to customize it.
7207 The deprecated switch --export-compile-commands to "gn gen" (see "gn help
7222 The command-line switch --root-target will override this value (see "gn
7223 help --root-target").
7234 The command-line switch --root-pattern will override this value (see
7235 "gn help --root-pattern")
7244 The command-line switch --script-executable will override this value (see
7245 "gn help --script-executable")
7262 declare_args() block, but can be overridden using --args or the
7269 If set to a non-empty string, this is added to the name of all build files
7366 Targets in non-default toolchains will only be generated when they are
7374 generated in the same cases the source target has but without a build-time
7375 dependency and even in non-default toolchains.
7439 integer = [ "-" ] digit { digit } .
7453 Hex = "0x" [0-9A-Fa-f][0-9A-Fa-f]
7473 otherwise-ambiguous cases.
7482 - -= < <= [ ]
7490 The input tokens form a syntax tree following a context-free grammar:
7513 AssignOp = "=" | "+=" | "-=" .
7515 BinaryOp = "+" | "-" // highest priority
7521 All binary operators are left-associative.
7529 - Boolean: Uses the keywords "true" and "false". There is no implicit
7532 - Integers: All numbers in GN are signed 64-bit integers.
7534 - Strings: Strings are 8-bit with no enforced encoding. When a string is
7536 Windows and Mac filesystems) it is assumed to be UTF-8. See "String
7539 - Lists: Lists are arbitrary-length ordered lists of values. See "Lists"
7542 - Scopes: Scopes are like dictionaries that use variable names for keys. See
7553 A comma after the last item is optional. Lists are dereferenced using 0-based
7563 Items can be removed from lists using the '-' and '-=' operators. This will
7564 remove all occurrences of every item in the right-hand list from the
7565 left-hand list. It is an error to remove an item not in the list. This is to
7594 implicitly-created "invoker" when invoking a template (which refers to the
7606 self-contained and do not "inherit" values from their defining scope.
7616 Scope equality is defined as single-level scopes identical within the current
7736 - "*" Matches zero or more of any character. It does not depend on the
7740 - "\b" Matches a path boundary. This will match the beginning or end of a
7767 - Explicit (no wildcard):
7771 - Wildcard target names:
7775 - Wildcard directory names ("*" is only supported at the end)
7789 All targets in the current build file using the 32-bit Linux toolchain.
7803 This consists of a source-root-absolute path, a colon, and a name. This means
7819 context, but you can override this to specify cross-toolchain dependencies:
7832 all same-file references.
7837 Stylistically, we prefer to use absolute paths for all non-file-local
7852 //net -> //net:net
7853 //tools/gn -> //tools/gn:gn
7979 to be collected with the target-side code.
7986 build, and so a common use is to provide post-build tooling with a set of data
7994 Another use is in image creation, where a post-build image tool needs to know
8032 of "com.apple.product-type.application" are considered as executable
8048 To explicitly compile a target in a non-default toolchain, you must give
8085 advice on fixing problems. Targets can also opt-out of checking, see
8093 time via write_runtime_deps(), or --runtime-deps-list-file (see "gn help
8094 --runtime-deps-list-file").
8107 assumes that the executable (and everything it requires) is a build-time
8121 The different rules for deps and data_deps are to express build-time (deps)
8122 vs. run-time (data_deps) outputs. If GN counted all build-time copy steps as
8124 run-time dependencies as regular deps, the build's parallelism would be
8129 A --[data_deps]--> B --[deps]--> ACTION
8132 many actions into one logic unit, and the "data"-ness of A's dependency is
8135 - List the outputs of the action in its data section (if the results of
8137 - Have B list the action in data_deps (if the outputs of the actions are
8139 - Have B list the action in both deps and data deps (if the outputs might be
8142 - Split B into run-time and build-time versions with the appropriate "deps"
8212 no leading "//" or trailing slashes. If the path is system-absolute,
8252 the directories will be source- absolute (begin with a "//") because the
8259 Non-varying outputs:
8282 Do "gn help --the_switch_you_want_help_on" for more. Individual commands may
8283 take command-specific switches not listed here. See the help on your specific
8287 * --args: Specifies build arguments overrides.
8288 * --color: Force colored output.
8289 * --dotfile: Override the name of the ".gn" file.
8290 * --fail-on-unused-args: Treat unused build args as fatal errors.
8291 * --markdown: Write help output in the Markdown format.
8292 * --ninja-executable: Set the Ninja executable.
8293 * --nocolor: Force non-colored output.
8294 * -q: Quiet mode. Don't print output on success.
8295 * --root: Explicitly specify source root.
8296 * --root-target: Override the root target.
8297 * --runtime-deps-list-file: Save runtime dependencies for targets in file.
8298 * --script-executable: Set the executable used to execute scripts.
8299 * --threads: Specify number of worker threads.
8300 * --time: Outputs a summary of how long everything took.
8301 * --tracelog: Writes a Chrome-compatible trace log to the given file.
8302 * -v: Verbose logging.
8303 * --version: Prints the GN version number and exits.