Remove the now unused TextButton code.
[chromium-blink-merge.git] / tools / gn / toolchain.h
blob45a14cc8086c7c9664b411284edb8b014c542259
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.
5 #ifndef TOOLS_GN_TOOLCHAIN_H_
6 #define TOOLS_GN_TOOLCHAIN_H_
8 #include "base/compiler_specific.h"
9 #include "base/strings/string_piece.h"
10 #include "tools/gn/item.h"
11 #include "tools/gn/label_ptr.h"
12 #include "tools/gn/scope.h"
13 #include "tools/gn/value.h"
15 // Holds information on a specific toolchain. This data is filled in when we
16 // encounter a toolchain definition.
18 // This class is an Item so it can participate in dependency management. In
19 // particular, when a target uses a toolchain, it should have a dependency on
20 // that toolchain's object so that we can be sure we loaded the toolchain
21 // before generating the build for that target.
23 // Note on threadsafety: The label of the toolchain never changes so can
24 // safetly be accessed from any thread at any time (we do this when asking for
25 // the toolchain name). But the values in the toolchain do, so these can't
26 // be accessed until this Item is resolved.
27 class Toolchain : public Item {
28 public:
29 enum ToolType {
30 TYPE_NONE = 0,
31 TYPE_CC,
32 TYPE_CXX,
33 TYPE_OBJC,
34 TYPE_OBJCXX,
35 TYPE_RC,
36 TYPE_ASM,
37 TYPE_ALINK,
38 TYPE_SOLINK,
39 TYPE_LINK,
40 TYPE_STAMP,
41 TYPE_COPY,
43 TYPE_NUMTYPES // Must be last.
46 static const char* kToolCc;
47 static const char* kToolCxx;
48 static const char* kToolObjC;
49 static const char* kToolObjCxx;
50 static const char* kToolRc;
51 static const char* kToolAsm;
52 static const char* kToolAlink;
53 static const char* kToolSolink;
54 static const char* kToolLink;
55 static const char* kToolStamp;
56 static const char* kToolCopy;
58 struct Tool {
59 Tool();
60 ~Tool();
62 std::string command;
63 std::string depfile;
64 std::string deps;
65 std::string description;
66 std::string lib_dir_prefix;
67 std::string lib_prefix;
68 std::string pool;
69 std::string restat;
70 std::string rspfile;
71 std::string rspfile_content;
74 Toolchain(const Settings* settings, const Label& label);
75 virtual ~Toolchain();
77 // Item overrides.
78 virtual Toolchain* AsToolchain() OVERRIDE;
79 virtual const Toolchain* AsToolchain() const OVERRIDE;
81 // Returns TYPE_NONE on failure.
82 static ToolType ToolNameToType(const base::StringPiece& str);
83 static std::string ToolTypeToName(ToolType type);
85 const Tool& GetTool(ToolType type) const;
86 void SetTool(ToolType type, const Tool& t);
88 // Targets that must be resolved before compiling any targets.
89 const LabelTargetVector& deps() const { return deps_; }
90 LabelTargetVector& deps() { return deps_; }
92 // Specifies build argument overrides that will be set on the base scope. It
93 // will be as if these arguments were passed in on the command line. This
94 // allows a toolchain to override the OS type of the default toolchain or
95 // pass in other settings.
96 Scope::KeyValueMap& args() { return args_; }
97 const Scope::KeyValueMap& args() const { return args_; }
99 private:
100 Tool tools_[TYPE_NUMTYPES];
102 LabelTargetVector deps_;
103 Scope::KeyValueMap args_;
106 #endif // TOOLS_GN_TOOLCHAIN_H_