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

Unified 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, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gn/toolchain.h ('k') | tools/gn/toolchain_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/toolchain.cc
diff --git a/tools/gn/toolchain.cc b/tools/gn/toolchain.cc
new file mode 100644
index 0000000000000000000000000000000000000000..20b81f5506b9b4ab90d9a14dcfe39d5c5b1286c1
--- /dev/null
+++ b/tools/gn/toolchain.cc
@@ -0,0 +1,79 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "tools/gn/toolchain.h"
+
+#include "base/logging.h"
+
+const char* Toolchain::kToolCc = "cc";
+const char* Toolchain::kToolCxx = "cxx";
+const char* Toolchain::kToolAsm = "asm";
+const char* Toolchain::kToolAlink = "alink";
+const char* Toolchain::kToolSolink = "solink";
+const char* Toolchain::kToolSolinkModule = "solink_module";
+const char* Toolchain::kToolLink = "link";
+const char* Toolchain::kToolStamp = "stamp";
+const char* Toolchain::kToolCopy = "copy";
+
+Toolchain::Tool::Tool() {
+}
+
+Toolchain::Tool::~Tool() {
+}
+
+Toolchain::Toolchain(const Label& label) : Item(label) {
+}
+
+Toolchain::~Toolchain() {
+}
+
+Toolchain* Toolchain::AsToolchain() {
+ return this;
+}
+
+const Toolchain* Toolchain::AsToolchain() const {
+ return this;
+}
+
+// static
+Toolchain::ToolType Toolchain::ToolNameToType(const base::StringPiece& str) {
+ if (str == kToolCc) return TYPE_CC;
+ if (str == kToolCxx) return TYPE_CXX;
+ if (str == kToolAsm) return TYPE_ASM;
+ if (str == kToolAlink) return TYPE_ALINK;
+ if (str == kToolSolink) return TYPE_SOLINK;
+ if (str == kToolSolinkModule) return TYPE_SOLINK_MODULE;
+ if (str == kToolLink) return TYPE_LINK;
+ if (str == kToolStamp) return TYPE_STAMP;
+ if (str == kToolCopy) return TYPE_COPY;
+ return TYPE_NONE;
+}
+
+// static
+std::string Toolchain::ToolTypeToName(ToolType type) {
+ switch (type) {
+ case TYPE_CC: return kToolCc;
+ case TYPE_CXX: return kToolCxx;
+ case TYPE_ASM: return kToolAsm;
+ case TYPE_ALINK: return kToolAlink;
+ case TYPE_SOLINK: return kToolSolink;
+ case TYPE_SOLINK_MODULE: return kToolSolinkModule;
+ case TYPE_LINK: return kToolLink;
+ case TYPE_STAMP: return kToolStamp;
+ case TYPE_COPY: return kToolCopy;
+ default:
+ NOTREACHED();
+ return std::string();
+ }
+}
+
+const Toolchain::Tool& Toolchain::GetTool(ToolType type) const {
+ DCHECK(type != TYPE_NONE);
+ return tools_[static_cast<size_t>(type)];
+}
+
+void Toolchain::SetTool(ToolType type, const Tool& t) {
+ DCHECK(type != TYPE_NONE);
+ tools_[static_cast<size_t>(type)] = t;
+}
« 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