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_CONFIG_VALUES_H_
6 #define TOOLS_GN_CONFIG_VALUES_H_
11 #include "base/macros.h"
12 #include "tools/gn/source_dir.h"
13 #include "tools/gn/source_file.h"
15 // Holds the values (include_dirs, defines, compiler flags, etc.) for a given
22 #define STRING_VALUES_ACCESSOR(name) \
23 const std::vector<std::string>& name() const { return name##_; } \
24 std::vector<std::string>& name() { return name##_; }
25 #define DIR_VALUES_ACCESSOR(name) \
26 const std::vector<SourceDir>& name() const { return name##_; } \
27 std::vector<SourceDir>& name() { return name##_; }
29 STRING_VALUES_ACCESSOR(cflags
)
30 STRING_VALUES_ACCESSOR(cflags_c
)
31 STRING_VALUES_ACCESSOR(cflags_cc
)
32 STRING_VALUES_ACCESSOR(cflags_objc
)
33 STRING_VALUES_ACCESSOR(cflags_objcc
)
34 STRING_VALUES_ACCESSOR(defines
)
35 DIR_VALUES_ACCESSOR (include_dirs
)
36 STRING_VALUES_ACCESSOR(ldflags
)
37 DIR_VALUES_ACCESSOR (lib_dirs
)
38 STRING_VALUES_ACCESSOR(libs
)
40 #undef STRING_VALUES_ACCESSOR
41 #undef DIR_VALUES_ACCESSOR
43 bool has_precompiled_headers() const {
44 return !precompiled_header_
.empty() || !precompiled_source_
.is_null();
46 const std::string
& precompiled_header() const {
47 return precompiled_header_
;
49 void set_precompiled_header(const std::string
& f
) {
50 precompiled_header_
= f
;
52 const SourceFile
& precompiled_source() const {
53 return precompiled_source_
;
55 void set_precompiled_source(const SourceFile
& f
) {
56 precompiled_source_
= f
;
60 std::vector
<std::string
> cflags_
;
61 std::vector
<std::string
> cflags_c_
;
62 std::vector
<std::string
> cflags_cc_
;
63 std::vector
<std::string
> cflags_objc_
;
64 std::vector
<std::string
> cflags_objcc_
;
65 std::vector
<std::string
> defines_
;
66 std::vector
<SourceDir
> include_dirs_
;
67 std::vector
<std::string
> ldflags_
;
68 std::vector
<SourceDir
> lib_dirs_
;
69 std::vector
<std::string
> libs_
;
71 std::string precompiled_header_
;
72 SourceFile precompiled_source_
;
74 DISALLOW_COPY_AND_ASSIGN(ConfigValues
);
77 #endif // TOOLS_GN_CONFIG_VALUES_H_