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

Side by Side Diff: tools/gn/config_values.h

Issue 1342183003: Allow GN configs to have sub-configs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 unified diff | Download patch
« no previous file with comments | « tools/gn/config_unittest.cc ('k') | tools/gn/config_values.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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_
OLDNEW
« no previous file with comments | « tools/gn/config_unittest.cc ('k') | tools/gn/config_values.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698