| 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 2827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2838 | 2838 |
| 2839 output_prefix [string] | 2839 output_prefix [string] |
| 2840 Valid for: Linker tools (optional) | 2840 Valid for: Linker tools (optional) |
| 2841 | 2841 |
| 2842 Prefix to use for the output name. Defaults to empty. This | 2842 Prefix to use for the output name. Defaults to empty. This |
| 2843 prefix will be prepended to the name of the target (or the | 2843 prefix will be prepended to the name of the target (or the |
| 2844 output_name if one is manually specified for it) if the prefix | 2844 output_name if one is manually specified for it) if the prefix |
| 2845 is not already there. The result will show up in the | 2845 is not already there. The result will show up in the |
| 2846 {{output_name}} substitution pattern. | 2846 {{output_name}} substitution pattern. |
| 2847 | 2847 |
| 2848 Individual targets can opt-out of the output prefix by setting: |
| 2849 output_prefix_override = true |
| 2850 (see "gn help output_prefix_override"). |
| 2851 |
| 2848 This is typically used to prepend "lib" to libraries on | 2852 This is typically used to prepend "lib" to libraries on |
| 2849 Posix systems: | 2853 Posix systems: |
| 2850 output_prefix = "lib" | 2854 output_prefix = "lib" |
| 2851 | 2855 |
| 2852 precompiled_header_type [string] | 2856 precompiled_header_type [string] |
| 2853 Valid for: "cc", "cxx", "objc", "objcxx" | 2857 Valid for: "cc", "cxx", "objc", "objcxx" |
| 2854 | 2858 |
| 2855 Type of precompiled headers. If undefined or the empty string, | 2859 Type of precompiled headers. If undefined or the empty string, |
| 2856 precompiled headers will not be used for this tool. Otherwise | 2860 precompiled headers will not be used for this tool. Otherwise |
| 2857 use "gcc" or "msvc". | 2861 use "gcc" or "msvc". |
| (...skipping 1799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4657 | 4661 |
| 4658 ``` | 4662 ``` |
| 4659 ## **output_extension**: Value to use for the output's file extension. | 4663 ## **output_extension**: Value to use for the output's file extension. |
| 4660 | 4664 |
| 4661 ``` | 4665 ``` |
| 4662 Normally the file extension for a target is based on the target | 4666 Normally the file extension for a target is based on the target |
| 4663 type and the operating system, but in rare cases you will need to | 4667 type and the operating system, but in rare cases you will need to |
| 4664 override the name (for example to use "libfreetype.so.6" instead | 4668 override the name (for example to use "libfreetype.so.6" instead |
| 4665 of libfreetype.so on Linux). | 4669 of libfreetype.so on Linux). |
| 4666 | 4670 |
| 4667 This value should not include a leading dot. If undefined or empty, | 4671 This value should not include a leading dot. If undefined, the default |
| 4668 the default_output_extension specified on the tool will be used. | 4672 specified on the tool will be used. If set to the empty string, no |
| 4669 The output_extension will be used in the "{{output_extension}}" | 4673 output extension will be used. |
| 4674 |
| 4675 The output_extension will be used to set the "{{output_extension}}" |
| 4670 expansion which the linker tool will generally use to specify the | 4676 expansion which the linker tool will generally use to specify the |
| 4671 output file name. See "gn help tool". | 4677 output file name. See "gn help tool". |
| 4672 | 4678 |
| 4673 ``` | 4679 ``` |
| 4674 | 4680 |
| 4675 ### **Example** | 4681 ### **Example** |
| 4676 | 4682 |
| 4677 ``` | 4683 ``` |
| 4678 shared_library("freetype") { | 4684 shared_library("freetype") { |
| 4679 if (is_linux) { | 4685 if (is_linux) { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4717 | 4723 |
| 4718 ### **Example** | 4724 ### **Example** |
| 4719 | 4725 |
| 4720 ``` | 4726 ``` |
| 4721 static_library("doom_melon") { | 4727 static_library("doom_melon") { |
| 4722 output_name = "fluffy_bunny" | 4728 output_name = "fluffy_bunny" |
| 4723 } | 4729 } |
| 4724 | 4730 |
| 4725 | 4731 |
| 4726 ``` | 4732 ``` |
| 4733 ## **output_prefix_override**: Don't use prefix for output name. |
| 4734 |
| 4735 ``` |
| 4736 A boolean that overrides the output prefix for a target. Defaults to |
| 4737 false. |
| 4738 |
| 4739 Some systems use prefixes for the names of the final target output |
| 4740 file. The normal example is "libfoo.so" on Linux for a target |
| 4741 named "foo". |
| 4742 |
| 4743 The output prefix for a given target type is specified on the linker |
| 4744 tool (see "gn help tool"). Sometimes this prefix is undesired. |
| 4745 |
| 4746 See also "gn help output_extension". |
| 4747 |
| 4748 ``` |
| 4749 |
| 4750 ### **Example** |
| 4751 |
| 4752 ``` |
| 4753 shared_library("doom_melon") { |
| 4754 # Normally this will produce "libdoom_melon.so" on Linux, setting |
| 4755 # Setting this flag will produce "doom_melon.so". |
| 4756 output_prefix_override = true |
| 4757 ... |
| 4758 } |
| 4759 |
| 4760 |
| 4761 ``` |
| 4727 ## **outputs**: Output files for actions and copy targets. | 4762 ## **outputs**: Output files for actions and copy targets. |
| 4728 | 4763 |
| 4729 ``` | 4764 ``` |
| 4730 Outputs is valid for "copy", "action", and "action_foreach" | 4765 Outputs is valid for "copy", "action", and "action_foreach" |
| 4731 target types and indicates the resulting files. Outputs must always | 4766 target types and indicates the resulting files. Outputs must always |
| 4732 refer to files in the build directory. | 4767 refer to files in the build directory. |
| 4733 | 4768 |
| 4734 copy | 4769 copy |
| 4735 Copy targets should have exactly one entry in the outputs list. If | 4770 Copy targets should have exactly one entry in the outputs list. If |
| 4736 there is exactly one source, this can be a literal file name or a | 4771 there is exactly one source, this can be a literal file name or a |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5124 | 5159 |
| 5125 Just these specific targets: | 5160 Just these specific targets: |
| 5126 visibility = [ ":mything", "//foo:something_else" ] | 5161 visibility = [ ":mything", "//foo:something_else" ] |
| 5127 | 5162 |
| 5128 Any target in the current directory and any subdirectory thereof, plus | 5163 Any target in the current directory and any subdirectory thereof, plus |
| 5129 any targets in "//bar/" and any subdirectory thereof. | 5164 any targets in "//bar/" and any subdirectory thereof. |
| 5130 visibility = [ "./*", "//bar/*" ] | 5165 visibility = [ "./*", "//bar/*" ] |
| 5131 | 5166 |
| 5132 | 5167 |
| 5133 ``` | 5168 ``` |
| 5169 ## **write_runtime_deps**: Writes the target's runtime_deps to the given path. |
| 5170 |
| 5171 ``` |
| 5172 Does not synchronously write the file, but rather schedules it |
| 5173 to be written at the end of generation. |
| 5174 |
| 5175 If the file exists and the contents are identical to that being |
| 5176 written, the file will not be updated. This will prevent unnecessary |
| 5177 rebuilds of targets that depend on this file. |
| 5178 |
| 5179 Path must be within the output directory. |
| 5180 |
| 5181 See "gn help runtime_deps" for how the runtime dependencies are |
| 5182 computed. |
| 5183 |
| 5184 The format of this file will list one file per line with no escaping. |
| 5185 The files will be relative to the root_build_dir. The first line of |
| 5186 the file will be the main output file of the target itself. The file |
| 5187 contents will be the same as requesting the runtime deps be written on |
| 5188 the command line (see "gn help --runtime-deps-list-file"). |
| 5189 |
| 5190 |
| 5191 ``` |
| 5134 ## **Build Arguments Overview** | 5192 ## **Build Arguments Overview** |
| 5135 | 5193 |
| 5136 ``` | 5194 ``` |
| 5137 Build arguments are variables passed in from outside of the build | 5195 Build arguments are variables passed in from outside of the build |
| 5138 that build files can query to determine how the build works. | 5196 that build files can query to determine how the build works. |
| 5139 | 5197 |
| 5140 ``` | 5198 ``` |
| 5141 | 5199 |
| 5142 ### **How build arguments are set** | 5200 ### **How build arguments are set** |
| 5143 | 5201 |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5554 works and advice on fixing problems. Targets can also opt-out of | 5612 works and advice on fixing problems. Targets can also opt-out of |
| 5555 checking, see "gn help check_includes". | 5613 checking, see "gn help check_includes". |
| 5556 | 5614 |
| 5557 | 5615 |
| 5558 ``` | 5616 ``` |
| 5559 ## **Runtime dependencies** | 5617 ## **Runtime dependencies** |
| 5560 | 5618 |
| 5561 ``` | 5619 ``` |
| 5562 Runtime dependencies of a target are exposed via the "runtime_deps" | 5620 Runtime dependencies of a target are exposed via the "runtime_deps" |
| 5563 category of "gn desc" (see "gn help desc") or they can be written | 5621 category of "gn desc" (see "gn help desc") or they can be written |
| 5564 at build generation time via "--runtime-deps-list-file" | 5622 at build generation time via write_runtime_deps(), or |
| 5565 (see "gn help --runtime-deps-list-file"). | 5623 --runtime-deps-list-file (see "gn help --runtime-deps-list-file"). |
| 5566 | 5624 |
| 5567 To a first approximation, the runtime dependencies of a target are | 5625 To a first approximation, the runtime dependencies of a target are |
| 5568 the set of "data" files, data directories, and the shared libraries | 5626 the set of "data" files, data directories, and the shared libraries |
| 5569 from all transitive dependencies. Executables, shared libraries, and | 5627 from all transitive dependencies. Executables, shared libraries, and |
| 5570 loadable modules are considered runtime dependencies of themselves. | 5628 loadable modules are considered runtime dependencies of themselves. |
| 5571 | 5629 |
| 5572 ``` | 5630 ``` |
| 5573 | 5631 |
| 5574 ### **Executables** | 5632 ### **Executables** |
| 5575 | 5633 |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5771 ** -q**: Quiet mode. Don't print output on success. | 5829 ** -q**: Quiet mode. Don't print output on success. |
| 5772 ** \--root**: Explicitly specify source root. | 5830 ** \--root**: Explicitly specify source root. |
| 5773 ** \--runtime-deps-list-file**: Save runtime dependencies for targets in file. | 5831 ** \--runtime-deps-list-file**: Save runtime dependencies for targets in file. |
| 5774 ** \--threads**: Specify number of worker threads. | 5832 ** \--threads**: Specify number of worker threads. |
| 5775 ** \--time**: Outputs a summary of how long everything took. | 5833 ** \--time**: Outputs a summary of how long everything took. |
| 5776 ** \--tracelog**: Writes a Chrome-compatible trace log to the given file. | 5834 ** \--tracelog**: Writes a Chrome-compatible trace log to the given file. |
| 5777 ** -v**: Verbose logging. | 5835 ** -v**: Verbose logging. |
| 5778 ** \--version**: Prints the GN version number and exits. | 5836 ** \--version**: Prints the GN version number and exits. |
| 5779 | 5837 |
| 5780 ``` | 5838 ``` |
| OLD | NEW |