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 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 "vs" - Visual Studio project/solution files. | 690 "vs" - Visual Studio project/solution files. |
691 (default Visual Studio version: 2015) | 691 (default Visual Studio version: 2015) |
692 "vs2013" - Visual Studio 2013 project/solution files. | 692 "vs2013" - Visual Studio 2013 project/solution files. |
693 "vs2015" - Visual Studio 2015 project/solution files. | 693 "vs2015" - Visual Studio 2015 project/solution files. |
694 "xcode" - Xcode workspace/solution files. | 694 "xcode" - Xcode workspace/solution files. |
695 "qtcreator" - QtCreator project files. | 695 "qtcreator" - QtCreator project files. |
696 | 696 |
697 --filters=<path_prefixes> | 697 --filters=<path_prefixes> |
698 Semicolon-separated list of label patterns used to limit the set | 698 Semicolon-separated list of label patterns used to limit the set |
699 of generated projects (see "gn help label_pattern"). Only | 699 of generated projects (see "gn help label_pattern"). Only |
700 matching targets will be included to the solution. Only used for | 700 matching targets and their dependencies will be included in the |
701 Visual Studio and Xcode. | 701 solution. Only used for Visual Studio and Xcode. |
702 | 702 |
703 ``` | 703 ``` |
704 | 704 |
705 ### **Visual Studio Flags** | 705 ### **Visual Studio Flags** |
706 | 706 |
707 ``` | 707 ``` |
708 --sln=<file_name> | 708 --sln=<file_name> |
709 Override default sln file name ("all"). Solution file is written | 709 Override default sln file name ("all"). Solution file is written |
710 to the root build directory. | 710 to the root build directory. |
711 | 711 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
857 Lists all variants of the target //base:base (it may be referenced | 857 Lists all variants of the target //base:base (it may be referenced |
858 in multiple toolchains). | 858 in multiple toolchains). |
859 | 859 |
860 | 860 |
861 ``` | 861 ``` |
862 ## **gn path <out_dir> <target_one> <target_two>** | 862 ## **gn path <out_dir> <target_one> <target_two>** |
863 | 863 |
864 ``` | 864 ``` |
865 Finds paths of dependencies between two targets. Each unique path | 865 Finds paths of dependencies between two targets. Each unique path |
866 will be printed in one group, and groups will be separate by newlines. | 866 will be printed in one group, and groups will be separate by newlines. |
867 The two targets can appear in either order: paths will be found going | 867 The two targets can appear in either order (paths will be found going |
868 in either direction. | 868 in either direction). |
869 | 869 |
870 By default, a single path will be printed. If there is a path with | 870 By default, a single path will be printed. If there is a path with |
871 only public dependencies, the shortest public path will be printed. | 871 only public dependencies, the shortest public path will be printed. |
872 Otherwise, the shortest path using either public or private | 872 Otherwise, the shortest path using either public or private |
873 dependencies will be printed. If --with-data is specified, data deps | 873 dependencies will be printed. If --with-data is specified, data deps |
874 will also be considered. If there are multiple shortest paths, an | 874 will also be considered. If there are multiple shortest paths, an |
875 arbitrary one will be selected. | 875 arbitrary one will be selected. |
876 | 876 |
877 ``` | 877 ``` |
878 | 878 |
| 879 ### **Interesting paths** |
| 880 |
| 881 ``` |
| 882 In a large project, there can be 100's of millions of unique paths |
| 883 between a very high level and a common low-level target. To make the |
| 884 output more useful (and terminate in a reasonable time), GN will not |
| 885 revisit sub-paths previously known to lead to the target. |
| 886 |
| 887 ``` |
| 888 |
879 ### **Options** | 889 ### **Options** |
880 | 890 |
881 ``` | 891 ``` |
882 --all | 892 --all |
883 Prints all paths found rather than just the first one. Public paths | 893 Prints all "interesting" paths found rather than just the first |
884 will be printed first in order of increasing length, followed by | 894 one. Public paths will be printed first in order of increasing |
885 non-public paths in order of increasing length. | 895 length, followed by non-public paths in order of increasing length. |
886 | 896 |
887 --public | 897 --public |
888 Considers only public paths. Can't be used with --with-data. | 898 Considers only public paths. Can't be used with --with-data. |
889 | 899 |
890 --with-data | 900 --with-data |
891 Additionally follows data deps. Without this flag, only public and | 901 Additionally follows data deps. Without this flag, only public and |
892 private linked deps will be followed. Can't be used with --public. | 902 private linked deps will be followed. Can't be used with --public. |
893 | 903 |
894 ``` | 904 ``` |
895 | 905 |
(...skipping 2708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3604 args = [ "-o", rebase_path(root_out_dir, root_build_dir) ] | 3614 args = [ "-o", rebase_path(root_out_dir, root_build_dir) ] |
3605 } | 3615 } |
3606 | 3616 |
3607 | 3617 |
3608 ``` | 3618 ``` |
3609 ## **target_cpu**: The desired cpu architecture for the build. | 3619 ## **target_cpu**: The desired cpu architecture for the build. |
3610 | 3620 |
3611 ``` | 3621 ``` |
3612 This value should be used to indicate the desired architecture for | 3622 This value should be used to indicate the desired architecture for |
3613 the primary objects of the build. It will match the cpu architecture | 3623 the primary objects of the build. It will match the cpu architecture |
3614 of the default toolchain. | 3624 of the default toolchain, but not necessarily the current toolchain. |
3615 | 3625 |
3616 In many cases, this is the same as "host_cpu", but in the case | 3626 In many cases, this is the same as "host_cpu", but in the case |
3617 of cross-compiles, this can be set to something different. This | 3627 of cross-compiles, this can be set to something different. This |
3618 value is different from "current_cpu" in that it can be referenced | 3628 value is different from "current_cpu" in that it does not change |
3619 from inside any toolchain. This value can also be ignored if it is | 3629 based on the current toolchain. When writing rules, "current_cpu" |
3620 not needed or meaningful for a project. | 3630 should be used rather than "target_cpu" most of the time. |
3621 | 3631 |
3622 This value is not used internally by GN for any purpose, so it | 3632 This value is not used internally by GN for any purpose, so it |
3623 may be set to whatever value is needed for the build. | 3633 may be set to whatever value is needed for the build. |
3624 GN defaults this value to the empty string ("") and the | 3634 GN defaults this value to the empty string ("") and the |
3625 configuration files should set it to an appropriate value | 3635 configuration files should set it to an appropriate value |
3626 (e.g., setting it to the value of "host_cpu") if it is not | 3636 (e.g., setting it to the value of "host_cpu") if it is not |
3627 overridden on the command line or in the args.gn file. | 3637 overridden on the command line or in the args.gn file. |
3628 | 3638 |
3629 Where practical, use one of the following list of common values: | 3639 Where practical, use one of the following list of common values: |
3630 | 3640 |
(...skipping 2311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5942 (possibly on the static library target itself). | 5952 (possibly on the static library target itself). |
5943 | 5953 |
5944 ``` | 5954 ``` |
5945 | 5955 |
5946 ### **Multiple outputs** | 5956 ### **Multiple outputs** |
5947 | 5957 |
5948 ``` | 5958 ``` |
5949 When a tool produces more than one output, only the first output | 5959 When a tool produces more than one output, only the first output |
5950 is considered. For example, a shared library target may produce a | 5960 is considered. For example, a shared library target may produce a |
5951 .dll and a .lib file on Windows. Only the .dll file will be considered | 5961 .dll and a .lib file on Windows. Only the .dll file will be considered |
5952 a runtime dependency. This applies only to linker tools, scripts and | 5962 a runtime dependency. This applies only to linker tools. Scripts and |
5953 copy steps with multiple outputs will also get all outputs listed. | 5963 copy steps with multiple outputs will get all outputs listed. |
5954 | 5964 |
5955 | 5965 |
5956 ``` | 5966 ``` |
5957 ## **How Source Expansion Works** | 5967 ## **How Source Expansion Works** |
5958 | 5968 |
5959 ``` | 5969 ``` |
5960 Source expansion is used for the action_foreach and copy target types | 5970 Source expansion is used for the action_foreach and copy target types |
5961 to map source file names to output file names or arguments. | 5971 to map source file names to output file names or arguments. |
5962 | 5972 |
5963 To perform source expansion in the outputs, GN maps every entry in the | 5973 To perform source expansion in the outputs, GN maps every entry in the |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6091 ** \--root**: Explicitly specify source root. | 6101 ** \--root**: Explicitly specify source root. |
6092 ** \--runtime-deps-list-file**: Save runtime dependencies for targets in file. | 6102 ** \--runtime-deps-list-file**: Save runtime dependencies for targets in file. |
6093 ** \--script-executable**: Set the executable used to execute scripts. | 6103 ** \--script-executable**: Set the executable used to execute scripts. |
6094 ** \--threads**: Specify number of worker threads. | 6104 ** \--threads**: Specify number of worker threads. |
6095 ** \--time**: Outputs a summary of how long everything took. | 6105 ** \--time**: Outputs a summary of how long everything took. |
6096 ** \--tracelog**: Writes a Chrome-compatible trace log to the given file. | 6106 ** \--tracelog**: Writes a Chrome-compatible trace log to the given file. |
6097 ** -v**: Verbose logging. | 6107 ** -v**: Verbose logging. |
6098 ** \--version**: Prints the GN version number and exits. | 6108 ** \--version**: Prints the GN version number and exits. |
6099 | 6109 |
6100 ``` | 6110 ``` |
OLD | NEW |