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/build_settings.h" | 5 #include "tools/gn/build_settings.h" |
6 #include "tools/gn/functions.h" | 6 #include "tools/gn/functions.h" |
7 #include "tools/gn/loader.h" | 7 #include "tools/gn/loader.h" |
8 #include "tools/gn/parse_tree.h" | 8 #include "tools/gn/parse_tree.h" |
9 #include "tools/gn/scope.h" | 9 #include "tools/gn/scope.h" |
10 #include "tools/gn/settings.h" | 10 #include "tools/gn/settings.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 config file for the 64-bit toolchain to reset the default toolchain to | 34 config file for the 64-bit toolchain to reset the default toolchain to |
35 64-bit, we want to keep it 32-bits. | 35 64-bit, we want to keep it 32-bits. |
36 | 36 |
37 Argument | 37 Argument |
38 | 38 |
39 toolchain_label | 39 toolchain_label |
40 Toolchain name. | 40 Toolchain name. |
41 | 41 |
42 Example | 42 Example |
43 | 43 |
44 set_default_toolchain("//build/config/win:vs32"))"; | 44 # Set default toolchain only has an effect when run in the context of the |
| 45 # default toolchain. Pick the right one according to the current CPU |
| 46 # architecture. |
| 47 if (target_cpu == "x64") { |
| 48 set_default_toolchain("//toolchains:64") |
| 49 } else if (target_cpu == "x86") { |
| 50 set_default_toolchain("//toolchains:32") |
| 51 } |
| 52 )"; |
45 | 53 |
46 Value RunSetDefaultToolchain(Scope* scope, | 54 Value RunSetDefaultToolchain(Scope* scope, |
47 const FunctionCallNode* function, | 55 const FunctionCallNode* function, |
48 const std::vector<Value>& args, | 56 const std::vector<Value>& args, |
49 Err* err) { | 57 Err* err) { |
50 if (!scope->IsProcessingBuildConfig()) { | 58 if (!scope->IsProcessingBuildConfig()) { |
51 *err = Err(function->function(), "Must be called from build config.", | 59 *err = Err(function->function(), "Must be called from build config.", |
52 "set_default_toolchain can only be called from the build configuration " | 60 "set_default_toolchain can only be called from the build configuration " |
53 "file."); | 61 "file."); |
54 return Value(); | 62 return Value(); |
(...skipping 14 matching lines...) Expand all Loading... |
69 Label toolchain_label( | 77 Label toolchain_label( |
70 Label::Resolve(current_dir, default_toolchain, args[0], err)); | 78 Label::Resolve(current_dir, default_toolchain, args[0], err)); |
71 if (toolchain_label.is_null()) | 79 if (toolchain_label.is_null()) |
72 return Value(); | 80 return Value(); |
73 | 81 |
74 *default_toolchain_dest = toolchain_label; | 82 *default_toolchain_dest = toolchain_label; |
75 return Value(); | 83 return Value(); |
76 } | 84 } |
77 | 85 |
78 } // namespace functions | 86 } // namespace functions |
OLD | NEW |