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_CONFIG_VALUES_H_ | 5 #ifndef TOOLS_GN_CONFIG_VALUES_H_ |
6 #define TOOLS_GN_CONFIG_VALUES_H_ | 6 #define TOOLS_GN_CONFIG_VALUES_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "tools/gn/source_dir.h" | 12 #include "tools/gn/source_dir.h" |
13 #include "tools/gn/source_file.h" | 13 #include "tools/gn/source_file.h" |
14 | 14 |
15 // Holds the values (include_dirs, defines, compiler flags, etc.) for a given | 15 // Holds the values (include_dirs, defines, compiler flags, etc.) for a given |
16 // config or target. | 16 // config or target. |
17 class ConfigValues { | 17 class ConfigValues { |
18 public: | 18 public: |
19 ConfigValues(); | 19 ConfigValues(); |
20 ~ConfigValues(); | 20 ~ConfigValues(); |
21 | 21 |
| 22 // Appends the values from the given config to this one. |
| 23 void AppendValues(const ConfigValues& append); |
| 24 |
22 #define STRING_VALUES_ACCESSOR(name) \ | 25 #define STRING_VALUES_ACCESSOR(name) \ |
23 const std::vector<std::string>& name() const { return name##_; } \ | 26 const std::vector<std::string>& name() const { return name##_; } \ |
24 std::vector<std::string>& name() { return name##_; } | 27 std::vector<std::string>& name() { return name##_; } |
25 #define DIR_VALUES_ACCESSOR(name) \ | 28 #define DIR_VALUES_ACCESSOR(name) \ |
26 const std::vector<SourceDir>& name() const { return name##_; } \ | 29 const std::vector<SourceDir>& name() const { return name##_; } \ |
27 std::vector<SourceDir>& name() { return name##_; } | 30 std::vector<SourceDir>& name() { return name##_; } |
28 | 31 |
29 STRING_VALUES_ACCESSOR(cflags) | 32 STRING_VALUES_ACCESSOR(cflags) |
30 STRING_VALUES_ACCESSOR(cflags_c) | 33 STRING_VALUES_ACCESSOR(cflags_c) |
31 STRING_VALUES_ACCESSOR(cflags_cc) | 34 STRING_VALUES_ACCESSOR(cflags_cc) |
32 STRING_VALUES_ACCESSOR(cflags_objc) | 35 STRING_VALUES_ACCESSOR(cflags_objc) |
33 STRING_VALUES_ACCESSOR(cflags_objcc) | 36 STRING_VALUES_ACCESSOR(cflags_objcc) |
34 STRING_VALUES_ACCESSOR(defines) | 37 STRING_VALUES_ACCESSOR(defines) |
35 DIR_VALUES_ACCESSOR (include_dirs) | 38 DIR_VALUES_ACCESSOR (include_dirs) |
36 STRING_VALUES_ACCESSOR(ldflags) | 39 STRING_VALUES_ACCESSOR(ldflags) |
37 DIR_VALUES_ACCESSOR (lib_dirs) | 40 DIR_VALUES_ACCESSOR (lib_dirs) |
38 STRING_VALUES_ACCESSOR(libs) | 41 STRING_VALUES_ACCESSOR(libs) |
| 42 // If you add a new one, be sure to update AppendValues(). |
39 | 43 |
40 #undef STRING_VALUES_ACCESSOR | 44 #undef STRING_VALUES_ACCESSOR |
41 #undef DIR_VALUES_ACCESSOR | 45 #undef DIR_VALUES_ACCESSOR |
42 | 46 |
43 bool has_precompiled_headers() const { | 47 bool has_precompiled_headers() const { |
44 return !precompiled_header_.empty() || !precompiled_source_.is_null(); | 48 return !precompiled_header_.empty() || !precompiled_source_.is_null(); |
45 } | 49 } |
46 const std::string& precompiled_header() const { | 50 const std::string& precompiled_header() const { |
47 return precompiled_header_; | 51 return precompiled_header_; |
48 } | 52 } |
(...skipping 11 matching lines...) Expand all Loading... |
60 std::vector<std::string> cflags_; | 64 std::vector<std::string> cflags_; |
61 std::vector<std::string> cflags_c_; | 65 std::vector<std::string> cflags_c_; |
62 std::vector<std::string> cflags_cc_; | 66 std::vector<std::string> cflags_cc_; |
63 std::vector<std::string> cflags_objc_; | 67 std::vector<std::string> cflags_objc_; |
64 std::vector<std::string> cflags_objcc_; | 68 std::vector<std::string> cflags_objcc_; |
65 std::vector<std::string> defines_; | 69 std::vector<std::string> defines_; |
66 std::vector<SourceDir> include_dirs_; | 70 std::vector<SourceDir> include_dirs_; |
67 std::vector<std::string> ldflags_; | 71 std::vector<std::string> ldflags_; |
68 std::vector<SourceDir> lib_dirs_; | 72 std::vector<SourceDir> lib_dirs_; |
69 std::vector<std::string> libs_; | 73 std::vector<std::string> libs_; |
| 74 // If you add a new one, be sure to update AppendValues(). |
70 | 75 |
71 std::string precompiled_header_; | 76 std::string precompiled_header_; |
72 SourceFile precompiled_source_; | 77 SourceFile precompiled_source_; |
73 | |
74 DISALLOW_COPY_AND_ASSIGN(ConfigValues); | |
75 }; | 78 }; |
76 | 79 |
77 #endif // TOOLS_GN_CONFIG_VALUES_H_ | 80 #endif // TOOLS_GN_CONFIG_VALUES_H_ |
OLD | NEW |