OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "tools/gn/variables.h" | 5 #include "tools/gn/variables.h" |
6 | 6 |
7 namespace variables { | 7 namespace variables { |
8 | 8 |
9 // Built-in variables ---------------------------------------------------------- | 9 // Built-in variables ---------------------------------------------------------- |
10 | 10 |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 " This addition happens in a second phase once a target and all of its\n" | 255 " This addition happens in a second phase once a target and all of its\n" |
256 " dependencies have been resolved. Therefore, a target will not see\n" | 256 " dependencies have been resolved. Therefore, a target will not see\n" |
257 " these force-added configs in their \"configs\" variable while the\n" | 257 " these force-added configs in their \"configs\" variable while the\n" |
258 " script is running, and then can not be removed. As a result, this\n" | 258 " script is running, and then can not be removed. As a result, this\n" |
259 " capability should generally only be used to add defines and include\n" | 259 " capability should generally only be used to add defines and include\n" |
260 " directories necessary to compile a target's headers.\n" | 260 " directories necessary to compile a target's headers.\n" |
261 "\n" | 261 "\n" |
262 " See also \"direct_dependent_configs\".\n" | 262 " See also \"direct_dependent_configs\".\n" |
263 COMMON_ORDERING_HELP; | 263 COMMON_ORDERING_HELP; |
264 | 264 |
| 265 const char kAllowCircularIncludesFrom[] = "allow_circular_includes_from"; |
| 266 const char kAllowCircularIncludesFrom_HelpShort[] = |
| 267 "allow_circular_includes_from: [label list] Permit includes from deps."; |
| 268 const char kAllowCircularIncludesFrom_Help[] = |
| 269 "allow_circular_includes_from: Permit includes from deps.\n" |
| 270 "\n" |
| 271 " A list of target labels. Must be a subset of the target's \"deps\".\n" |
| 272 " These targets will be permitted to include headers from the current\n" |
| 273 " target despite the dependency going in the opposite direction.\n" |
| 274 "\n" |
| 275 "Tedious exposition\n" |
| 276 "\n" |
| 277 " Normally, for a file in target A to include a file from target B,\n" |
| 278 " A must list B as a dependency. This invariant is enforced by the\n" |
| 279 " \"gn check\" command (and the --check flag to \"gn gen\").\n" |
| 280 "\n" |
| 281 " Sometimes, two targets might be the same unit for linking purposes\n" |
| 282 " (two source sets or static libraries that would always be linked\n" |
| 283 " together in a final executable or shared library). In this case,\n" |
| 284 " you want A to be able to include B's headers, and B to include A's\n" |
| 285 " headers.\n" |
| 286 "\n" |
| 287 " This list, if specified, lists which of the dependencies of the\n" |
| 288 " current target can include header files from the current target.\n" |
| 289 " That is, if A depends on B, B can only include headers from A if it is\n" |
| 290 " in A's allow_circular_includes_from list.\n" |
| 291 "\n" |
| 292 "Example\n" |
| 293 "\n" |
| 294 " source_set(\"a\") {\n" |
| 295 " deps = [ \":b\", \":c\" ]\n" |
| 296 " allow_circular_includes_from = [ \":b\" ]\n" |
| 297 " ...\n" |
| 298 " }\n"; |
| 299 |
265 const char kArgs[] = "args"; | 300 const char kArgs[] = "args"; |
266 const char kArgs_HelpShort[] = | 301 const char kArgs_HelpShort[] = |
267 "args: [string list] Arguments passed to an action."; | 302 "args: [string list] Arguments passed to an action."; |
268 const char kArgs_Help[] = | 303 const char kArgs_Help[] = |
269 "args: Arguments passed to an action.\n" | 304 "args: Arguments passed to an action.\n" |
270 "\n" | 305 "\n" |
271 " For action and action_foreach targets, args is the list of arguments\n" | 306 " For action and action_foreach targets, args is the list of arguments\n" |
272 " to pass to the script. Typically you would use source expansion (see\n" | 307 " to pass to the script. Typically you would use source expansion (see\n" |
273 " \"gn help source_expansion\") to insert the source file names.\n" | 308 " \"gn help source_expansion\") to insert the source file names.\n" |
274 "\n" | 309 "\n" |
(...skipping 29 matching lines...) Expand all Loading... |
304 const char kCflagsObjC[] = "cflags_objc"; | 339 const char kCflagsObjC[] = "cflags_objc"; |
305 const char kCflagsObjC_HelpShort[] = | 340 const char kCflagsObjC_HelpShort[] = |
306 "cflags_objc: [string list] Flags passed to the Objective C compiler."; | 341 "cflags_objc: [string list] Flags passed to the Objective C compiler."; |
307 const char* kCflagsObjC_Help = kCommonCflagsHelp; | 342 const char* kCflagsObjC_Help = kCommonCflagsHelp; |
308 | 343 |
309 const char kCflagsObjCC[] = "cflags_objcc"; | 344 const char kCflagsObjCC[] = "cflags_objcc"; |
310 const char kCflagsObjCC_HelpShort[] = | 345 const char kCflagsObjCC_HelpShort[] = |
311 "cflags_objcc: [string list] Flags passed to the Objective C++ compiler."; | 346 "cflags_objcc: [string list] Flags passed to the Objective C++ compiler."; |
312 const char* kCflagsObjCC_Help = kCommonCflagsHelp; | 347 const char* kCflagsObjCC_Help = kCommonCflagsHelp; |
313 | 348 |
| 349 const char kCheckIncludes[] = "check_includes"; |
| 350 const char kCheckIncludes_HelpShort[] = |
| 351 "check_includes: [boolean] Controls whether a target's files are checked."; |
| 352 const char kCheckIncludes_Help[] = |
| 353 "check_includes: [boolean] Controls whether a target's files are checked.\n" |
| 354 "\n" |
| 355 " When true (the default), the \"gn check\" command (as well as\n" |
| 356 " \"gn gen\" with the --check flag) will check this target's sources\n" |
| 357 " and headers for proper dependencies.\n" |
| 358 "\n" |
| 359 " When false, the files in this target will be skipped by default.\n" |
| 360 " This does not affect other targets that depend on the current target,\n" |
| 361 " it just skips checking the includes of the current target's files.\n" |
| 362 "\n" |
| 363 "Example\n" |
| 364 "\n" |
| 365 " source_set(\"busted_includes\") {\n" |
| 366 " # This target's includes are messed up, exclude it from checking.\n" |
| 367 " check_includes = false\n" |
| 368 " ...\n" |
| 369 " }\n"; |
| 370 |
314 const char kConfigs[] = "configs"; | 371 const char kConfigs[] = "configs"; |
315 const char kConfigs_HelpShort[] = | 372 const char kConfigs_HelpShort[] = |
316 "configs: [label list] Configs applying to this target."; | 373 "configs: [label list] Configs applying to this target."; |
317 const char kConfigs_Help[] = | 374 const char kConfigs_Help[] = |
318 "configs: Configs applying to this target.\n" | 375 "configs: Configs applying to this target.\n" |
319 "\n" | 376 "\n" |
320 " A list of config labels.\n" | 377 " A list of config labels.\n" |
321 "\n" | 378 "\n" |
322 " The include_dirs, defines, etc. in each config are appended in the\n" | 379 " The include_dirs, defines, etc. in each config are appended in the\n" |
323 " order they appear to the compile command for each file in the target.\n" | 380 " order they appear to the compile command for each file in the target.\n" |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
824 INSERT_VARIABLE(TargetGenDir) | 881 INSERT_VARIABLE(TargetGenDir) |
825 INSERT_VARIABLE(TargetOutDir) | 882 INSERT_VARIABLE(TargetOutDir) |
826 } | 883 } |
827 return info_map; | 884 return info_map; |
828 } | 885 } |
829 | 886 |
830 const VariableInfoMap& GetTargetVariables() { | 887 const VariableInfoMap& GetTargetVariables() { |
831 static VariableInfoMap info_map; | 888 static VariableInfoMap info_map; |
832 if (info_map.empty()) { | 889 if (info_map.empty()) { |
833 INSERT_VARIABLE(AllDependentConfigs) | 890 INSERT_VARIABLE(AllDependentConfigs) |
| 891 INSERT_VARIABLE(AllowCircularIncludesFrom) |
834 INSERT_VARIABLE(Args) | 892 INSERT_VARIABLE(Args) |
835 INSERT_VARIABLE(Cflags) | 893 INSERT_VARIABLE(Cflags) |
836 INSERT_VARIABLE(CflagsC) | 894 INSERT_VARIABLE(CflagsC) |
837 INSERT_VARIABLE(CflagsCC) | 895 INSERT_VARIABLE(CflagsCC) |
838 INSERT_VARIABLE(CflagsObjC) | 896 INSERT_VARIABLE(CflagsObjC) |
839 INSERT_VARIABLE(CflagsObjCC) | 897 INSERT_VARIABLE(CflagsObjCC) |
| 898 INSERT_VARIABLE(CheckIncludes) |
840 INSERT_VARIABLE(Configs) | 899 INSERT_VARIABLE(Configs) |
841 INSERT_VARIABLE(Data) | 900 INSERT_VARIABLE(Data) |
842 INSERT_VARIABLE(Datadeps) | 901 INSERT_VARIABLE(Datadeps) |
843 INSERT_VARIABLE(Defines) | 902 INSERT_VARIABLE(Defines) |
844 INSERT_VARIABLE(Depfile) | 903 INSERT_VARIABLE(Depfile) |
845 INSERT_VARIABLE(Deps) | 904 INSERT_VARIABLE(Deps) |
846 INSERT_VARIABLE(DirectDependentConfigs) | 905 INSERT_VARIABLE(DirectDependentConfigs) |
847 INSERT_VARIABLE(ForwardDependentConfigsFrom) | 906 INSERT_VARIABLE(ForwardDependentConfigsFrom) |
848 INSERT_VARIABLE(IncludeDirs) | 907 INSERT_VARIABLE(IncludeDirs) |
849 INSERT_VARIABLE(Inputs) | 908 INSERT_VARIABLE(Inputs) |
850 INSERT_VARIABLE(Ldflags) | 909 INSERT_VARIABLE(Ldflags) |
851 INSERT_VARIABLE(Libs) | 910 INSERT_VARIABLE(Libs) |
852 INSERT_VARIABLE(LibDirs) | 911 INSERT_VARIABLE(LibDirs) |
853 INSERT_VARIABLE(OutputExtension) | 912 INSERT_VARIABLE(OutputExtension) |
854 INSERT_VARIABLE(OutputName) | 913 INSERT_VARIABLE(OutputName) |
855 INSERT_VARIABLE(Outputs) | 914 INSERT_VARIABLE(Outputs) |
856 INSERT_VARIABLE(Public) | 915 INSERT_VARIABLE(Public) |
857 INSERT_VARIABLE(Script) | 916 INSERT_VARIABLE(Script) |
858 INSERT_VARIABLE(Sources) | 917 INSERT_VARIABLE(Sources) |
859 INSERT_VARIABLE(Visibility) | 918 INSERT_VARIABLE(Visibility) |
860 } | 919 } |
861 return info_map; | 920 return info_map; |
862 } | 921 } |
863 | 922 |
864 #undef INSERT_VARIABLE | 923 #undef INSERT_VARIABLE |
865 | 924 |
866 } // namespace variables | 925 } // namespace variables |
OLD | NEW |