| 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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 Print a dependency tree. By default, duplicates will be elided | 448 Print a dependency tree. By default, duplicates will be elided |
| 449 with "..." but when --all and -tree are used together, no | 449 with "..." but when --all and -tree are used together, no |
| 450 eliding will be performed. | 450 eliding will be performed. |
| 451 | 451 |
| 452 The "deps", "public_deps", and "data_deps" will all be | 452 The "deps", "public_deps", and "data_deps" will all be |
| 453 included in the tree. | 453 included in the tree. |
| 454 | 454 |
| 455 Tree output can not be used with the filtering or output flags: | 455 Tree output can not be used with the filtering or output flags: |
| 456 --as, --type, --testonly. | 456 --as, --type, --testonly. |
| 457 | 457 |
| 458 --type=(action|copy|executable|group|shared_library|source_set| | 458 --type=(action|copy|executable|group|loadable_module|shared_library| |
| 459 static_library) | 459 source_set|static_library) |
| 460 Restrict outputs to targets matching the given type. If | 460 Restrict outputs to targets matching the given type. If |
| 461 unspecified, no filtering will be performed. | 461 unspecified, no filtering will be performed. |
| 462 | 462 |
| 463 ``` | 463 ``` |
| 464 | 464 |
| 465 ### **Note** | 465 ### **Note** |
| 466 | 466 |
| 467 ``` | 467 ``` |
| 468 This command will show the full name of directories and source files, | 468 This command will show the full name of directories and source files, |
| 469 but when directories and source paths are written to the build file, | 469 but when directories and source paths are written to the build file, |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 Matches all toolchains. When set, if the label pattern does not | 587 Matches all toolchains. When set, if the label pattern does not |
| 588 specify an explicit toolchain, labels from all toolchains will be | 588 specify an explicit toolchain, labels from all toolchains will be |
| 589 matched. When unset, only targets in the default toolchain will | 589 matched. When unset, only targets in the default toolchain will |
| 590 be matched unless an explicit toolchain in the label is set. | 590 be matched unless an explicit toolchain in the label is set. |
| 591 | 591 |
| 592 --testonly=(true|false) | 592 --testonly=(true|false) |
| 593 Restrict outputs to targets with the testonly flag set | 593 Restrict outputs to targets with the testonly flag set |
| 594 accordingly. When unspecified, the target's testonly flags are | 594 accordingly. When unspecified, the target's testonly flags are |
| 595 ignored. | 595 ignored. |
| 596 | 596 |
| 597 --type=(action|copy|executable|group|shared_library|source_set| | 597 --type=(action|copy|executable|group|loadable_module|shared_library| |
| 598 static_library) | 598 source_set|static_library) |
| 599 Restrict outputs to targets matching the given type. If | 599 Restrict outputs to targets matching the given type. If |
| 600 unspecified, no filtering will be performed. | 600 unspecified, no filtering will be performed. |
| 601 | 601 |
| 602 ``` | 602 ``` |
| 603 | 603 |
| 604 ### **Examples** | 604 ### **Examples** |
| 605 | 605 |
| 606 ``` | 606 ``` |
| 607 gn ls out/Debug | 607 gn ls out/Debug |
| 608 Lists all targets in the default toolchain. | 608 Lists all targets in the default toolchain. |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 ignored. | 733 ignored. |
| 734 | 734 |
| 735 --tree | 735 --tree |
| 736 Outputs a reverse dependency tree from the given target. | 736 Outputs a reverse dependency tree from the given target. |
| 737 Duplicates will be elided. Combine with --all to see a full | 737 Duplicates will be elided. Combine with --all to see a full |
| 738 dependency tree. | 738 dependency tree. |
| 739 | 739 |
| 740 Tree output can not be used with the filtering or output flags: | 740 Tree output can not be used with the filtering or output flags: |
| 741 --as, --type, --testonly. | 741 --as, --type, --testonly. |
| 742 | 742 |
| 743 --type=(action|copy|executable|group|shared_library|source_set| | 743 --type=(action|copy|executable|group|loadable_module|shared_library| |
| 744 static_library) | 744 source_set|static_library) |
| 745 Restrict outputs to targets matching the given type. If | 745 Restrict outputs to targets matching the given type. If |
| 746 unspecified, no filtering will be performed. | 746 unspecified, no filtering will be performed. |
| 747 | 747 |
| 748 ``` | 748 ``` |
| 749 | 749 |
| 750 ### **Examples (target input)** | 750 ### **Examples (target input)** |
| 751 | 751 |
| 752 ``` | 752 ``` |
| 753 gn refs out/Debug //tools/gn:gn | 753 gn refs out/Debug //tools/gn:gn |
| 754 Find all targets depending on the given exact target name. | 754 Find all targets depending on the given exact target name. |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1018 3. Public_configs from a breadth-first traversal of the dependency | 1018 3. Public_configs from a breadth-first traversal of the dependency |
| 1019 tree in the order that the targets appear in "deps". | 1019 tree in the order that the targets appear in "deps". |
| 1020 4. All dependent configs from a breadth-first traversal of the | 1020 4. All dependent configs from a breadth-first traversal of the |
| 1021 dependency tree in the order that the targets appear in "deps". | 1021 dependency tree in the order that the targets appear in "deps". |
| 1022 | 1022 |
| 1023 ``` | 1023 ``` |
| 1024 | 1024 |
| 1025 ### **Variables valid in a config definition**: | 1025 ### **Variables valid in a config definition**: |
| 1026 ``` | 1026 ``` |
| 1027 Flags: cflags, cflags_c, cflags_cc, cflags_objc, cflags_objcc, | 1027 Flags: cflags, cflags_c, cflags_cc, cflags_objc, cflags_objcc, |
| 1028 defines, include_dirs, ldflags, lib_dirs, libs, | 1028 asmflags, defines, include_dirs, ldflags, lib_dirs, libs, |
| 1029 precompiled_header, precompiled_source | 1029 precompiled_header, precompiled_source |
| 1030 | 1030 |
| 1031 ``` | 1031 ``` |
| 1032 | 1032 |
| 1033 ### **Variables on a target used to apply configs**: | 1033 ### **Variables on a target used to apply configs**: |
| 1034 ``` | 1034 ``` |
| 1035 all_dependent_configs, configs, public_configs | 1035 all_dependent_configs, configs, public_configs |
| 1036 | 1036 |
| 1037 ``` | 1037 ``` |
| 1038 | 1038 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1096 ## **declare_args**: Declare build arguments. | 1096 ## **declare_args**: Declare build arguments. |
| 1097 | 1097 |
| 1098 ``` | 1098 ``` |
| 1099 Introduces the given arguments into the current scope. If they are | 1099 Introduces the given arguments into the current scope. If they are |
| 1100 not specified on the command line or in a toolchain's arguments, | 1100 not specified on the command line or in a toolchain's arguments, |
| 1101 the default values given in the declare_args block will be used. | 1101 the default values given in the declare_args block will be used. |
| 1102 However, these defaults will not override command-line values. | 1102 However, these defaults will not override command-line values. |
| 1103 | 1103 |
| 1104 See also "gn help buildargs" for an overview. | 1104 See also "gn help buildargs" for an overview. |
| 1105 | 1105 |
| 1106 The precise behavior of declare args is: |
| 1107 |
| 1108 1. The declare_arg block executes. Any variables in the enclosing |
| 1109 scope are available for reading. |
| 1110 |
| 1111 2. At the end of executing the block, any variables set within that |
| 1112 scope are saved globally as build arguments, with their current |
| 1113 values being saved as the "default value" for that argument. |
| 1114 |
| 1115 3. User-defined overrides are applied. Anything set in "gn args" |
| 1116 now overrides any default values. The resulting set of variables |
| 1117 is promoted to be readable from the following code in the file. |
| 1118 |
| 1119 This has some ramifications that may not be obvious: |
| 1120 |
| 1121 - You should not perform difficult work inside a declare_args block |
| 1122 since this only sets a default value that may be discarded. In |
| 1123 particular, don't use the result of exec_script() to set the |
| 1124 default value. If you want to have a script-defined default, set |
| 1125 some default "undefined" value like [], "", or -1, and after |
| 1126 the declare_args block, call exec_script if the value is unset by |
| 1127 the user. |
| 1128 |
| 1129 - Any code inside of the declare_args block will see the default |
| 1130 values of previous variables defined in the block rather than |
| 1131 the user-overridden value. This can be surprising because you will |
| 1132 be used to seeing the overridden value. If you need to make the |
| 1133 default value of one arg dependent on the possibly-overridden |
| 1134 value of another, write two separate declare_args blocks: |
| 1135 |
| 1136 declare_args() { |
| 1137 enable_foo = true |
| 1138 } |
| 1139 declare_args() { |
| 1140 # Bar defaults to same user-overridden state as foo. |
| 1141 enable_bar = enable_foo |
| 1142 } |
| 1143 |
| 1106 ``` | 1144 ``` |
| 1107 | 1145 |
| 1108 ### **Example**: | 1146 ### **Example** |
| 1147 |
| 1109 ``` | 1148 ``` |
| 1110 declare_args() { | 1149 declare_args() { |
| 1111 enable_teleporter = true | 1150 enable_teleporter = true |
| 1112 enable_doom_melon = false | 1151 enable_doom_melon = false |
| 1113 } | 1152 } |
| 1114 | 1153 |
| 1115 If you want to override the (default disabled) Doom Melon: | 1154 If you want to override the (default disabled) Doom Melon: |
| 1116 gn --args="enable_doom_melon=true enable_teleporter=false" | 1155 gn --args="enable_doom_melon=true enable_teleporter=false" |
| 1117 This also sets the teleporter, but it's already defaulted to on so | 1156 This also sets the teleporter, but it's already defaulted to on so |
| 1118 it will have no effect. | 1157 it will have no effect. |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1216 exec_script("//foo/bar/myscript.py") | 1255 exec_script("//foo/bar/myscript.py") |
| 1217 | 1256 |
| 1218 | 1257 |
| 1219 ``` | 1258 ``` |
| 1220 ## **executable**: Declare an executable target. | 1259 ## **executable**: Declare an executable target. |
| 1221 | 1260 |
| 1222 ### **Variables** | 1261 ### **Variables** |
| 1223 | 1262 |
| 1224 ``` | 1263 ``` |
| 1225 Flags: cflags, cflags_c, cflags_cc, cflags_objc, cflags_objcc, | 1264 Flags: cflags, cflags_c, cflags_cc, cflags_objc, cflags_objcc, |
| 1226 defines, include_dirs, ldflags, lib_dirs, libs, | 1265 asmflags, defines, include_dirs, ldflags, lib_dirs, libs, |
| 1227 precompiled_header, precompiled_source | 1266 precompiled_header, precompiled_source |
| 1228 Deps: data_deps, deps, public_deps | 1267 Deps: data_deps, deps, public_deps |
| 1229 Dependent configs: all_dependent_configs, public_configs | 1268 Dependent configs: all_dependent_configs, public_configs |
| 1230 General: check_includes, configs, data, inputs, output_name, | 1269 General: check_includes, configs, data, inputs, output_name, |
| 1231 output_extension, public, sources, testonly, visibility | 1270 output_extension, public, sources, testonly, visibility |
| 1232 | 1271 |
| 1233 | 1272 |
| 1234 ``` | 1273 ``` |
| 1235 ## **foreach**: Iterate over a list. | 1274 ## **foreach**: Iterate over a list. |
| 1236 | 1275 |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1575 | 1614 |
| 1576 ``` | 1615 ``` |
| 1577 ## **group**: Declare a named group of targets. | 1616 ## **group**: Declare a named group of targets. |
| 1578 | 1617 |
| 1579 ``` | 1618 ``` |
| 1580 This target type allows you to create meta-targets that just collect a | 1619 This target type allows you to create meta-targets that just collect a |
| 1581 set of dependencies into one named target. Groups can additionally | 1620 set of dependencies into one named target. Groups can additionally |
| 1582 specify configs that apply to their dependents. | 1621 specify configs that apply to their dependents. |
| 1583 | 1622 |
| 1584 Depending on a group is exactly like depending directly on that | 1623 Depending on a group is exactly like depending directly on that |
| 1585 group's deps. | 1624 group's deps. |
| 1586 | 1625 |
| 1587 ``` | 1626 ``` |
| 1588 | 1627 |
| 1589 ### **Variables** | 1628 ### **Variables** |
| 1590 | 1629 |
| 1591 ``` | 1630 ``` |
| 1592 Deps: data_deps, deps, public_deps | 1631 Deps: data_deps, deps, public_deps |
| 1593 Dependent configs: all_dependent_configs, public_configs | 1632 Dependent configs: all_dependent_configs, public_configs |
| 1594 | 1633 |
| 1595 ``` | 1634 ``` |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1638 ### **Examples**: | 1677 ### **Examples**: |
| 1639 | 1678 |
| 1640 ``` | 1679 ``` |
| 1641 import("//build/rules/idl_compilation_rule.gni") | 1680 import("//build/rules/idl_compilation_rule.gni") |
| 1642 | 1681 |
| 1643 # Looks in the current directory. | 1682 # Looks in the current directory. |
| 1644 import("my_vars.gni") | 1683 import("my_vars.gni") |
| 1645 | 1684 |
| 1646 | 1685 |
| 1647 ``` | 1686 ``` |
| 1687 ## **loadable_module**: Declare a loadable module target. |
| 1688 |
| 1689 ``` |
| 1690 This target type allows you to create an object file that is (and can |
| 1691 only be) loaded and unloaded at runtime. |
| 1692 |
| 1693 A loadable module will be specified on the linker line for targets |
| 1694 listing the loadable module in its "deps". If you don't want this |
| 1695 (if you don't need to dynamically load the library at runtime), then |
| 1696 you should use a "shared_library" target type instead. |
| 1697 |
| 1698 ``` |
| 1699 |
| 1700 ### **Variables** |
| 1701 |
| 1702 ``` |
| 1703 Flags: cflags, cflags_c, cflags_cc, cflags_objc, cflags_objcc, |
| 1704 asmflags, defines, include_dirs, ldflags, lib_dirs, libs, |
| 1705 precompiled_header, precompiled_source |
| 1706 Deps: data_deps, deps, public_deps |
| 1707 Dependent configs: all_dependent_configs, public_configs |
| 1708 General: check_includes, configs, data, inputs, output_name, |
| 1709 output_extension, public, sources, testonly, visibility |
| 1710 |
| 1711 |
| 1712 ``` |
| 1648 ## **print**: Prints to the console. | 1713 ## **print**: Prints to the console. |
| 1649 | 1714 |
| 1650 ``` | 1715 ``` |
| 1651 Prints all arguments to the console separated by spaces. A newline is | 1716 Prints all arguments to the console separated by spaces. A newline is |
| 1652 automatically appended to the end. | 1717 automatically appended to the end. |
| 1653 | 1718 |
| 1654 This function is intended for debugging. Note that build files are run | 1719 This function is intended for debugging. Note that build files are run |
| 1655 in parallel so you may get interleaved prints. A buildfile may also | 1720 in parallel so you may get interleaved prints. A buildfile may also |
| 1656 be executed more than once in parallel in the context of different | 1721 be executed more than once in parallel in the context of different |
| 1657 toolchains so the prints from one file may be duplicated or | 1722 toolchains so the prints from one file may be duplicated or |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1981 # Will print [ "a.cc" ]. b_win one was filtered out. | 2046 # Will print [ "a.cc" ]. b_win one was filtered out. |
| 1982 | 2047 |
| 1983 | 2048 |
| 1984 ``` | 2049 ``` |
| 1985 ## **shared_library**: Declare a shared library target. | 2050 ## **shared_library**: Declare a shared library target. |
| 1986 | 2051 |
| 1987 ``` | 2052 ``` |
| 1988 A shared library will be specified on the linker line for targets | 2053 A shared library will be specified on the linker line for targets |
| 1989 listing the shared library in its "deps". If you don't want this | 2054 listing the shared library in its "deps". If you don't want this |
| 1990 (say you dynamically load the library at runtime), then you should | 2055 (say you dynamically load the library at runtime), then you should |
| 1991 depend on the shared library via "data_deps" instead. | 2056 depend on the shared library via "data_deps" or, on Darwin |
| 2057 platforms, use a "loadable_module" target type instead. |
| 1992 | 2058 |
| 1993 ``` | 2059 ``` |
| 1994 | 2060 |
| 1995 ### **Variables** | 2061 ### **Variables** |
| 1996 | 2062 |
| 1997 ``` | 2063 ``` |
| 1998 Flags: cflags, cflags_c, cflags_cc, cflags_objc, cflags_objcc, | 2064 Flags: cflags, cflags_c, cflags_cc, cflags_objc, cflags_objcc, |
| 1999 defines, include_dirs, ldflags, lib_dirs, libs, | 2065 asmflags, defines, include_dirs, ldflags, lib_dirs, libs, |
| 2000 precompiled_header, precompiled_source | 2066 precompiled_header, precompiled_source |
| 2001 Deps: data_deps, deps, public_deps | 2067 Deps: data_deps, deps, public_deps |
| 2002 Dependent configs: all_dependent_configs, public_configs | 2068 Dependent configs: all_dependent_configs, public_configs |
| 2003 General: check_includes, configs, data, inputs, output_name, | 2069 General: check_includes, configs, data, inputs, output_name, |
| 2004 output_extension, public, sources, testonly, visibility | 2070 output_extension, public, sources, testonly, visibility |
| 2005 | 2071 |
| 2006 | 2072 |
| 2007 ``` | 2073 ``` |
| 2008 ## **source_set**: Declare a source set target. | 2074 ## **source_set**: Declare a source set target. |
| 2009 | 2075 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 2030 final shared library and not from the intermediate targets." There is | 2096 final shared library and not from the intermediate targets." There is |
| 2031 no way to express this concept when linking multiple static libraries | 2097 no way to express this concept when linking multiple static libraries |
| 2032 into a shared library. | 2098 into a shared library. |
| 2033 | 2099 |
| 2034 ``` | 2100 ``` |
| 2035 | 2101 |
| 2036 ### **Variables** | 2102 ### **Variables** |
| 2037 | 2103 |
| 2038 ``` | 2104 ``` |
| 2039 Flags: cflags, cflags_c, cflags_cc, cflags_objc, cflags_objcc, | 2105 Flags: cflags, cflags_c, cflags_cc, cflags_objc, cflags_objcc, |
| 2040 defines, include_dirs, ldflags, lib_dirs, libs, | 2106 asmflags, defines, include_dirs, ldflags, lib_dirs, libs, |
| 2041 precompiled_header, precompiled_source | 2107 precompiled_header, precompiled_source |
| 2042 Deps: data_deps, deps, public_deps | 2108 Deps: data_deps, deps, public_deps |
| 2043 Dependent configs: all_dependent_configs, public_configs | 2109 Dependent configs: all_dependent_configs, public_configs |
| 2044 General: check_includes, configs, data, inputs, output_name, | 2110 General: check_includes, configs, data, inputs, output_name, |
| 2045 output_extension, public, sources, testonly, visibility | 2111 output_extension, public, sources, testonly, visibility |
| 2046 | 2112 |
| 2047 | 2113 |
| 2048 ``` | 2114 ``` |
| 2049 ## **static_library**: Declare a static library target. | 2115 ## **static_library**: Declare a static library target. |
| 2050 | 2116 |
| 2051 ``` | 2117 ``` |
| 2052 Make a ".a" / ".lib" file. | 2118 Make a ".a" / ".lib" file. |
| 2053 | 2119 |
| 2054 If you only need the static library for intermediate results in the | 2120 If you only need the static library for intermediate results in the |
| 2055 build, you should consider a source_set instead since it will skip | 2121 build, you should consider a source_set instead since it will skip |
| 2056 the (potentially slow) step of creating the intermediate library file. | 2122 the (potentially slow) step of creating the intermediate library file. |
| 2057 | 2123 |
| 2058 ``` | 2124 ``` |
| 2059 | 2125 |
| 2060 ### **Variables** | 2126 ### **Variables** |
| 2061 | 2127 |
| 2062 ``` | 2128 ``` |
| 2063 Flags: cflags, cflags_c, cflags_cc, cflags_objc, cflags_objcc, | 2129 Flags: cflags, cflags_c, cflags_cc, cflags_objc, cflags_objcc, |
| 2064 defines, include_dirs, ldflags, lib_dirs, libs, | 2130 asmflags, defines, include_dirs, ldflags, lib_dirs, libs, |
| 2065 precompiled_header, precompiled_source | 2131 precompiled_header, precompiled_source |
| 2066 Deps: data_deps, deps, public_deps | 2132 Deps: data_deps, deps, public_deps |
| 2067 Dependent configs: all_dependent_configs, public_configs | 2133 Dependent configs: all_dependent_configs, public_configs |
| 2068 General: check_includes, configs, data, inputs, output_name, | 2134 General: check_includes, configs, data, inputs, output_name, |
| 2069 output_extension, public, sources, testonly, visibility | 2135 output_extension, public, sources, testonly, visibility |
| 2070 | 2136 |
| 2071 | 2137 |
| 2072 ``` | 2138 ``` |
| 2073 ## **target**: Declare an target with the given programmatic type. | 2139 ## **target**: Declare an target with the given programmatic type. |
| 2074 | 2140 |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2387 produces a ".lib" import library: | 2453 produces a ".lib" import library: |
| 2388 outputs = [ | 2454 outputs = [ |
| 2389 "{{root_out_dir}}/{{target_output_name}}{{output_extension}}", | 2455 "{{root_out_dir}}/{{target_output_name}}{{output_extension}}", |
| 2390 "{{root_out_dir}}/{{target_output_name}}.lib", | 2456 "{{root_out_dir}}/{{target_output_name}}.lib", |
| 2391 ] | 2457 ] |
| 2392 | 2458 |
| 2393 link_output [string with substitutions] | 2459 link_output [string with substitutions] |
| 2394 depend_output [string with substitutions] | 2460 depend_output [string with substitutions] |
| 2395 Valid for: "solink" only (optional) | 2461 Valid for: "solink" only (optional) |
| 2396 | 2462 |
| 2397 These two files specify whch of the outputs from the solink | 2463 These two files specify which of the outputs from the solink |
| 2398 tool should be used for linking and dependency tracking. These | 2464 tool should be used for linking and dependency tracking. These |
| 2399 should match entries in the "outputs". If unspecified, the | 2465 should match entries in the "outputs". If unspecified, the |
| 2400 first item in the "outputs" array will be used for both. See | 2466 first item in the "outputs" array will be used for both. See |
| 2401 "Separate linking and dependencies for shared libraries" | 2467 "Separate linking and dependencies for shared libraries" |
| 2402 below for more. | 2468 below for more. |
| 2403 | 2469 |
| 2404 On Windows, where the tools produce a .dll shared library and | 2470 On Windows, where the tools produce a .dll shared library and |
| 2405 a .lib import library, you will want both of these to be the | 2471 a .lib import library, you will want both of these to be the |
| 2406 import library. On Linux, if you're not doing the separate | 2472 import library. On Linux, if you're not doing the separate |
| 2407 linking/dependency optimization, both of these should be the | 2473 linking/dependency optimization, both of these should be the |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2504 The short name of the current target with no path information, | 2570 The short name of the current target with no path information, |
| 2505 or the value of the "output_name" variable if one is specified | 2571 or the value of the "output_name" variable if one is specified |
| 2506 in the target. This will include the "output_prefix" if any. | 2572 in the target. This will include the "output_prefix" if any. |
| 2507 Example: "libfoo" for the target named "foo" and an | 2573 Example: "libfoo" for the target named "foo" and an |
| 2508 output prefix for the linker tool of "lib". | 2574 output prefix for the linker tool of "lib". |
| 2509 | 2575 |
| 2510 Compiler tools have the notion of a single input and a single output, | 2576 Compiler tools have the notion of a single input and a single output, |
| 2511 along with a set of compiler-specific flags. The following expansions | 2577 along with a set of compiler-specific flags. The following expansions |
| 2512 are available: | 2578 are available: |
| 2513 | 2579 |
| 2580 {{asmflags}} |
| 2514 {{cflags}} | 2581 {{cflags}} |
| 2515 {{cflags_c}} | 2582 {{cflags_c}} |
| 2516 {{cflags_cc}} | 2583 {{cflags_cc}} |
| 2517 {{cflags_objc}} | 2584 {{cflags_objc}} |
| 2518 {{cflags_objcc}} | 2585 {{cflags_objcc}} |
| 2519 {{defines}} | 2586 {{defines}} |
| 2520 {{include_dirs}} | 2587 {{include_dirs}} |
| 2521 Strings correspond that to the processed flags/defines/include | 2588 Strings correspond that to the processed flags/defines/include |
| 2522 directories specified for the target. | 2589 directories specified for the target. |
| 2523 Example: "--enable-foo --enable-bar" | 2590 Example: "--enable-foo --enable-bar" |
| (...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3210 ``` | 3277 ``` |
| 3211 ## **cflags***: Flags passed to the C compiler. | 3278 ## **cflags***: Flags passed to the C compiler. |
| 3212 | 3279 |
| 3213 ``` | 3280 ``` |
| 3214 A list of strings. | 3281 A list of strings. |
| 3215 | 3282 |
| 3216 "cflags" are passed to all invocations of the C, C++, Objective C, | 3283 "cflags" are passed to all invocations of the C, C++, Objective C, |
| 3217 and Objective C++ compilers. | 3284 and Objective C++ compilers. |
| 3218 | 3285 |
| 3219 To target one of these variants individually, use "cflags_c", | 3286 To target one of these variants individually, use "cflags_c", |
| 3220 "cflags_cc", "cflags_objc", and "cflags_objcc", respectively. | 3287 "cflags_cc", "cflags_objc", and "cflags_objcc", |
| 3221 These variant-specific versions will be appended to the "cflags". | 3288 respectively. |
| 3289 |
| 3290 These variant-specific versions of cflags* will be appended to the |
| 3291 "cflags". |
| 3222 | 3292 |
| 3223 ``` | 3293 ``` |
| 3224 | 3294 |
| 3225 ### **Ordering of flags and values** | 3295 ### **Ordering of flags and values** |
| 3226 | 3296 |
| 3227 ``` | 3297 ``` |
| 3228 1. Those set on the current target (not in a config). | 3298 1. Those set on the current target (not in a config). |
| 3229 2. Those set on the "configs" on the target in order that the | 3299 2. Those set on the "configs" on the target in order that the |
| 3230 configs appear in the list. | 3300 configs appear in the list. |
| 3231 3. Those set on the "all_dependent_configs" on the target in order | 3301 3. Those set on the "all_dependent_configs" on the target in order |
| (...skipping 11 matching lines...) Expand all Loading... |
| 3243 ``` | 3313 ``` |
| 3244 ## **cflags***: Flags passed to the C compiler. | 3314 ## **cflags***: Flags passed to the C compiler. |
| 3245 | 3315 |
| 3246 ``` | 3316 ``` |
| 3247 A list of strings. | 3317 A list of strings. |
| 3248 | 3318 |
| 3249 "cflags" are passed to all invocations of the C, C++, Objective C, | 3319 "cflags" are passed to all invocations of the C, C++, Objective C, |
| 3250 and Objective C++ compilers. | 3320 and Objective C++ compilers. |
| 3251 | 3321 |
| 3252 To target one of these variants individually, use "cflags_c", | 3322 To target one of these variants individually, use "cflags_c", |
| 3253 "cflags_cc", "cflags_objc", and "cflags_objcc", respectively. | 3323 "cflags_cc", "cflags_objc", and "cflags_objcc", |
| 3254 These variant-specific versions will be appended to the "cflags". | 3324 respectively. |
| 3325 |
| 3326 These variant-specific versions of cflags* will be appended to the |
| 3327 "cflags". |
| 3255 | 3328 |
| 3256 ``` | 3329 ``` |
| 3257 | 3330 |
| 3258 ### **Ordering of flags and values** | 3331 ### **Ordering of flags and values** |
| 3259 | 3332 |
| 3260 ``` | 3333 ``` |
| 3261 1. Those set on the current target (not in a config). | 3334 1. Those set on the current target (not in a config). |
| 3262 2. Those set on the "configs" on the target in order that the | 3335 2. Those set on the "configs" on the target in order that the |
| 3263 configs appear in the list. | 3336 configs appear in the list. |
| 3264 3. Those set on the "all_dependent_configs" on the target in order | 3337 3. Those set on the "all_dependent_configs" on the target in order |
| (...skipping 11 matching lines...) Expand all Loading... |
| 3276 ``` | 3349 ``` |
| 3277 ## **cflags***: Flags passed to the C compiler. | 3350 ## **cflags***: Flags passed to the C compiler. |
| 3278 | 3351 |
| 3279 ``` | 3352 ``` |
| 3280 A list of strings. | 3353 A list of strings. |
| 3281 | 3354 |
| 3282 "cflags" are passed to all invocations of the C, C++, Objective C, | 3355 "cflags" are passed to all invocations of the C, C++, Objective C, |
| 3283 and Objective C++ compilers. | 3356 and Objective C++ compilers. |
| 3284 | 3357 |
| 3285 To target one of these variants individually, use "cflags_c", | 3358 To target one of these variants individually, use "cflags_c", |
| 3286 "cflags_cc", "cflags_objc", and "cflags_objcc", respectively. | 3359 "cflags_cc", "cflags_objc", and "cflags_objcc", |
| 3287 These variant-specific versions will be appended to the "cflags". | 3360 respectively. |
| 3361 |
| 3362 These variant-specific versions of cflags* will be appended to the |
| 3363 "cflags". |
| 3288 | 3364 |
| 3289 ``` | 3365 ``` |
| 3290 | 3366 |
| 3291 ### **Ordering of flags and values** | 3367 ### **Ordering of flags and values** |
| 3292 | 3368 |
| 3293 ``` | 3369 ``` |
| 3294 1. Those set on the current target (not in a config). | 3370 1. Those set on the current target (not in a config). |
| 3295 2. Those set on the "configs" on the target in order that the | 3371 2. Those set on the "configs" on the target in order that the |
| 3296 configs appear in the list. | 3372 configs appear in the list. |
| 3297 3. Those set on the "all_dependent_configs" on the target in order | 3373 3. Those set on the "all_dependent_configs" on the target in order |
| (...skipping 11 matching lines...) Expand all Loading... |
| 3309 ``` | 3385 ``` |
| 3310 ## **cflags***: Flags passed to the C compiler. | 3386 ## **cflags***: Flags passed to the C compiler. |
| 3311 | 3387 |
| 3312 ``` | 3388 ``` |
| 3313 A list of strings. | 3389 A list of strings. |
| 3314 | 3390 |
| 3315 "cflags" are passed to all invocations of the C, C++, Objective C, | 3391 "cflags" are passed to all invocations of the C, C++, Objective C, |
| 3316 and Objective C++ compilers. | 3392 and Objective C++ compilers. |
| 3317 | 3393 |
| 3318 To target one of these variants individually, use "cflags_c", | 3394 To target one of these variants individually, use "cflags_c", |
| 3319 "cflags_cc", "cflags_objc", and "cflags_objcc", respectively. | 3395 "cflags_cc", "cflags_objc", and "cflags_objcc", |
| 3320 These variant-specific versions will be appended to the "cflags". | 3396 respectively. |
| 3397 |
| 3398 These variant-specific versions of cflags* will be appended to the |
| 3399 "cflags". |
| 3321 | 3400 |
| 3322 ``` | 3401 ``` |
| 3323 | 3402 |
| 3324 ### **Ordering of flags and values** | 3403 ### **Ordering of flags and values** |
| 3325 | 3404 |
| 3326 ``` | 3405 ``` |
| 3327 1. Those set on the current target (not in a config). | 3406 1. Those set on the current target (not in a config). |
| 3328 2. Those set on the "configs" on the target in order that the | 3407 2. Those set on the "configs" on the target in order that the |
| 3329 configs appear in the list. | 3408 configs appear in the list. |
| 3330 3. Those set on the "all_dependent_configs" on the target in order | 3409 3. Those set on the "all_dependent_configs" on the target in order |
| (...skipping 11 matching lines...) Expand all Loading... |
| 3342 ``` | 3421 ``` |
| 3343 ## **cflags***: Flags passed to the C compiler. | 3422 ## **cflags***: Flags passed to the C compiler. |
| 3344 | 3423 |
| 3345 ``` | 3424 ``` |
| 3346 A list of strings. | 3425 A list of strings. |
| 3347 | 3426 |
| 3348 "cflags" are passed to all invocations of the C, C++, Objective C, | 3427 "cflags" are passed to all invocations of the C, C++, Objective C, |
| 3349 and Objective C++ compilers. | 3428 and Objective C++ compilers. |
| 3350 | 3429 |
| 3351 To target one of these variants individually, use "cflags_c", | 3430 To target one of these variants individually, use "cflags_c", |
| 3352 "cflags_cc", "cflags_objc", and "cflags_objcc", respectively. | 3431 "cflags_cc", "cflags_objc", and "cflags_objcc", |
| 3353 These variant-specific versions will be appended to the "cflags". | 3432 respectively. |
| 3433 |
| 3434 These variant-specific versions of cflags* will be appended to the |
| 3435 "cflags". |
| 3354 | 3436 |
| 3355 ``` | 3437 ``` |
| 3356 | 3438 |
| 3357 ### **Ordering of flags and values** | 3439 ### **Ordering of flags and values** |
| 3358 | 3440 |
| 3359 ``` | 3441 ``` |
| 3360 1. Those set on the current target (not in a config). | 3442 1. Those set on the current target (not in a config). |
| 3361 2. Those set on the "configs" on the target in order that the | 3443 2. Those set on the "configs" on the target in order that the |
| 3362 configs appear in the list. | 3444 configs appear in the list. |
| 3363 3. Those set on the "all_dependent_configs" on the target in order | 3445 3. Those set on the "all_dependent_configs" on the target in order |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3711 libraries will be linked into the current target. | 3793 libraries will be linked into the current target. |
| 3712 | 3794 |
| 3713 These dependencies are private in that it does not grant dependent | 3795 These dependencies are private in that it does not grant dependent |
| 3714 targets the ability to include headers from the dependency, and direct | 3796 targets the ability to include headers from the dependency, and direct |
| 3715 dependent configs are not forwarded. | 3797 dependent configs are not forwarded. |
| 3716 | 3798 |
| 3717 See also "public_deps" and "data_deps". | 3799 See also "public_deps" and "data_deps". |
| 3718 | 3800 |
| 3719 | 3801 |
| 3720 ``` | 3802 ``` |
| 3721 | |
| 3722 ``` | |
| 3723 ## **include_dirs**: Additional include directories. | 3803 ## **include_dirs**: Additional include directories. |
| 3724 | 3804 |
| 3725 ``` | 3805 ``` |
| 3726 A list of source directories. | 3806 A list of source directories. |
| 3727 | 3807 |
| 3728 The directories in this list will be added to the include path for | 3808 The directories in this list will be added to the include path for |
| 3729 the files in the affected target. | 3809 the files in the affected target. |
| 3730 | 3810 |
| 3731 ``` | 3811 ``` |
| 3732 | 3812 |
| (...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4789 ## **Runtime dependencies** | 4869 ## **Runtime dependencies** |
| 4790 | 4870 |
| 4791 ``` | 4871 ``` |
| 4792 Runtime dependencies of a target are exposed via the "runtime_deps" | 4872 Runtime dependencies of a target are exposed via the "runtime_deps" |
| 4793 category of "gn desc" (see "gn help desc") or they can be written | 4873 category of "gn desc" (see "gn help desc") or they can be written |
| 4794 at build generation time via "--runtime-deps-list-file" | 4874 at build generation time via "--runtime-deps-list-file" |
| 4795 (see "gn help --runtime-deps-list-file"). | 4875 (see "gn help --runtime-deps-list-file"). |
| 4796 | 4876 |
| 4797 To a first approximation, the runtime dependencies of a target are | 4877 To a first approximation, the runtime dependencies of a target are |
| 4798 the set of "data" files, data directories, and the shared libraries | 4878 the set of "data" files, data directories, and the shared libraries |
| 4799 from all transitive dependencies. Executables and shared libraries are | 4879 from all transitive dependencies. Executables, shared libraries, and |
| 4800 considered runtime dependencies of themselves. | 4880 loadable modules are considered runtime dependencies of themselves. |
| 4801 | 4881 |
| 4802 ``` | 4882 ``` |
| 4803 | 4883 |
| 4804 ### **Executables** | 4884 ### **Executables** |
| 4805 | 4885 |
| 4806 ``` | 4886 ``` |
| 4807 Executable targets and those executable targets' transitive | 4887 Executable targets and those executable targets' transitive |
| 4808 dependencies are not considered unless that executable is listed in | 4888 dependencies are not considered unless that executable is listed in |
| 4809 "data_deps". Otherwise, GN assumes that the executable (and | 4889 "data_deps". Otherwise, GN assumes that the executable (and |
| 4810 everything it requires) is a build-time dependency only. | 4890 everything it requires) is a build-time dependency only. |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5001 ** -q**: Quiet mode. Don't print output on success. | 5081 ** -q**: Quiet mode. Don't print output on success. |
| 5002 ** \--root**: Explicitly specify source root. | 5082 ** \--root**: Explicitly specify source root. |
| 5003 ** \--runtime-deps-list-file**: Save runtime dependencies for targets in file. | 5083 ** \--runtime-deps-list-file**: Save runtime dependencies for targets in file. |
| 5004 ** \--threads**: Specify number of worker threads. | 5084 ** \--threads**: Specify number of worker threads. |
| 5005 ** \--time**: Outputs a summary of how long everything took. | 5085 ** \--time**: Outputs a summary of how long everything took. |
| 5006 ** \--tracelog**: Writes a Chrome-compatible trace log to the given file. | 5086 ** \--tracelog**: Writes a Chrome-compatible trace log to the given file. |
| 5007 ** -v**: Verbose logging. | 5087 ** -v**: Verbose logging. |
| 5008 ** \--version**: Prints the GN version number and exits. | 5088 ** \--version**: Prints the GN version number and exits. |
| 5009 | 5089 |
| 5010 ``` | 5090 ``` |
| OLD | NEW |