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

Unified Diff: tools/gn/toolchain.h

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/tokenizer_unittest.cc ('k') | tools/gn/toolchain.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/toolchain.h
diff --git a/tools/gn/toolchain.h b/tools/gn/toolchain.h
new file mode 100644
index 0000000000000000000000000000000000000000..22b8151bb001b33de192da57daa7629a10dcf7b9
--- /dev/null
+++ b/tools/gn/toolchain.h
@@ -0,0 +1,94 @@
+// 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.
+
+#ifndef TOOLS_GN_TOOLCHAIN_H_
+#define TOOLS_GN_TOOLCHAIN_H_
+
+#include "base/compiler_specific.h"
+#include "base/strings/string_piece.h"
+#include "tools/gn/item.h"
+
+// Holds information on a specific toolchain. This data is filled in when we
+// encounter a toolchain definition.
+//
+// This class is an Item so it can participate in dependency management. In
+// particular, when a target uses a toolchain, it should have a dependency on
+// that toolchain's object so that we can be sure we loaded the toolchain
+// before generating the build for that target.
+//
+// Note on threadsafety: The label of the toolchain never changes so can
+// safetly be accessed from any thread at any time (we do this when asking for
+// the toolchain name). But the values in the toolchain do, so these can't
+// be accessed until this Item is resolved.
+class Toolchain : public Item {
+ public:
+ enum ToolType {
+ TYPE_NONE = 0,
+ TYPE_CC,
+ TYPE_CXX,
+ TYPE_ASM,
+ TYPE_ALINK,
+ TYPE_SOLINK,
+ TYPE_SOLINK_MODULE,
+ TYPE_LINK,
+ TYPE_STAMP,
+ TYPE_COPY,
+
+ TYPE_NUMTYPES // Must be last.
+ };
+
+ static const char* kToolCc;
+ static const char* kToolCxx;
+ static const char* kToolAsm;
+ static const char* kToolAlink;
+ static const char* kToolSolink;
+ static const char* kToolSolinkModule;
+ static const char* kToolLink;
+ static const char* kToolStamp;
+ static const char* kToolCopy;
+
+ struct Tool {
+ Tool();
+ ~Tool();
+
+ bool empty() const {
+ return command.empty() && depfile.empty() && deps.empty() &&
+ description.empty() && pool.empty() && restat.empty() &&
+ rspfile.empty() && rspfile_content.empty();
+ }
+
+ std::string command;
+ std::string depfile;
+ std::string deps;
+ std::string description;
+ std::string pool;
+ std::string restat;
+ std::string rspfile;
+ std::string rspfile_content;
+ };
+
+ Toolchain(const Label& label);
+ virtual ~Toolchain();
+
+ // Item overrides.
+ virtual Toolchain* AsToolchain() OVERRIDE;
+ virtual const Toolchain* AsToolchain() const OVERRIDE;
+
+ // Returns TYPE_NONE on failure.
+ static ToolType ToolNameToType(const base::StringPiece& str);
+ static std::string ToolTypeToName(ToolType type);
+
+ const Tool& GetTool(ToolType type) const;
+ void SetTool(ToolType type, const Tool& t);
+
+ const std::string& environment() const { return environment_; }
+ void set_environment(const std::string& env) { environment_ = env; }
+
+ private:
+ Tool tools_[TYPE_NUMTYPES];
+
+ std::string environment_;
+};
+
+#endif // TOOLS_GN_TOOLCHAIN_H_
« no previous file with comments | « tools/gn/tokenizer_unittest.cc ('k') | tools/gn/toolchain.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698