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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 This is probably not useful; the use-case for this feature is | 169 This is probably not useful; the use-case for this feature is |
170 generally executable targets. | 170 generally executable targets. |
171 | 171 |
172 The runtime dependency file will list one file per line, with no | 172 The runtime dependency file will list one file per line, with no |
173 escaping. The files will be relative to the root_build_dir. The first | 173 escaping. The files will be relative to the root_build_dir. The first |
174 line of the file will be the main output file of the target itself | 174 line of the file will be the main output file of the target itself |
175 (in the above example, "bar.so"). | 175 (in the above example, "bar.so"). |
176 | 176 |
177 | 177 |
178 ``` | 178 ``` |
| 179 ## **\--script-executable**: Set the executable used to execute scripts. |
| 180 |
| 181 ``` |
| 182 By default GN searches the PATH for Python to execute scripts in |
| 183 action targets and exec_script calls. This flag allows the |
| 184 specification of a specific Python executable or potentially |
| 185 a different language interpreter. |
| 186 |
| 187 |
| 188 ``` |
179 ## **\--threads**: Specify number of worker threads. | 189 ## **\--threads**: Specify number of worker threads. |
180 | 190 |
181 ``` | 191 ``` |
182 GN runs many threads to load and run build files. This can make | 192 GN runs many threads to load and run build files. This can make |
183 debugging challenging. Or you may want to experiment with different | 193 debugging challenging. Or you may want to experiment with different |
184 values to see how it affects performance. | 194 values to see how it affects performance. |
185 | 195 |
186 The parameter is the number of worker threads. This does not count the | 196 The parameter is the number of worker threads. This does not count the |
187 main thread (so there are always at least two). | 197 main thread (so there are always at least two). |
188 | 198 |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 ``` | 684 ``` |
675 GN optionally generates files for IDE. Possibilities for <ide options> | 685 GN optionally generates files for IDE. Possibilities for <ide options> |
676 | 686 |
677 --ide=<ide_name> | 687 --ide=<ide_name> |
678 Generate files for an IDE. Currently supported values: | 688 Generate files for an IDE. Currently supported values: |
679 "eclipse" - Eclipse CDT settings file. | 689 "eclipse" - Eclipse CDT settings file. |
680 "vs" - Visual Studio project/solution files. | 690 "vs" - Visual Studio project/solution files. |
681 (default Visual Studio version: 2015) | 691 (default Visual Studio version: 2015) |
682 "vs2013" - Visual Studio 2013 project/solution files. | 692 "vs2013" - Visual Studio 2013 project/solution files. |
683 "vs2015" - Visual Studio 2015 project/solution files. | 693 "vs2015" - Visual Studio 2015 project/solution files. |
684 | 694 "xcode" - Xcode workspace/solution files. |
685 --sln=<file_name> | 695 "qtcreator" - QtCreator project files. |
686 Override default sln file name ("all"). Solution file is written | |
687 to the root build directory. Only for Visual Studio. | |
688 | 696 |
689 --filters=<path_prefixes> | 697 --filters=<path_prefixes> |
690 Semicolon-separated list of label patterns used to limit the set | 698 Semicolon-separated list of label patterns used to limit the set |
691 of generated projects (see "gn help label_pattern"). Only | 699 of generated projects (see "gn help label_pattern"). Only |
692 matching targets will be included to the solution. Only for Visual | 700 matching targets will be included to the solution. Only used for |
693 Studio. | 701 Visual Studio and Xcode. |
694 | 702 |
695 ``` | 703 ``` |
696 | 704 |
| 705 ### **Visual Studio Flags** |
| 706 |
| 707 ``` |
| 708 --sln=<file_name> |
| 709 Override default sln file name ("all"). Solution file is written |
| 710 to the root build directory. |
| 711 |
| 712 ``` |
| 713 |
| 714 ### **Xcode Flags** |
| 715 |
| 716 ``` |
| 717 --workspace=<file_name> |
| 718 Override defaut workspace file name ("all"). The workspace file |
| 719 is written to the root build directory. |
| 720 |
| 721 --ninja-extra-args=<string> |
| 722 This string is passed without any quoting to the ninja invocation |
| 723 command-line. Can be used to configure ninja flags, like "-j" if |
| 724 using goma for example. |
| 725 |
| 726 --root-target=<target_name> |
| 727 Name of the target corresponding to "All" target in Xcode. |
| 728 If unset, "All" invokes ninja without any target |
| 729 and builds everything. |
| 730 |
| 731 ``` |
| 732 |
| 733 ### **QtCreator Flags** |
| 734 |
| 735 ``` |
| 736 --root-target=<target_name> |
| 737 Name of the root target for which the QtCreator project will be |
| 738 generated to contain files of it and its dependencies. If unset, |
| 739 the whole build graph will be omitted. |
| 740 |
| 741 |
| 742 ``` |
| 743 |
697 ### **Eclipse IDE Support** | 744 ### **Eclipse IDE Support** |
698 | 745 |
699 ``` | 746 ``` |
700 GN DOES NOT generate Eclipse CDT projects. Instead, it generates a | 747 GN DOES NOT generate Eclipse CDT projects. Instead, it generates a |
701 settings file which can be imported into an Eclipse CDT project. The | 748 settings file which can be imported into an Eclipse CDT project. The |
702 XML file contains a list of include paths and defines. Because GN does | 749 XML file contains a list of include paths and defines. Because GN does |
703 not generate a full .cproject definition, it is not possible to | 750 not generate a full .cproject definition, it is not possible to |
704 properly define includes/defines for each file individually. | 751 properly define includes/defines for each file individually. |
705 Instead, one set of includes/defines is generated for the entire | 752 Instead, one set of includes/defines is generated for the entire |
706 project. This works fairly well but may still result in a few indexer | 753 project. This works fairly well but may still result in a few indexer |
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1370 This target can be used on all platforms though it is designed only to | 1417 This target can be used on all platforms though it is designed only to |
1371 generate iOS/OS X bundle. In cross-platform projects, it is advised to | 1418 generate iOS/OS X bundle. In cross-platform projects, it is advised to |
1372 put it behind iOS/Mac conditionals. | 1419 put it behind iOS/Mac conditionals. |
1373 | 1420 |
1374 ``` | 1421 ``` |
1375 | 1422 |
1376 ### **Variables** | 1423 ### **Variables** |
1377 | 1424 |
1378 ``` | 1425 ``` |
1379 bundle_root_dir*, bundle_resources_dir*, bundle_executable_dir*, | 1426 bundle_root_dir*, bundle_resources_dir*, bundle_executable_dir*, |
1380 bundle_plugins_dir*, deps, data_deps, public_deps, visibility | 1427 bundle_plugins_dir*, deps, data_deps, public_deps, visibility, |
| 1428 product_type |
1381 * = required | 1429 * = required |
1382 | 1430 |
1383 ``` | 1431 ``` |
1384 | 1432 |
1385 ### **Example** | 1433 ### **Example** |
1386 | 1434 |
1387 ``` | 1435 ``` |
1388 # Defines a template to create an application. On most platform, this | 1436 # Defines a template to create an application. On most platform, this |
1389 # is just an alias for an "executable" target, but on iOS/OS X, it | 1437 # is just an alias for an "executable" target, but on iOS/OS X, it |
1390 # builds an application bundle. | 1438 # builds an application bundle. |
(...skipping 29 matching lines...) Expand all Loading... |
1420 rebase_path("$gen_path/$app_name", root_build_dir) | 1468 rebase_path("$gen_path/$app_name", root_build_dir) |
1421 } | 1469 } |
1422 | 1470 |
1423 bundle_data("${app_name}_bundle_executable") { | 1471 bundle_data("${app_name}_bundle_executable") { |
1424 deps = [ ":${app_name}_generate_executable" ] | 1472 deps = [ ":${app_name}_generate_executable" ] |
1425 sources = [ "$gen_path/$app_name" ] | 1473 sources = [ "$gen_path/$app_name" ] |
1426 outputs = [ "{{bundle_executable_dir}}/$app_name" ] | 1474 outputs = [ "{{bundle_executable_dir}}/$app_name" ] |
1427 } | 1475 } |
1428 | 1476 |
1429 create_bundle("${app_name}.app") { | 1477 create_bundle("${app_name}.app") { |
| 1478 product_type = "com.apple.product-type.application" |
1430 deps = [ | 1479 deps = [ |
1431 ":${app_name}_bundle_executable", | 1480 ":${app_name}_bundle_executable", |
1432 ":${app_name}_bundle_info_plist", | 1481 ":${app_name}_bundle_info_plist", |
1433 ] | 1482 ] |
1434 if (is_ios) { | 1483 if (is_ios) { |
1435 bundle_root_dir = "${root_build_dir}/$target_name" | 1484 bundle_root_dir = "${root_build_dir}/$target_name" |
1436 bundle_resources_dir = bundle_root_dir | 1485 bundle_resources_dir = bundle_root_dir |
1437 bundle_executable_dir = bundle_root_dir | 1486 bundle_executable_dir = bundle_root_dir |
1438 bundle_plugins_dir = bundle_root_dir + "/Plugins" | 1487 bundle_plugins_dir = bundle_root_dir + "/Plugins" |
1439 } else { | 1488 } else { |
(...skipping 3542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4982 ``` | 5031 ``` |
4983 ## **precompiled_source**: [file name] Source file to precompile. | 5032 ## **precompiled_source**: [file name] Source file to precompile. |
4984 | 5033 |
4985 ``` | 5034 ``` |
4986 The source file that goes along with the precompiled_header when | 5035 The source file that goes along with the precompiled_header when |
4987 using "msvc"-style precompiled headers. It will be implicitly added | 5036 using "msvc"-style precompiled headers. It will be implicitly added |
4988 to the sources of the target. See "gn help precompiled_header". | 5037 to the sources of the target. See "gn help precompiled_header". |
4989 | 5038 |
4990 | 5039 |
4991 ``` | 5040 ``` |
| 5041 ## **product_type**: Product type for Xcode projects. |
| 5042 |
| 5043 ``` |
| 5044 Correspond to the type of the product of a create_bundle target. Only |
| 5045 meaningful to Xcode (used as part of the Xcode project generation). |
| 5046 |
| 5047 When generating Xcode project files, only create_bundle target with |
| 5048 a non-empty product_type will have a corresponding target in Xcode |
| 5049 project. |
| 5050 |
| 5051 |
| 5052 ``` |
4992 ## **public**: Declare public header files for a target. | 5053 ## **public**: Declare public header files for a target. |
4993 | 5054 |
4994 ``` | 5055 ``` |
4995 A list of files that other targets can include. These permissions are | 5056 A list of files that other targets can include. These permissions are |
4996 checked via the "check" command (see "gn help check"). | 5057 checked via the "check" command (see "gn help check"). |
4997 | 5058 |
4998 If no public files are declared, other targets (assuming they have | 5059 If no public files are declared, other targets (assuming they have |
4999 visibility to depend on this target can include any file in the | 5060 visibility to depend on this target can include any file in the |
5000 sources list. If this variable is defined on a target, dependent | 5061 sources list. If this variable is defined on a target, dependent |
5001 targets may only include files on this whitelist. | 5062 targets may only include files on this whitelist. |
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5959 | 6020 |
5960 ** \--args**: Specifies build arguments overrides. | 6021 ** \--args**: Specifies build arguments overrides. |
5961 ** \--color**: Force colored output. | 6022 ** \--color**: Force colored output. |
5962 ** \--dotfile**: Override the name of the ".gn" file. | 6023 ** \--dotfile**: Override the name of the ".gn" file. |
5963 ** \--fail-on-unused-args**: Treat unused build args as fatal errors. | 6024 ** \--fail-on-unused-args**: Treat unused build args as fatal errors. |
5964 ** \--markdown**: Write help output in the Markdown format. | 6025 ** \--markdown**: Write help output in the Markdown format. |
5965 ** \--nocolor**: Force non-colored output. | 6026 ** \--nocolor**: Force non-colored output. |
5966 ** -q**: Quiet mode. Don't print output on success. | 6027 ** -q**: Quiet mode. Don't print output on success. |
5967 ** \--root**: Explicitly specify source root. | 6028 ** \--root**: Explicitly specify source root. |
5968 ** \--runtime-deps-list-file**: Save runtime dependencies for targets in file. | 6029 ** \--runtime-deps-list-file**: Save runtime dependencies for targets in file. |
| 6030 ** \--script-executable**: Set the executable used to execute scripts. |
5969 ** \--threads**: Specify number of worker threads. | 6031 ** \--threads**: Specify number of worker threads. |
5970 ** \--time**: Outputs a summary of how long everything took. | 6032 ** \--time**: Outputs a summary of how long everything took. |
5971 ** \--tracelog**: Writes a Chrome-compatible trace log to the given file. | 6033 ** \--tracelog**: Writes a Chrome-compatible trace log to the given file. |
5972 ** -v**: Verbose logging. | 6034 ** -v**: Verbose logging. |
5973 ** \--version**: Prints the GN version number and exits. | 6035 ** \--version**: Prints the GN version number and exits. |
5974 | 6036 |
5975 ``` | 6037 ``` |
OLD | NEW |