| 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 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1104 sources = [ "data1.dat", "data2.dat", "data3.dat" ] | 1104 sources = [ "data1.dat", "data2.dat", "data3.dat" ] |
| 1105 | 1105 |
| 1106 # Use source expansion to generate output files with the | 1106 # Use source expansion to generate output files with the |
| 1107 # corresponding file names in the gen dir. This will just copy each | 1107 # corresponding file names in the gen dir. This will just copy each |
| 1108 # file. | 1108 # file. |
| 1109 outputs = [ "$target_gen_dir/{{source_file_part}}" ] | 1109 outputs = [ "$target_gen_dir/{{source_file_part}}" ] |
| 1110 } | 1110 } |
| 1111 | 1111 |
| 1112 | 1112 |
| 1113 ``` | 1113 ``` |
| 1114 ## **copy_bundle_data**: Declare a target that copy "bundle_data" files. |
| 1115 |
| 1116 ``` |
| 1117 Similar to the "copy" target, but the list of files to copy comes |
| 1118 from the "bundle_data" property of all dependencies recursively. |
| 1119 It can be used to copy files required at runtime by the application |
| 1120 into a location where it can be found. |
| 1121 |
| 1122 This uses the "copy_bundle_data" tool from the toolchain. |
| 1123 |
| 1124 See "gn help copy" for more information. |
| 1125 |
| 1126 |
| 1127 ``` |
| 1114 ## **declare_args**: Declare build arguments. | 1128 ## **declare_args**: Declare build arguments. |
| 1115 | 1129 |
| 1116 ``` | 1130 ``` |
| 1117 Introduces the given arguments into the current scope. If they are | 1131 Introduces the given arguments into the current scope. If they are |
| 1118 not specified on the command line or in a toolchain's arguments, | 1132 not specified on the command line or in a toolchain's arguments, |
| 1119 the default values given in the declare_args block will be used. | 1133 the default values given in the declare_args block will be used. |
| 1120 However, these defaults will not override command-line values. | 1134 However, these defaults will not override command-line values. |
| 1121 | 1135 |
| 1122 See also "gn help buildargs" for an overview. | 1136 See also "gn help buildargs" for an overview. |
| 1123 | 1137 |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1277 ## **executable**: Declare an executable target. | 1291 ## **executable**: Declare an executable target. |
| 1278 | 1292 |
| 1279 ### **Variables** | 1293 ### **Variables** |
| 1280 | 1294 |
| 1281 ``` | 1295 ``` |
| 1282 Flags: cflags, cflags_c, cflags_cc, cflags_objc, cflags_objcc, | 1296 Flags: cflags, cflags_c, cflags_cc, cflags_objc, cflags_objcc, |
| 1283 asmflags, defines, include_dirs, ldflags, lib_dirs, libs, | 1297 asmflags, defines, include_dirs, ldflags, lib_dirs, libs, |
| 1284 precompiled_header, precompiled_source | 1298 precompiled_header, precompiled_source |
| 1285 Deps: data_deps, deps, public_deps | 1299 Deps: data_deps, deps, public_deps |
| 1286 Dependent configs: all_dependent_configs, public_configs | 1300 Dependent configs: all_dependent_configs, public_configs |
| 1287 General: check_includes, configs, data, inputs, output_name, | 1301 General: bundle_data, check_includes, configs, data, inputs, |
| 1288 output_extension, public, sources, testonly, visibility | 1302 output_name, output_extension, public, sources, testonly, |
| 1303 visibility |
| 1289 | 1304 |
| 1290 | 1305 |
| 1291 ``` | 1306 ``` |
| 1292 ## **foreach**: Iterate over a list. | 1307 ## **foreach**: Iterate over a list. |
| 1293 | 1308 |
| 1294 ``` | 1309 ``` |
| 1295 foreach(<loop_var>, <list>) { | 1310 foreach(<loop_var>, <list>) { |
| 1296 <loop contents> | 1311 <loop contents> |
| 1297 } | 1312 } |
| 1298 | 1313 |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1733 ``` | 1748 ``` |
| 1734 | 1749 |
| 1735 ### **Variables** | 1750 ### **Variables** |
| 1736 | 1751 |
| 1737 ``` | 1752 ``` |
| 1738 Flags: cflags, cflags_c, cflags_cc, cflags_objc, cflags_objcc, | 1753 Flags: cflags, cflags_c, cflags_cc, cflags_objc, cflags_objcc, |
| 1739 asmflags, defines, include_dirs, ldflags, lib_dirs, libs, | 1754 asmflags, defines, include_dirs, ldflags, lib_dirs, libs, |
| 1740 precompiled_header, precompiled_source | 1755 precompiled_header, precompiled_source |
| 1741 Deps: data_deps, deps, public_deps | 1756 Deps: data_deps, deps, public_deps |
| 1742 Dependent configs: all_dependent_configs, public_configs | 1757 Dependent configs: all_dependent_configs, public_configs |
| 1743 General: check_includes, configs, data, inputs, output_name, | 1758 General: bundle_data, check_includes, configs, data, inputs, |
| 1744 output_extension, public, sources, testonly, visibility | 1759 output_name, output_extension, public, sources, testonly, |
| 1760 visibility |
| 1745 | 1761 |
| 1746 | 1762 |
| 1747 ``` | 1763 ``` |
| 1748 ## **print**: Prints to the console. | 1764 ## **print**: Prints to the console. |
| 1749 | 1765 |
| 1750 ``` | 1766 ``` |
| 1751 Prints all arguments to the console separated by spaces. A newline is | 1767 Prints all arguments to the console separated by spaces. A newline is |
| 1752 automatically appended to the end. | 1768 automatically appended to the end. |
| 1753 | 1769 |
| 1754 This function is intended for debugging. Note that build files are run | 1770 This function is intended for debugging. Note that build files are run |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2094 ``` | 2110 ``` |
| 2095 | 2111 |
| 2096 ### **Variables** | 2112 ### **Variables** |
| 2097 | 2113 |
| 2098 ``` | 2114 ``` |
| 2099 Flags: cflags, cflags_c, cflags_cc, cflags_objc, cflags_objcc, | 2115 Flags: cflags, cflags_c, cflags_cc, cflags_objc, cflags_objcc, |
| 2100 asmflags, defines, include_dirs, ldflags, lib_dirs, libs, | 2116 asmflags, defines, include_dirs, ldflags, lib_dirs, libs, |
| 2101 precompiled_header, precompiled_source | 2117 precompiled_header, precompiled_source |
| 2102 Deps: data_deps, deps, public_deps | 2118 Deps: data_deps, deps, public_deps |
| 2103 Dependent configs: all_dependent_configs, public_configs | 2119 Dependent configs: all_dependent_configs, public_configs |
| 2104 General: check_includes, configs, data, inputs, output_name, | 2120 General: bundle_data, check_includes, configs, data, inputs, |
| 2105 output_extension, public, sources, testonly, visibility | 2121 output_name, output_extension, public, sources, testonly, |
| 2122 visibility |
| 2106 | 2123 |
| 2107 | 2124 |
| 2108 ``` | 2125 ``` |
| 2109 ## **source_set**: Declare a source set target. | 2126 ## **source_set**: Declare a source set target. |
| 2110 | 2127 |
| 2111 ``` | 2128 ``` |
| 2112 A source set is a collection of sources that get compiled, but are not | 2129 A source set is a collection of sources that get compiled, but are not |
| 2113 linked to produce any kind of library. Instead, the resulting object | 2130 linked to produce any kind of library. Instead, the resulting object |
| 2114 files are implicitly added to the linker line of all targets that | 2131 files are implicitly added to the linker line of all targets that |
| 2115 depend on the source set. | 2132 depend on the source set. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 2135 ``` | 2152 ``` |
| 2136 | 2153 |
| 2137 ### **Variables** | 2154 ### **Variables** |
| 2138 | 2155 |
| 2139 ``` | 2156 ``` |
| 2140 Flags: cflags, cflags_c, cflags_cc, cflags_objc, cflags_objcc, | 2157 Flags: cflags, cflags_c, cflags_cc, cflags_objc, cflags_objcc, |
| 2141 asmflags, defines, include_dirs, ldflags, lib_dirs, libs, | 2158 asmflags, defines, include_dirs, ldflags, lib_dirs, libs, |
| 2142 precompiled_header, precompiled_source | 2159 precompiled_header, precompiled_source |
| 2143 Deps: data_deps, deps, public_deps | 2160 Deps: data_deps, deps, public_deps |
| 2144 Dependent configs: all_dependent_configs, public_configs | 2161 Dependent configs: all_dependent_configs, public_configs |
| 2145 General: check_includes, configs, data, inputs, output_name, | 2162 General: bundle_data, check_includes, configs, data, inputs, |
| 2146 output_extension, public, sources, testonly, visibility | 2163 output_name, output_extension, public, sources, testonly, |
| 2164 visibility |
| 2147 | 2165 |
| 2148 | 2166 |
| 2149 ``` | 2167 ``` |
| 2150 ## **static_library**: Declare a static library target. | 2168 ## **static_library**: Declare a static library target. |
| 2151 | 2169 |
| 2152 ``` | 2170 ``` |
| 2153 Make a ".a" / ".lib" file. | 2171 Make a ".a" / ".lib" file. |
| 2154 | 2172 |
| 2155 If you only need the static library for intermediate results in the | 2173 If you only need the static library for intermediate results in the |
| 2156 build, you should consider a source_set instead since it will skip | 2174 build, you should consider a source_set instead since it will skip |
| 2157 the (potentially slow) step of creating the intermediate library file. | 2175 the (potentially slow) step of creating the intermediate library file. |
| 2158 | 2176 |
| 2159 ``` | 2177 ``` |
| 2160 | 2178 |
| 2161 ### **Variables** | 2179 ### **Variables** |
| 2162 | 2180 |
| 2163 ``` | 2181 ``` |
| 2164 Flags: cflags, cflags_c, cflags_cc, cflags_objc, cflags_objcc, | 2182 Flags: cflags, cflags_c, cflags_cc, cflags_objc, cflags_objcc, |
| 2165 asmflags, defines, include_dirs, ldflags, lib_dirs, libs, | 2183 asmflags, defines, include_dirs, ldflags, lib_dirs, libs, |
| 2166 precompiled_header, precompiled_source | 2184 precompiled_header, precompiled_source |
| 2167 Deps: data_deps, deps, public_deps | 2185 Deps: data_deps, deps, public_deps |
| 2168 Dependent configs: all_dependent_configs, public_configs | 2186 Dependent configs: all_dependent_configs, public_configs |
| 2169 General: check_includes, configs, data, inputs, output_name, | 2187 General: bundle_data, check_includes, configs, data, inputs, |
| 2170 output_extension, public, sources, testonly, visibility | 2188 output_name, output_extension, public, sources, testonly, |
| 2189 visibility |
| 2171 | 2190 |
| 2172 | 2191 |
| 2173 ``` | 2192 ``` |
| 2174 ## **target**: Declare an target with the given programmatic type. | 2193 ## **target**: Declare an target with the given programmatic type. |
| 2175 | 2194 |
| 2176 ``` | 2195 ``` |
| 2177 target(target_type_string, target_name_string) { ... } | 2196 target(target_type_string, target_name_string) { ... } |
| 2178 | 2197 |
| 2179 The target() function is a way to invoke a built-in target or template | 2198 The target() function is a way to invoke a built-in target or template |
| 2180 with a type determined at runtime. This is useful for cases where the | 2199 with a type determined at runtime. This is useful for cases where the |
| (...skipping 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3345 those configs appear in the list. | 3364 those configs appear in the list. |
| 3346 5. all_dependent_configs pulled from dependencies, in the order of | 3365 5. all_dependent_configs pulled from dependencies, in the order of |
| 3347 the "deps" list. This is done recursively. If a config appears | 3366 the "deps" list. This is done recursively. If a config appears |
| 3348 more than once, only the first occurance will be used. | 3367 more than once, only the first occurance will be used. |
| 3349 6. public_configs pulled from dependencies, in the order of the | 3368 6. public_configs pulled from dependencies, in the order of the |
| 3350 "deps" list. If a dependency is public, they will be applied | 3369 "deps" list. If a dependency is public, they will be applied |
| 3351 recursively. | 3370 recursively. |
| 3352 | 3371 |
| 3353 | 3372 |
| 3354 ``` | 3373 ``` |
| 3374 ## **bundle_data**: Runtime data dependency (Mac/iOS). |
| 3375 |
| 3376 ``` |
| 3377 List files that are required at runtime by the current target and |
| 3378 should be copied into the application bundle. |
| 3379 |
| 3380 See also "gn help copy_bundle_data". |
| 3381 |
| 3382 |
| 3383 ``` |
| 3355 ## **cflags***: Flags passed to the C compiler. | 3384 ## **cflags***: Flags passed to the C compiler. |
| 3356 | 3385 |
| 3357 ``` | 3386 ``` |
| 3358 A list of strings. | 3387 A list of strings. |
| 3359 | 3388 |
| 3360 "cflags" are passed to all invocations of the C, C++, Objective C, | 3389 "cflags" are passed to all invocations of the C, C++, Objective C, |
| 3361 and Objective C++ compilers. | 3390 and Objective C++ compilers. |
| 3362 | 3391 |
| 3363 To target one of these variants individually, use "cflags_c", | 3392 To target one of these variants individually, use "cflags_c", |
| 3364 "cflags_cc", "cflags_objc", and "cflags_objcc", | 3393 "cflags_cc", "cflags_objc", and "cflags_objcc", |
| (...skipping 1857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5222 ** -q**: Quiet mode. Don't print output on success. | 5251 ** -q**: Quiet mode. Don't print output on success. |
| 5223 ** \--root**: Explicitly specify source root. | 5252 ** \--root**: Explicitly specify source root. |
| 5224 ** \--runtime-deps-list-file**: Save runtime dependencies for targets in file. | 5253 ** \--runtime-deps-list-file**: Save runtime dependencies for targets in file. |
| 5225 ** \--threads**: Specify number of worker threads. | 5254 ** \--threads**: Specify number of worker threads. |
| 5226 ** \--time**: Outputs a summary of how long everything took. | 5255 ** \--time**: Outputs a summary of how long everything took. |
| 5227 ** \--tracelog**: Writes a Chrome-compatible trace log to the given file. | 5256 ** \--tracelog**: Writes a Chrome-compatible trace log to the given file. |
| 5228 ** -v**: Verbose logging. | 5257 ** -v**: Verbose logging. |
| 5229 ** \--version**: Prints the GN version number and exits. | 5258 ** \--version**: Prints the GN version number and exits. |
| 5230 | 5259 |
| 5231 ``` | 5260 ``` |
| OLD | NEW |