| OLD | NEW |
| 1 # GN Reference | 1 # GN Reference |
| 2 | 2 |
| 3 *This page is automatically generated from* `gn help --markdown all`. | 3 *This page is automatically generated from* `gn help --markdown all`. |
| 4 | 4 |
| 5 ## **\--args**: Specifies build arguments overrides. | 5 ## **\--args**: Specifies build arguments overrides. |
| 6 | 6 |
| 7 ``` | 7 ``` |
| 8 See "gn help buildargs" for an overview of how build arguments work. | 8 See "gn help buildargs" for an overview of how build arguments work. |
| 9 | 9 |
| 10 Most operations take a build directory. The build arguments are taken | 10 Most operations take a build directory. The build arguments are taken |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 | 371 |
| 372 deps | 372 deps |
| 373 Show immediate or recursive dependencies. See below for flags that | 373 Show immediate or recursive dependencies. See below for flags that |
| 374 control deps printing. | 374 control deps printing. |
| 375 | 375 |
| 376 public_configs | 376 public_configs |
| 377 all_dependent_configs | 377 all_dependent_configs |
| 378 Shows the labels of configs applied to targets that depend on this | 378 Shows the labels of configs applied to targets that depend on this |
| 379 one (either directly or all of them). | 379 one (either directly or all of them). |
| 380 | 380 |
| 381 forward_dependent_configs_from | |
| 382 Shows the labels of dependencies for which dependent configs will | |
| 383 be pushed to targets depending on the current one. | |
| 384 | |
| 385 script | 381 script |
| 386 args | 382 args |
| 387 depfile | 383 depfile |
| 388 Actions only. The script and related values. | 384 Actions only. The script and related values. |
| 389 | 385 |
| 390 outputs | 386 outputs |
| 391 Outputs for script and copy target types. | 387 Outputs for script and copy target types. |
| 392 | 388 |
| 393 defines [--blame] | 389 defines [--blame] |
| 394 include_dirs [--blame] | 390 include_dirs [--blame] |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1029 ### **Variables valid in a config definition**: | 1025 ### **Variables valid in a config definition**: |
| 1030 ``` | 1026 ``` |
| 1031 Flags: cflags, cflags_c, cflags_cc, cflags_objc, cflags_objcc, | 1027 Flags: cflags, cflags_c, cflags_cc, cflags_objc, cflags_objcc, |
| 1032 defines, include_dirs, ldflags, lib_dirs, libs, | 1028 defines, include_dirs, ldflags, lib_dirs, libs, |
| 1033 precompiled_header, precompiled_source | 1029 precompiled_header, precompiled_source |
| 1034 | 1030 |
| 1035 ``` | 1031 ``` |
| 1036 | 1032 |
| 1037 ### **Variables on a target used to apply configs**: | 1033 ### **Variables on a target used to apply configs**: |
| 1038 ``` | 1034 ``` |
| 1039 all_dependent_configs, configs, public_configs, | 1035 all_dependent_configs, configs, public_configs |
| 1040 forward_dependent_configs_from | |
| 1041 | 1036 |
| 1042 ``` | 1037 ``` |
| 1043 | 1038 |
| 1044 ### **Example**: | 1039 ### **Example**: |
| 1045 ``` | 1040 ``` |
| 1046 config("myconfig") { | 1041 config("myconfig") { |
| 1047 includes = [ "include/common" ] | 1042 includes = [ "include/common" ] |
| 1048 defines = [ "ENABLE_DOOM_MELON" ] | 1043 defines = [ "ENABLE_DOOM_MELON" ] |
| 1049 } | 1044 } |
| 1050 | 1045 |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1223 | 1218 |
| 1224 ``` | 1219 ``` |
| 1225 ## **executable**: Declare an executable target. | 1220 ## **executable**: Declare an executable target. |
| 1226 | 1221 |
| 1227 ### **Variables** | 1222 ### **Variables** |
| 1228 | 1223 |
| 1229 ``` | 1224 ``` |
| 1230 Flags: cflags, cflags_c, cflags_cc, cflags_objc, cflags_objcc, | 1225 Flags: cflags, cflags_c, cflags_cc, cflags_objc, cflags_objcc, |
| 1231 defines, include_dirs, ldflags, lib_dirs, libs, | 1226 defines, include_dirs, ldflags, lib_dirs, libs, |
| 1232 precompiled_header, precompiled_source | 1227 precompiled_header, precompiled_source |
| 1233 Deps: data_deps, deps, forward_dependent_configs_from, public_deps | 1228 Deps: data_deps, deps, public_deps |
| 1234 Dependent configs: all_dependent_configs, public_configs | 1229 Dependent configs: all_dependent_configs, public_configs |
| 1235 General: check_includes, configs, data, inputs, output_name, | 1230 General: check_includes, configs, data, inputs, output_name, |
| 1236 output_extension, public, sources, testonly, visibility | 1231 output_extension, public, sources, testonly, visibility |
| 1237 | 1232 |
| 1238 | 1233 |
| 1239 ``` | 1234 ``` |
| 1240 ## **foreach**: Iterate over a list. | 1235 ## **foreach**: Iterate over a list. |
| 1241 | 1236 |
| 1242 ``` | 1237 ``` |
| 1243 foreach(<loop_var>, <list>) { | 1238 foreach(<loop_var>, <list>) { |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1580 | 1575 |
| 1581 ``` | 1576 ``` |
| 1582 ## **group**: Declare a named group of targets. | 1577 ## **group**: Declare a named group of targets. |
| 1583 | 1578 |
| 1584 ``` | 1579 ``` |
| 1585 This target type allows you to create meta-targets that just collect a | 1580 This target type allows you to create meta-targets that just collect a |
| 1586 set of dependencies into one named target. Groups can additionally | 1581 set of dependencies into one named target. Groups can additionally |
| 1587 specify configs that apply to their dependents. | 1582 specify configs that apply to their dependents. |
| 1588 | 1583 |
| 1589 Depending on a group is exactly like depending directly on that | 1584 Depending on a group is exactly like depending directly on that |
| 1590 group's deps. Direct dependent configs will get automatically | 1585 group's deps. |
| 1591 forwarded through the group so you shouldn't need to use | |
| 1592 "forward_dependent_configs_from. | |
| 1593 | 1586 |
| 1594 ``` | 1587 ``` |
| 1595 | 1588 |
| 1596 ### **Variables** | 1589 ### **Variables** |
| 1597 | 1590 |
| 1598 ``` | 1591 ``` |
| 1599 Deps: data_deps, deps, forward_dependent_configs_from, public_deps | 1592 Deps: data_deps, deps, public_deps |
| 1600 Dependent configs: all_dependent_configs, public_configs | 1593 Dependent configs: all_dependent_configs, public_configs |
| 1601 | 1594 |
| 1602 ``` | 1595 ``` |
| 1603 | 1596 |
| 1604 ### **Example** | 1597 ### **Example** |
| 1605 | 1598 |
| 1606 ``` | 1599 ``` |
| 1607 group("all") { | 1600 group("all") { |
| 1608 deps = [ | 1601 deps = [ |
| 1609 "//project:runner", | 1602 "//project:runner", |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1998 depend on the shared library via "data_deps" instead. | 1991 depend on the shared library via "data_deps" instead. |
| 1999 | 1992 |
| 2000 ``` | 1993 ``` |
| 2001 | 1994 |
| 2002 ### **Variables** | 1995 ### **Variables** |
| 2003 | 1996 |
| 2004 ``` | 1997 ``` |
| 2005 Flags: cflags, cflags_c, cflags_cc, cflags_objc, cflags_objcc, | 1998 Flags: cflags, cflags_c, cflags_cc, cflags_objc, cflags_objcc, |
| 2006 defines, include_dirs, ldflags, lib_dirs, libs, | 1999 defines, include_dirs, ldflags, lib_dirs, libs, |
| 2007 precompiled_header, precompiled_source | 2000 precompiled_header, precompiled_source |
| 2008 Deps: data_deps, deps, forward_dependent_configs_from, public_deps | 2001 Deps: data_deps, deps, public_deps |
| 2009 Dependent configs: all_dependent_configs, public_configs | 2002 Dependent configs: all_dependent_configs, public_configs |
| 2010 General: check_includes, configs, data, inputs, output_name, | 2003 General: check_includes, configs, data, inputs, output_name, |
| 2011 output_extension, public, sources, testonly, visibility | 2004 output_extension, public, sources, testonly, visibility |
| 2012 | 2005 |
| 2013 | 2006 |
| 2014 ``` | 2007 ``` |
| 2015 ## **source_set**: Declare a source set target. | 2008 ## **source_set**: Declare a source set target. |
| 2016 | 2009 |
| 2017 ``` | 2010 ``` |
| 2018 A source set is a collection of sources that get compiled, but are not | 2011 A source set is a collection of sources that get compiled, but are not |
| (...skipping 20 matching lines...) Expand all Loading... |
| 2039 into a shared library. | 2032 into a shared library. |
| 2040 | 2033 |
| 2041 ``` | 2034 ``` |
| 2042 | 2035 |
| 2043 ### **Variables** | 2036 ### **Variables** |
| 2044 | 2037 |
| 2045 ``` | 2038 ``` |
| 2046 Flags: cflags, cflags_c, cflags_cc, cflags_objc, cflags_objcc, | 2039 Flags: cflags, cflags_c, cflags_cc, cflags_objc, cflags_objcc, |
| 2047 defines, include_dirs, ldflags, lib_dirs, libs, | 2040 defines, include_dirs, ldflags, lib_dirs, libs, |
| 2048 precompiled_header, precompiled_source | 2041 precompiled_header, precompiled_source |
| 2049 Deps: data_deps, deps, forward_dependent_configs_from, public_deps | 2042 Deps: data_deps, deps, public_deps |
| 2050 Dependent configs: all_dependent_configs, public_configs | 2043 Dependent configs: all_dependent_configs, public_configs |
| 2051 General: check_includes, configs, data, inputs, output_name, | 2044 General: check_includes, configs, data, inputs, output_name, |
| 2052 output_extension, public, sources, testonly, visibility | 2045 output_extension, public, sources, testonly, visibility |
| 2053 | 2046 |
| 2054 | 2047 |
| 2055 ``` | 2048 ``` |
| 2056 ## **static_library**: Declare a static library target. | 2049 ## **static_library**: Declare a static library target. |
| 2057 | 2050 |
| 2058 ``` | 2051 ``` |
| 2059 Make a ".a" / ".lib" file. | 2052 Make a ".a" / ".lib" file. |
| 2060 | 2053 |
| 2061 If you only need the static library for intermediate results in the | 2054 If you only need the static library for intermediate results in the |
| 2062 build, you should consider a source_set instead since it will skip | 2055 build, you should consider a source_set instead since it will skip |
| 2063 the (potentially slow) step of creating the intermediate library file. | 2056 the (potentially slow) step of creating the intermediate library file. |
| 2064 | 2057 |
| 2065 ``` | 2058 ``` |
| 2066 | 2059 |
| 2067 ### **Variables** | 2060 ### **Variables** |
| 2068 | 2061 |
| 2069 ``` | 2062 ``` |
| 2070 Flags: cflags, cflags_c, cflags_cc, cflags_objc, cflags_objcc, | 2063 Flags: cflags, cflags_c, cflags_cc, cflags_objc, cflags_objcc, |
| 2071 defines, include_dirs, ldflags, lib_dirs, libs, | 2064 defines, include_dirs, ldflags, lib_dirs, libs, |
| 2072 precompiled_header, precompiled_source | 2065 precompiled_header, precompiled_source |
| 2073 Deps: data_deps, deps, forward_dependent_configs_from, public_deps | 2066 Deps: data_deps, deps, public_deps |
| 2074 Dependent configs: all_dependent_configs, public_configs | 2067 Dependent configs: all_dependent_configs, public_configs |
| 2075 General: check_includes, configs, data, inputs, output_name, | 2068 General: check_includes, configs, data, inputs, output_name, |
| 2076 output_extension, public, sources, testonly, visibility | 2069 output_extension, public, sources, testonly, visibility |
| 2077 | 2070 |
| 2078 | 2071 |
| 2079 ``` | 2072 ``` |
| 2080 ## **target**: Declare an target with the given programmatic type. | 2073 ## **target**: Declare an target with the given programmatic type. |
| 2081 | 2074 |
| 2082 ``` | 2075 ``` |
| 2083 target(target_type_string, target_name_string) { ... } | 2076 target(target_type_string, target_name_string) { ... } |
| (...skipping 1634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3718 libraries will be linked into the current target. | 3711 libraries will be linked into the current target. |
| 3719 | 3712 |
| 3720 These dependencies are private in that it does not grant dependent | 3713 These dependencies are private in that it does not grant dependent |
| 3721 targets the ability to include headers from the dependency, and direct | 3714 targets the ability to include headers from the dependency, and direct |
| 3722 dependent configs are not forwarded. | 3715 dependent configs are not forwarded. |
| 3723 | 3716 |
| 3724 See also "public_deps" and "data_deps". | 3717 See also "public_deps" and "data_deps". |
| 3725 | 3718 |
| 3726 | 3719 |
| 3727 ``` | 3720 ``` |
| 3728 ## **forward_dependent_configs_from** | |
| 3729 | |
| 3730 ``` | |
| 3731 A list of target labels. | |
| 3732 | |
| 3733 DEPRECATED. Use public_deps instead which will have the same effect. | |
| 3734 | |
| 3735 Exposes the public_configs from a private dependent target as | |
| 3736 public_configs of the current one. Each label in this list | |
| 3737 must also be in the deps. | |
| 3738 | |
| 3739 Generally you should use public_deps instead of this variable to | |
| 3740 express the concept of exposing a dependency as part of a target's | |
| 3741 public API. We're considering removing this variable. | |
| 3742 | |
| 3743 ``` | |
| 3744 | |
| 3745 ### **Discussion** | |
| 3746 | |
| 3747 ``` | |
| 3748 Sometimes you depend on a child library that exports some necessary | |
| 3749 configuration via public_configs. If your target in turn exposes the | |
| 3750 child library's headers in its public headers, it might mean that | |
| 3751 targets that depend on you won't work: they'll be seeing the child | |
| 3752 library's code but not the necessary configuration. This list | |
| 3753 specifies which of your deps' direct dependent configs to expose as | |
| 3754 your own. | |
| 3755 | |
| 3756 ``` | |
| 3757 | |
| 3758 ### **Examples** | |
| 3759 | |
| 3760 ``` | |
| 3761 If we use a given library "a" from our public headers: | |
| 3762 | |
| 3763 deps = [ ":a", ":b", ... ] | |
| 3764 forward_dependent_configs_from = [ ":a" ] | |
| 3765 | |
| 3766 This example makes a "transparent" target that forwards a dependency | |
| 3767 to another: | |
| 3768 | |
| 3769 group("frob") { | |
| 3770 if (use_system_frob) { | |
| 3771 deps = ":system_frob" | |
| 3772 } else { | |
| 3773 deps = "//third_party/fallback_frob" | |
| 3774 } | |
| 3775 forward_dependent_configs_from = deps | |
| 3776 } | |
| 3777 | |
| 3778 | 3721 |
| 3779 ``` | 3722 ``` |
| 3780 ## **include_dirs**: Additional include directories. | 3723 ## **include_dirs**: Additional include directories. |
| 3781 | 3724 |
| 3782 ``` | 3725 ``` |
| 3783 A list of source directories. | 3726 A list of source directories. |
| 3784 | 3727 |
| 3785 The directories in this list will be added to the include path for | 3728 The directories in this list will be added to the include path for |
| 3786 the files in the affected target. | 3729 the files in the affected target. |
| 3787 | 3730 |
| (...skipping 1270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5058 ** -q**: Quiet mode. Don't print output on success. | 5001 ** -q**: Quiet mode. Don't print output on success. |
| 5059 ** \--root**: Explicitly specify source root. | 5002 ** \--root**: Explicitly specify source root. |
| 5060 ** \--runtime-deps-list-file**: Save runtime dependencies for targets in file. | 5003 ** \--runtime-deps-list-file**: Save runtime dependencies for targets in file. |
| 5061 ** \--threads**: Specify number of worker threads. | 5004 ** \--threads**: Specify number of worker threads. |
| 5062 ** \--time**: Outputs a summary of how long everything took. | 5005 ** \--time**: Outputs a summary of how long everything took. |
| 5063 ** \--tracelog**: Writes a Chrome-compatible trace log to the given file. | 5006 ** \--tracelog**: Writes a Chrome-compatible trace log to the given file. |
| 5064 ** -v**: Verbose logging. | 5007 ** -v**: Verbose logging. |
| 5065 ** \--version**: Prints the GN version number and exits. | 5008 ** \--version**: Prints the GN version number and exits. |
| 5066 | 5009 |
| 5067 ``` | 5010 ``` |
| OLD | NEW |