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/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "tools/gn/source_dir.h" | 12 #include "tools/gn/source_dir.h" |
| 13 #include "tools/gn/source_file.h" |
13 | 14 |
14 // 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 |
15 // config or target. | 16 // config or target. |
16 class ConfigValues { | 17 class ConfigValues { |
17 public: | 18 public: |
18 ConfigValues(); | 19 ConfigValues(); |
19 ~ConfigValues(); | 20 ~ConfigValues(); |
20 | 21 |
21 #define STRING_VALUES_ACCESSOR(name) \ | 22 #define STRING_VALUES_ACCESSOR(name) \ |
22 const std::vector<std::string>& name() const { return name##_; } \ | 23 const std::vector<std::string>& name() const { return name##_; } \ |
23 std::vector<std::string>& name() { return name##_; } | 24 std::vector<std::string>& name() { return name##_; } |
24 #define DIR_VALUES_ACCESSOR(name) \ | 25 #define DIR_VALUES_ACCESSOR(name) \ |
25 const std::vector<SourceDir>& name() const { return name##_; } \ | 26 const std::vector<SourceDir>& name() const { return name##_; } \ |
26 std::vector<SourceDir>& name() { return name##_; } | 27 std::vector<SourceDir>& name() { return name##_; } |
27 | 28 |
28 STRING_VALUES_ACCESSOR(cflags) | 29 STRING_VALUES_ACCESSOR(cflags) |
29 STRING_VALUES_ACCESSOR(cflags_c) | 30 STRING_VALUES_ACCESSOR(cflags_c) |
30 STRING_VALUES_ACCESSOR(cflags_cc) | 31 STRING_VALUES_ACCESSOR(cflags_cc) |
31 STRING_VALUES_ACCESSOR(cflags_objc) | 32 STRING_VALUES_ACCESSOR(cflags_objc) |
32 STRING_VALUES_ACCESSOR(cflags_objcc) | 33 STRING_VALUES_ACCESSOR(cflags_objcc) |
33 STRING_VALUES_ACCESSOR(defines) | 34 STRING_VALUES_ACCESSOR(defines) |
34 DIR_VALUES_ACCESSOR (include_dirs) | 35 DIR_VALUES_ACCESSOR (include_dirs) |
35 STRING_VALUES_ACCESSOR(ldflags) | 36 STRING_VALUES_ACCESSOR(ldflags) |
36 DIR_VALUES_ACCESSOR (lib_dirs) | 37 DIR_VALUES_ACCESSOR (lib_dirs) |
37 STRING_VALUES_ACCESSOR(libs) | 38 STRING_VALUES_ACCESSOR(libs) |
38 | 39 |
39 #undef STRING_VALUES_ACCESSOR | 40 #undef STRING_VALUES_ACCESSOR |
40 #undef DIR_VALUES_ACCESSOR | 41 #undef DIR_VALUES_ACCESSOR |
41 | 42 |
| 43 bool has_precompiled_headers() const { |
| 44 return !precompiled_header_.empty() || !precompiled_source_.is_null(); |
| 45 } |
| 46 const std::string& precompiled_header() const { |
| 47 return precompiled_header_; |
| 48 } |
| 49 void set_precompiled_header(const std::string& f) { |
| 50 precompiled_header_ = f; |
| 51 } |
| 52 const SourceFile& precompiled_source() const { |
| 53 return precompiled_source_; |
| 54 } |
| 55 void set_precompiled_source(const SourceFile& f) { |
| 56 precompiled_source_ = f; |
| 57 } |
| 58 |
42 private: | 59 private: |
43 std::vector<std::string> cflags_; | 60 std::vector<std::string> cflags_; |
44 std::vector<std::string> cflags_c_; | 61 std::vector<std::string> cflags_c_; |
45 std::vector<std::string> cflags_cc_; | 62 std::vector<std::string> cflags_cc_; |
46 std::vector<std::string> cflags_objc_; | 63 std::vector<std::string> cflags_objc_; |
47 std::vector<std::string> cflags_objcc_; | 64 std::vector<std::string> cflags_objcc_; |
48 std::vector<std::string> defines_; | 65 std::vector<std::string> defines_; |
49 std::vector<SourceDir> include_dirs_; | 66 std::vector<SourceDir> include_dirs_; |
50 std::vector<std::string> ldflags_; | 67 std::vector<std::string> ldflags_; |
51 std::vector<SourceDir> lib_dirs_; | 68 std::vector<SourceDir> lib_dirs_; |
52 std::vector<std::string> libs_; | 69 std::vector<std::string> libs_; |
53 | 70 |
| 71 std::string precompiled_header_; |
| 72 SourceFile precompiled_source_; |
54 | 73 |
55 DISALLOW_COPY_AND_ASSIGN(ConfigValues); | 74 DISALLOW_COPY_AND_ASSIGN(ConfigValues); |
56 }; | 75 }; |
57 | 76 |
58 #endif // TOOLS_GN_CONFIG_VALUES_H_ | 77 #endif // TOOLS_GN_CONFIG_VALUES_H_ |
OLD | NEW |