| 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/args.h" | 5 #include "tools/gn/args.h" |
| 6 | 6 |
| 7 #include "base/sys_info.h" | 7 #include "base/sys_info.h" |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "tools/gn/string_utils.h" | 9 #include "tools/gn/string_utils.h" |
| 10 #include "tools/gn/variables.h" | 10 #include "tools/gn/variables.h" |
| 11 | 11 |
| 12 const char kBuildArgs_Help[] = | 12 const char kBuildArgs_Help[] = |
| 13 R"(Build Arguments Overview | 13 R"(Build Arguments Overview |
| 14 | 14 |
| 15 Build arguments are variables passed in from outside of the build that build | 15 Build arguments are variables passed in from outside of the build that build |
| 16 files can query to determine how the build works. | 16 files can query to determine how the build works. |
| 17 | 17 |
| 18 How build arguments are set | 18 How build arguments are set |
| 19 | 19 |
| 20 First, system default arguments are set based on the current system. The | 20 First, system default arguments are set based on the current system. The |
| 21 built-in arguments are: | 21 built-in arguments are: |
| 22 - host_cpu | 22 - host_cpu |
| 23 - host_os | 23 - host_os |
| 24 - current_cpu | 24 - current_cpu |
| 25 - current_os | 25 - current_os |
| 26 - target_cpu | 26 - target_cpu |
| 27 - target_os | 27 - target_os |
| 28 | 28 |
| 29 Next, project-specific overrides are applied. These are specified inside |
| 30 the default_args variable of //.gn. See "gn help dotfile" for more. |
| 31 |
| 29 If specified, arguments from the --args command line flag are used. If that | 32 If specified, arguments from the --args command line flag are used. If that |
| 30 flag is not specified, args from previous builds in the build directory will | 33 flag is not specified, args from previous builds in the build directory will |
| 31 be used (this is in the file args.gn in the build directory). | 34 be used (this is in the file args.gn in the build directory). |
| 32 | 35 |
| 33 Last, for targets being compiled with a non-default toolchain, the toolchain | 36 Last, for targets being compiled with a non-default toolchain, the toolchain |
| 34 overrides are applied. These are specified in the toolchain_args section of a | 37 overrides are applied. These are specified in the toolchain_args section of a |
| 35 toolchain definition. The use-case for this is that a toolchain may be | 38 toolchain definition. The use-case for this is that a toolchain may be |
| 36 building code for a different platform, and that it may want to always | 39 building code for a different platform, and that it may want to always |
| 37 specify Posix, for example. See "gn help toolchain" for more. | 40 specify Posix, for example. See "gn help toolchain" for more. |
| 38 | 41 |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 Scope* scope) const { | 374 Scope* scope) const { |
| 372 lock_.AssertAcquired(); | 375 lock_.AssertAcquired(); |
| 373 return declared_arguments_per_toolchain_[scope->settings()]; | 376 return declared_arguments_per_toolchain_[scope->settings()]; |
| 374 } | 377 } |
| 375 | 378 |
| 376 Scope::KeyValueMap& Args::OverridesForToolchainLocked( | 379 Scope::KeyValueMap& Args::OverridesForToolchainLocked( |
| 377 Scope* scope) const { | 380 Scope* scope) const { |
| 378 lock_.AssertAcquired(); | 381 lock_.AssertAcquired(); |
| 379 return toolchain_overrides_[scope->settings()]; | 382 return toolchain_overrides_[scope->settings()]; |
| 380 } | 383 } |
| OLD | NEW |