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/variables.h" | 9 #include "tools/gn/variables.h" |
10 | 10 |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 #elif defined(OS_ANDROID) | 238 #elif defined(OS_ANDROID) |
239 os = "android"; | 239 os = "android"; |
240 #else | 240 #else |
241 #error Unknown OS type. | 241 #error Unknown OS type. |
242 #endif | 242 #endif |
243 | 243 |
244 // Host architecture. | 244 // Host architecture. |
245 static const char kX86[] = "x86"; | 245 static const char kX86[] = "x86"; |
246 static const char kX64[] = "x64"; | 246 static const char kX64[] = "x64"; |
247 static const char kArm[] = "arm"; | 247 static const char kArm[] = "arm"; |
| 248 static const char kMips[] = "mipsel"; |
248 const char* arch = nullptr; | 249 const char* arch = nullptr; |
249 | 250 |
250 // Set the host CPU architecture based on the underlying OS, not | 251 // Set the host CPU architecture based on the underlying OS, not |
251 // whatever the current bit-tedness of the GN binary is. | 252 // whatever the current bit-tedness of the GN binary is. |
252 std::string os_arch = base::SysInfo::OperatingSystemArchitecture(); | 253 std::string os_arch = base::SysInfo::OperatingSystemArchitecture(); |
253 if (os_arch == "x86") | 254 if (os_arch == "x86") |
254 arch = kX86; | 255 arch = kX86; |
255 else if (os_arch == "x86_64") | 256 else if (os_arch == "x86_64") |
256 arch = kX64; | 257 arch = kX64; |
257 else if (os_arch.substr(3) == "arm") | 258 else if (os_arch.substr(3) == "arm") |
258 arch = kArm; | 259 arch = kArm; |
| 260 else if (os_arch == "mips") |
| 261 arch = kMips; |
259 else | 262 else |
260 CHECK(false) << "OS architecture not handled."; | 263 CHECK(false) << "OS architecture not handled."; |
261 | 264 |
262 // Save the OS and architecture as build arguments that are implicitly | 265 // Save the OS and architecture as build arguments that are implicitly |
263 // declared. This is so they can be overridden in a toolchain build args | 266 // declared. This is so they can be overridden in a toolchain build args |
264 // override, and so that they will appear in the "gn args" output. | 267 // override, and so that they will appear in the "gn args" output. |
265 Value empty_string(nullptr, std::string()); | 268 Value empty_string(nullptr, std::string()); |
266 | 269 |
267 Value os_val(nullptr, std::string(os)); | 270 Value os_val(nullptr, std::string(os)); |
268 dest->SetValue(variables::kHostOs, os_val, nullptr); | 271 dest->SetValue(variables::kHostOs, os_val, nullptr); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 lock_.AssertAcquired(); | 307 lock_.AssertAcquired(); |
305 for (const auto& val : values) | 308 for (const auto& val : values) |
306 all_overrides_[val.first] = val.second; | 309 all_overrides_[val.first] = val.second; |
307 } | 310 } |
308 | 311 |
309 Scope::KeyValueMap& Args::DeclaredArgumentsForToolchainLocked( | 312 Scope::KeyValueMap& Args::DeclaredArgumentsForToolchainLocked( |
310 Scope* scope) const { | 313 Scope* scope) const { |
311 lock_.AssertAcquired(); | 314 lock_.AssertAcquired(); |
312 return declared_arguments_per_toolchain_[scope->settings()]; | 315 return declared_arguments_per_toolchain_[scope->settings()]; |
313 } | 316 } |
OLD | NEW |