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 #ifndef TOOLS_GN_TARGET_H_ | 5 #ifndef TOOLS_GN_TARGET_H_ |
6 #define TOOLS_GN_TARGET_H_ | 6 #define TOOLS_GN_TARGET_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 static const char* GetStringForOutputType(OutputType type); | 51 static const char* GetStringForOutputType(OutputType type); |
52 | 52 |
53 // Item overrides. | 53 // Item overrides. |
54 virtual Target* AsTarget() OVERRIDE; | 54 virtual Target* AsTarget() OVERRIDE; |
55 virtual const Target* AsTarget() const OVERRIDE; | 55 virtual const Target* AsTarget() const OVERRIDE; |
56 virtual bool OnResolved(Err* err) OVERRIDE; | 56 virtual bool OnResolved(Err* err) OVERRIDE; |
57 | 57 |
58 OutputType output_type() const { return output_type_; } | 58 OutputType output_type() const { return output_type_; } |
59 void set_output_type(OutputType t) { output_type_ = t; } | 59 void set_output_type(OutputType t) { output_type_ = t; } |
60 | 60 |
| 61 // Can be linked into other targets. |
61 bool IsLinkable() const; | 62 bool IsLinkable() const; |
62 | 63 |
| 64 // Can have dependencies linked in. |
| 65 bool IsFinal() const; |
| 66 |
63 // Will be the empty string to use the target label as the output name. | 67 // Will be the empty string to use the target label as the output name. |
64 // See GetComputedOutputName(). | 68 // See GetComputedOutputName(). |
65 const std::string& output_name() const { return output_name_; } | 69 const std::string& output_name() const { return output_name_; } |
66 void set_output_name(const std::string& name) { output_name_ = name; } | 70 void set_output_name(const std::string& name) { output_name_ = name; } |
67 | 71 |
68 // Returns the output name for this target, which is the output_name if | 72 // Returns the output name for this target, which is the output_name if |
69 // specified, or the target label if not. If the flag is set, it will also | 73 // specified, or the target label if not. If the flag is set, it will also |
70 // include any output prefix specified on the tool (often "lib" on Linux). | 74 // include any output prefix specified on the tool (often "lib" on Linux). |
71 // | 75 // |
72 // Because this depends on the tool for this target, the toolchain must | 76 // Because this depends on the tool for this target, the toolchain must |
(...skipping 15 matching lines...) Expand all Loading... |
88 | 92 |
89 // When all_headers_public is false, this is the list of public headers. It | 93 // When all_headers_public is false, this is the list of public headers. It |
90 // could be empty which would mean no headers are public. | 94 // could be empty which would mean no headers are public. |
91 const FileList& public_headers() const { return public_headers_; } | 95 const FileList& public_headers() const { return public_headers_; } |
92 FileList& public_headers() { return public_headers_; } | 96 FileList& public_headers() { return public_headers_; } |
93 | 97 |
94 // Whether this target's includes should be checked by "gn check". | 98 // Whether this target's includes should be checked by "gn check". |
95 bool check_includes() const { return check_includes_; } | 99 bool check_includes() const { return check_includes_; } |
96 void set_check_includes(bool ci) { check_includes_ = ci; } | 100 void set_check_includes(bool ci) { check_includes_ = ci; } |
97 | 101 |
| 102 // Whether this static_library target should have code linked in. |
| 103 bool complete_static_lib() const { return complete_static_lib_; } |
| 104 void set_complete_static_lib(bool complete) { |
| 105 DCHECK_EQ(STATIC_LIBRARY, output_type_); |
| 106 complete_static_lib_ = complete; |
| 107 } |
| 108 |
98 bool testonly() const { return testonly_; } | 109 bool testonly() const { return testonly_; } |
99 void set_testonly(bool value) { testonly_ = value; } | 110 void set_testonly(bool value) { testonly_ = value; } |
100 | 111 |
101 // Compile-time extra dependencies. | 112 // Compile-time extra dependencies. |
102 const FileList& inputs() const { return inputs_; } | 113 const FileList& inputs() const { return inputs_; } |
103 FileList& inputs() { return inputs_; } | 114 FileList& inputs() { return inputs_; } |
104 | 115 |
105 // Runtime dependencies. | 116 // Runtime dependencies. |
106 const FileList& data() const { return data_; } | 117 const FileList& data() const { return data_; } |
107 FileList& data() { return data_; } | 118 FileList& data() { return data_; } |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 bool CheckTestonly(Err* err) const; | 243 bool CheckTestonly(Err* err) const; |
233 | 244 |
234 OutputType output_type_; | 245 OutputType output_type_; |
235 std::string output_name_; | 246 std::string output_name_; |
236 std::string output_extension_; | 247 std::string output_extension_; |
237 | 248 |
238 FileList sources_; | 249 FileList sources_; |
239 bool all_headers_public_; | 250 bool all_headers_public_; |
240 FileList public_headers_; | 251 FileList public_headers_; |
241 bool check_includes_; | 252 bool check_includes_; |
| 253 bool complete_static_lib_; |
242 bool testonly_; | 254 bool testonly_; |
243 FileList inputs_; | 255 FileList inputs_; |
244 FileList data_; | 256 FileList data_; |
245 | 257 |
246 bool hard_dep_; | 258 bool hard_dep_; |
247 | 259 |
248 // Note that if there are any groups in the deps, once the target is resolved | 260 // Note that if there are any groups in the deps, once the target is resolved |
249 // these vectors will list *both* the groups as well as the groups' deps. | 261 // these vectors will list *both* the groups as well as the groups' deps. |
250 // | 262 // |
251 // This is because, in general, groups should be "transparent" ways to add | 263 // This is because, in general, groups should be "transparent" ways to add |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 }; | 319 }; |
308 #elif defined(COMPILER_MSVC) | 320 #elif defined(COMPILER_MSVC) |
309 inline size_t hash_value(const Target* t) { | 321 inline size_t hash_value(const Target* t) { |
310 return reinterpret_cast<size_t>(t); | 322 return reinterpret_cast<size_t>(t); |
311 } | 323 } |
312 #endif // COMPILER... | 324 #endif // COMPILER... |
313 | 325 |
314 } // namespace BASE_HASH_NAMESPACE | 326 } // namespace BASE_HASH_NAMESPACE |
315 | 327 |
316 #endif // TOOLS_GN_TARGET_H_ | 328 #endif // TOOLS_GN_TARGET_H_ |
OLD | NEW |