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 #include "tools/gn/config_values_generator.h" | 5 #include "tools/gn/config_values_generator.h" |
6 | 6 |
7 #include "base/strings/string_util.h" | |
7 #include "tools/gn/config_values.h" | 8 #include "tools/gn/config_values.h" |
8 #include "tools/gn/scope.h" | 9 #include "tools/gn/scope.h" |
9 #include "tools/gn/settings.h" | 10 #include "tools/gn/settings.h" |
10 #include "tools/gn/value.h" | 11 #include "tools/gn/value.h" |
11 #include "tools/gn/value_extractors.h" | 12 #include "tools/gn/value_extractors.h" |
12 #include "tools/gn/variables.h" | 13 #include "tools/gn/variables.h" |
13 | 14 |
14 namespace { | 15 namespace { |
15 | 16 |
16 void GetStringList( | 17 void GetStringList( |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
74 FILL_STRING_CONFIG_VALUE(cflags_objc) | 75 FILL_STRING_CONFIG_VALUE(cflags_objc) |
75 FILL_STRING_CONFIG_VALUE(cflags_objcc) | 76 FILL_STRING_CONFIG_VALUE(cflags_objcc) |
76 FILL_STRING_CONFIG_VALUE(defines) | 77 FILL_STRING_CONFIG_VALUE(defines) |
77 FILL_DIR_CONFIG_VALUE( include_dirs) | 78 FILL_DIR_CONFIG_VALUE( include_dirs) |
78 FILL_STRING_CONFIG_VALUE(ldflags) | 79 FILL_STRING_CONFIG_VALUE(ldflags) |
79 FILL_DIR_CONFIG_VALUE( lib_dirs) | 80 FILL_DIR_CONFIG_VALUE( lib_dirs) |
80 FILL_STRING_CONFIG_VALUE(libs) | 81 FILL_STRING_CONFIG_VALUE(libs) |
81 | 82 |
82 #undef FILL_STRING_CONFIG_VALUE | 83 #undef FILL_STRING_CONFIG_VALUE |
83 #undef FILL_DIR_CONFIG_VALUE | 84 #undef FILL_DIR_CONFIG_VALUE |
85 | |
86 // Precompiled headers. | |
87 const Value* precompiled_header_value = | |
88 scope_->GetValue(variables::kPrecompiledHeader, true); | |
89 if (precompiled_header_value) { | |
90 if (!precompiled_header_value->VerifyTypeIs(Value::STRING, err_)) | |
91 return; | |
92 | |
93 // Check for common errors. This is a string and not a file. | |
94 const std::string& pch_string = precompiled_header_value->string_value(); | |
95 if (base::StartsWith(pch_string, "//", base::CompareCase::SENSITIVE)) { | |
96 *err_ = Err(*precompiled_header_value, | |
97 "This precompiled_header value is wrong.", | |
98 "You need to specify a string that the compiler will match against\n" | |
99 "the your #include lines rather than a GN-style file name.\n"); | |
scottmg
2015/06/29 21:49:17
"the" or "your" but not both.
| |
100 return; | |
101 } | |
102 config_values_->set_precompiled_header(pch_string); | |
103 } | |
104 | |
105 const Value* precompiled_source_value = | |
106 scope_->GetValue(variables::kPrecompiledSource, true); | |
107 if (precompiled_source_value) { | |
108 config_values_->set_precompiled_source( | |
109 input_dir_.ResolveRelativeFile( | |
110 *precompiled_source_value, err_, | |
111 scope_->settings()->build_settings()->root_path_utf8())); | |
112 if (err_->has_error()) | |
113 return; | |
114 } | |
84 } | 115 } |
OLD | NEW |