1GN(1)                            User Commands                           GN(1)
2
3
4

NAME

6       gn - Documentation for GN
7

DESCRIPTION

9   Commands (type  gn help <command>" for more help):"
10       analyze:
11               Analyze which targets are affected by a list of files.
12
13       args:
14               Display or configure arguments declared by the build.
15
16       check:
17               Check header dependencies.
18
19       clean:
20               Cleans the output directory.
21
22       clean_stale:
23               Cleans the stale output files from the output directory.
24
25       desc:
26               Show lots of insightful information about a target or config.
27
28       format:
29               Format .gn files.
30
31       gen:
32               Generate ninja files.
33
34       help:
35               Does what you think.
36
37       ls:
38               List matching targets.
39
40       meta:
41               List target metadata collection results.
42
43       outputs:
44               Which files a source/target make.
45
46       path:
47               Find paths between two targets.
48
49       refs:
50               Find stuff referencing a target or file.
51
52   Target declarations (type  gn help <function>" for more help):"
53       action:
54               Declare a target that runs a script a single time.
55
56       action_foreach:
57               Declare a target that runs a script over a set of files.
58
59       bundle_data:
60               [iOS/macOS] Declare a target without output.
61
62       copy:
63               Declare a target that copies files.
64
65       create_bundle:
66               [iOS/macOS] Build an iOS or macOS bundle.
67
68       executable:
69               Declare an executable target.
70
71       generated_file:
72               Declare a generated_file target.
73
74       group:
75               Declare a named group of targets.
76
77       loadable_module:
78               Declare a loadable module target.
79
80       rust_library:
81               Declare a Rust library target.
82
83       rust_proc_macro:
84               Declare a Rust procedural macro target.
85
86       shared_library:
87               Declare a shared library target.
88
89       source_set:
90               Declare a source set target.
91
92       static_library:
93               Declare a static library target.
94
95       target:
96               Declare an target with the given programmatic type.
97
98   Buildfile functions (type  gn help <function>" for more help):"
99       assert:
100               Assert an expression is true at generation time.
101
102       config:
103               Defines a configuration object.
104
105       declare_args:
106               Declare build arguments.
107
108       defined:
109               Returns whether an identifier is defined.
110
111       exec_script:
112               Synchronously run a script and return the output.
113
114       filter_exclude:
115               Remove values that match a set of patterns.
116
117       filter_include:
118               Remove values that do not match a set of patterns.
119
120       foreach:
121               Iterate over a list.
122
123       forward_variables_from:
124               Copies variables from a different scope.
125
126       get_label_info:
127               Get an attribute from a target's label.
128
129       get_path_info:
130               Extract parts of a file or directory name.
131
132       get_target_outputs:
133               [file list] Get the list of outputs from a target.
134
135       getenv:
136               Get an environment variable.
137
138       import:
139               Import a file into the current scope.
140
141       not_needed:
142               Mark variables from scope as not needed.
143
144       pool:
145               Defines a pool object.
146
147       print:
148               Prints to the console.
149
150       process_file_template:
151               Do template expansion over a list of files.
152
153       read_file:
154               Read a file into a variable.
155
156       rebase_path:
157               Rebase a file or directory to another location.
158
159       set_default_toolchain:
160               Sets the default toolchain name.
161
162       set_defaults:
163               Set default values for a target type.
164
165       split_list:
166               Splits a list into N different sub-lists.
167
168       string_join:
169               Concatenates a list of strings with a separator.
170
171       string_replace:
172               Replaces substring in the given string.
173
174       string_split:
175               Split string into a list of strings.
176
177       template:
178               Define a template rule.
179
180       tool:
181               Specify arguments to a toolchain tool.
182
183       toolchain:
184               Defines a toolchain.
185
186       write_file:
187               Write a file to disk.
188
189   Built-in predefined variables (type  gn help <variable>" for more help):"
190       current_cpu:
191               [string] The processor architecture of the current toolchain.
192
193       current_os:
194               [string] The operating system of the current toolchain.
195
196       current_toolchain:
197               [string] Label of the current toolchain.
198
199       default_toolchain:
200               [string] Label of the default toolchain.
201
202       gn_version:
203               [number] The version of gn.
204
205       host_cpu:
206               [string] The processor architecture that GN is running on.
207
208       host_os:
209               [string] The operating system that GN is running on.
210
211       invoker:
212               [string] The invoking scope inside a template.
213
214       python_path:
215               [string] Absolute path of Python.
216
217       root_build_dir:
218               [string] Directory where build commands are run.
219
220       root_gen_dir:
221               [string] Directory for the toolchain's generated files.
222
223       root_out_dir:
224               [string] Root directory for toolchain output files.
225
226       target_cpu:
227               [string] The desired cpu architecture for the build.
228
229       target_gen_dir:
230               [string] Directory for a target's generated files.
231
232       target_name:
233               [string] The name of the current target.
234
235       target_os:
236               [string] The desired operating system for the build.
237
238       target_out_dir:
239               [string] Directory for target output files.
240
241   Variables you set in targets (type  gn help <variable>" for more help):"
242       aliased_deps:
243               [scope] Set of crate-dependency pairs.
244
245       all_dependent_configs:
246               [label list] Configs to be forced on dependents.
247
248       allow_circular_includes_from:
249               [label list] Permit includes from deps.
250
251       arflags:
252               [string list] Arguments passed to static_library archiver.
253
254       args:
255               [string list] Arguments passed to an action.
256
257       asmflags:
258               [string list] Flags passed to the assembler.
259
260       assert_no_deps:
261               [label pattern list] Ensure no deps on these targets.
262
263       bridge_header:
264               [string] Path to C/Objective-C compatibility header.
265
266       bundle_contents_dir:
267               Expansion of {{bundle_contents_dir}} in create_bundle.
268
269       bundle_deps_filter:
270               [label list] A list of labels that are filtered out.
271
272       bundle_executable_dir:
273               Expansion of {{bundle_executable_dir}} in create_bundle
274
275       bundle_resources_dir:
276               Expansion of {{bundle_resources_dir}} in create_bundle.
277
278       bundle_root_dir:
279               Expansion of {{bundle_root_dir}} in create_bundle.
280
281       cflags:
282               [string list] Flags passed to all C compiler variants.
283
284       cflags_c:
285               [string list] Flags passed to the C compiler.
286
287       cflags_cc:
288               [string list] Flags passed to the C++ compiler.
289
290       cflags_objc:
291               [string list] Flags passed to the Objective C compiler.
292
293       cflags_objcc:
294               [string list] Flags passed to the Objective C++ compiler.
295
296       check_includes:
297               [boolean] Controls whether a target's files are checked.
298
299       code_signing_args:
300               [string list] Arguments passed to code signing script.
301
302       code_signing_outputs:
303               [file list] Output files for code signing step.
304
305       code_signing_script:
306               [file name] Script for code signing.
307
308       code_signing_sources:
309               [file list] Sources for code signing step.
310
311       complete_static_lib:
312               [boolean] Links all deps into a static library.
313
314       configs:
315               [label list] Configs applying to this target or config.
316
317       contents:
318               Contents to write to file.
319
320       crate_name:
321               [string] The name for the compiled crate.
322
323       crate_root:
324               [string] The root source file for a binary or library.
325
326       crate_type:
327               [string] The type of linkage to use on a shared_library.
328
329       data:
330               [file list] Runtime data file dependencies.
331
332       data_deps:
333               [label list] Non-linked dependencies.
334
335       data_keys:
336               [string list] Keys from which to collect metadata.
337
338       defines:
339               [string list] C preprocessor defines.
340
341       depfile:
342               [string] File name for input dependencies for actions.
343
344       deps:
345               [label list] Private linked dependencies.
346
347       externs:
348               [scope] Set of Rust crate-dependency pairs.
349
350       framework_dirs:
351               [directory list] Additional framework search directories.
352
353       frameworks:
354               [name list] Name of frameworks that must be linked.
355
356       friend:
357               [label pattern list] Allow targets to include private headers.
358
359       include_dirs:
360               [directory list] Additional include directories.
361
362       inputs:
363               [file list] Additional compile-time dependencies.
364
365       ldflags:
366               [string list] Flags passed to the linker.
367
368       lib_dirs:
369               [directory list] Additional library directories.
370
371       libs:
372               [string list] Additional libraries to link.
373
374       metadata:
375               [scope] Metadata of this target.
376
377       module_name:
378               [string] The name for the compiled module.
379
380       output_conversion:
381               Data format for generated_file targets.
382
383       output_dir:
384               [directory] Directory to put output file in.
385
386       output_extension:
387               [string] Value to use for the output's file extension.
388
389       output_name:
390               [string] Name for the output file other than the default.
391
392       output_prefix_override:
393               [boolean] Don't use prefix for output name.
394
395       outputs:
396               [file list] Output files for actions and copy targets.
397
398       partial_info_plist:
399               [filename] Path plist from asset catalog compiler.
400
401       pool:
402               [string] Label of the pool used by the action.
403
404       precompiled_header:
405               [string] Header file to precompile.
406
407       precompiled_header_type:
408               [string] "gcc" or "msvc".
409
410       precompiled_source:
411               [file name] Source file to precompile.
412
413       product_type:
414               [string] Product type for Xcode projects.
415
416       public:
417               [file list] Declare public header files for a target.
418
419       public_configs:
420               [label list] Configs applied to dependents.
421
422       public_deps:
423               [label list] Declare public dependencies.
424
425       rebase:
426               [boolean] Rebase collected metadata as files.
427
428       response_file_contents:
429               [string list] Contents of .rsp file for actions.
430
431       script:
432               [file name] Script file for actions.
433
434       sources:
435               [file list] Source files for a target.
436
437       swiftflags:
438               [string list] Flags passed to the swift compiler.
439
440       testonly:
441               [boolean] Declares a target must only be used for testing.
442
443       visibility:
444               [label list] A list of labels that can depend on a target.
445
446       walk_keys:
447               [string list] Key(s) for managing the metadata collection walk.
448
449       weak_frameworks:
450               [name list] Name of frameworks that must be weak linked.
451
452       write_runtime_deps:
453               Writes the target's runtime_deps to the given path.
454
455       xcasset_compiler_flags:
456               [string list] Flags passed to xcassets compiler
457
458       xcode_extra_attributes:
459               [scope] Extra attributes for Xcode projects.
460
461       xcode_test_application_name:
462               [string] Name for Xcode test target.
463
464   Other help topics:
465       all:
466               Print all the help at once
467
468       buildargs:
469               How build arguments work.
470
471       dotfile:
472               Info about the toplevel .gn file.
473
474       execution:
475               Build graph and execution overview.
476
477       grammar:
478               Language and grammar for GN build files.
479
480       input_conversion:
481               Processing input from exec_script and read_file.
482
483       file_pattern:
484               Matching more than one file.
485
486       label_pattern:
487               Matching more than one label.
488
489       labels:
490               About labels.
491
492       metadata_collection:
493               About metadata and its collection.
494
495       ninja_rules:
496               How Ninja build rules are named.
497
498       nogncheck:
499               Annotating includes for checking.
500
501       output_conversion:
502               Specifies how to transform a value to output.
503
504       runtime_deps:
505               How runtime dependency computation works.
506
507       source_expansion:
508               Map sources to outputs for scripts.
509
510       switches:
511               Show available command-line switches.
512
513
514
515gn 1894 (b2e3d862)                March 2021                             GN(1)
Impressum