Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: tools/gn/toolchain.cc

Issue 21114002: Add initial prototype for the GN meta-buildsystem. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add owners and readme Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/gn/toolchain.h ('k') | tools/gn/toolchain_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "tools/gn/toolchain.h"
6
7 #include "base/logging.h"
8
9 const char* Toolchain::kToolCc = "cc";
10 const char* Toolchain::kToolCxx = "cxx";
11 const char* Toolchain::kToolAsm = "asm";
12 const char* Toolchain::kToolAlink = "alink";
13 const char* Toolchain::kToolSolink = "solink";
14 const char* Toolchain::kToolSolinkModule = "solink_module";
15 const char* Toolchain::kToolLink = "link";
16 const char* Toolchain::kToolStamp = "stamp";
17 const char* Toolchain::kToolCopy = "copy";
18
19 Toolchain::Tool::Tool() {
20 }
21
22 Toolchain::Tool::~Tool() {
23 }
24
25 Toolchain::Toolchain(const Label& label) : Item(label) {
26 }
27
28 Toolchain::~Toolchain() {
29 }
30
31 Toolchain* Toolchain::AsToolchain() {
32 return this;
33 }
34
35 const Toolchain* Toolchain::AsToolchain() const {
36 return this;
37 }
38
39 // static
40 Toolchain::ToolType Toolchain::ToolNameToType(const base::StringPiece& str) {
41 if (str == kToolCc) return TYPE_CC;
42 if (str == kToolCxx) return TYPE_CXX;
43 if (str == kToolAsm) return TYPE_ASM;
44 if (str == kToolAlink) return TYPE_ALINK;
45 if (str == kToolSolink) return TYPE_SOLINK;
46 if (str == kToolSolinkModule) return TYPE_SOLINK_MODULE;
47 if (str == kToolLink) return TYPE_LINK;
48 if (str == kToolStamp) return TYPE_STAMP;
49 if (str == kToolCopy) return TYPE_COPY;
50 return TYPE_NONE;
51 }
52
53 // static
54 std::string Toolchain::ToolTypeToName(ToolType type) {
55 switch (type) {
56 case TYPE_CC: return kToolCc;
57 case TYPE_CXX: return kToolCxx;
58 case TYPE_ASM: return kToolAsm;
59 case TYPE_ALINK: return kToolAlink;
60 case TYPE_SOLINK: return kToolSolink;
61 case TYPE_SOLINK_MODULE: return kToolSolinkModule;
62 case TYPE_LINK: return kToolLink;
63 case TYPE_STAMP: return kToolStamp;
64 case TYPE_COPY: return kToolCopy;
65 default:
66 NOTREACHED();
67 return std::string();
68 }
69 }
70
71 const Toolchain::Tool& Toolchain::GetTool(ToolType type) const {
72 DCHECK(type != TYPE_NONE);
73 return tools_[static_cast<size_t>(type)];
74 }
75
76 void Toolchain::SetTool(ToolType type, const Tool& t) {
77 DCHECK(type != TYPE_NONE);
78 tools_[static_cast<size_t>(type)] = t;
79 }
OLDNEW
« no previous file with comments | « tools/gn/toolchain.h ('k') | tools/gn/toolchain_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698