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

Side by Side Diff: tools/gn/config_values_generator.cc

Issue 1530183005: Special-case paths that appear in libs by not prefixing them with -l. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typo in previous patch Created 4 years, 12 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_values.h ('k') | tools/gn/gn.gyp » ('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 #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 "base/strings/string_util.h"
8 #include "tools/gn/config_values.h" 8 #include "tools/gn/config_values.h"
9 #include "tools/gn/scope.h" 9 #include "tools/gn/scope.h"
10 #include "tools/gn/settings.h" 10 #include "tools/gn/settings.h"
11 #include "tools/gn/value.h" 11 #include "tools/gn/value.h"
12 #include "tools/gn/value_extractors.h" 12 #include "tools/gn/value_extractors.h"
13 #include "tools/gn/variables.h" 13 #include "tools/gn/variables.h"
14 14
15 namespace { 15 namespace {
16 16
17 void GetStringList( 17 void GetStringList(
18 Scope* scope, 18 Scope* scope,
19 const char* var_name, 19 const char* var_name,
20 ConfigValues* config_values, 20 ConfigValues* config_values,
21 std::vector<std::string>& (ConfigValues::* accessor)(), 21 std::vector<std::string>& (ConfigValues::* accessor)(),
22 Err* err) { 22 Err* err) {
23 const Value* value = scope->GetValue(var_name, true); 23 const Value* value = scope->GetValue(var_name, true);
24 if (!value) 24 if (!value)
25 return; // No value, empty input and succeed. 25 return; // No value, empty input and succeed.
26 26
27 std::vector<std::string> result; 27 ExtractListOfStringValues(*value, &(config_values->*accessor)(), err);
28 ExtractListOfStringValues(*value, &result, err);
29 (config_values->*accessor)().swap(result);
30 } 28 }
31 29
32 void GetDirList( 30 void GetDirList(
33 Scope* scope, 31 Scope* scope,
34 const char* var_name, 32 const char* var_name,
35 ConfigValues* config_values, 33 ConfigValues* config_values,
36 const SourceDir input_dir, 34 const SourceDir input_dir,
37 std::vector<SourceDir>& (ConfigValues::* accessor)(), 35 std::vector<SourceDir>& (ConfigValues::* accessor)(),
38 Err* err) { 36 Err* err) {
39 const Value* value = scope->GetValue(var_name, true); 37 const Value* value = scope->GetValue(var_name, true);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 FILL_STRING_CONFIG_VALUE(asmflags) 70 FILL_STRING_CONFIG_VALUE(asmflags)
73 FILL_STRING_CONFIG_VALUE(cflags) 71 FILL_STRING_CONFIG_VALUE(cflags)
74 FILL_STRING_CONFIG_VALUE(cflags_c) 72 FILL_STRING_CONFIG_VALUE(cflags_c)
75 FILL_STRING_CONFIG_VALUE(cflags_cc) 73 FILL_STRING_CONFIG_VALUE(cflags_cc)
76 FILL_STRING_CONFIG_VALUE(cflags_objc) 74 FILL_STRING_CONFIG_VALUE(cflags_objc)
77 FILL_STRING_CONFIG_VALUE(cflags_objcc) 75 FILL_STRING_CONFIG_VALUE(cflags_objcc)
78 FILL_STRING_CONFIG_VALUE(defines) 76 FILL_STRING_CONFIG_VALUE(defines)
79 FILL_DIR_CONFIG_VALUE( include_dirs) 77 FILL_DIR_CONFIG_VALUE( include_dirs)
80 FILL_STRING_CONFIG_VALUE(ldflags) 78 FILL_STRING_CONFIG_VALUE(ldflags)
81 FILL_DIR_CONFIG_VALUE( lib_dirs) 79 FILL_DIR_CONFIG_VALUE( lib_dirs)
82 FILL_STRING_CONFIG_VALUE(libs)
83 80
84 #undef FILL_STRING_CONFIG_VALUE 81 #undef FILL_STRING_CONFIG_VALUE
85 #undef FILL_DIR_CONFIG_VALUE 82 #undef FILL_DIR_CONFIG_VALUE
86 83
84 // Libs
85 const Value* libs_value = scope_->GetValue("libs", true);
86 if (libs_value) {
87 ExtractListOfLibs(scope_->settings()->build_settings(), *libs_value,
88 input_dir_, &config_values_->libs(), err_);
89 }
90
87 // Precompiled headers. 91 // Precompiled headers.
88 const Value* precompiled_header_value = 92 const Value* precompiled_header_value =
89 scope_->GetValue(variables::kPrecompiledHeader, true); 93 scope_->GetValue(variables::kPrecompiledHeader, true);
90 if (precompiled_header_value) { 94 if (precompiled_header_value) {
91 if (!precompiled_header_value->VerifyTypeIs(Value::STRING, err_)) 95 if (!precompiled_header_value->VerifyTypeIs(Value::STRING, err_))
92 return; 96 return;
93 97
94 // Check for common errors. This is a string and not a file. 98 // Check for common errors. This is a string and not a file.
95 const std::string& pch_string = precompiled_header_value->string_value(); 99 const std::string& pch_string = precompiled_header_value->string_value();
96 if (base::StartsWith(pch_string, "//", base::CompareCase::SENSITIVE)) { 100 if (base::StartsWith(pch_string, "//", base::CompareCase::SENSITIVE)) {
(...skipping 10 matching lines...) Expand all
107 scope_->GetValue(variables::kPrecompiledSource, true); 111 scope_->GetValue(variables::kPrecompiledSource, true);
108 if (precompiled_source_value) { 112 if (precompiled_source_value) {
109 config_values_->set_precompiled_source( 113 config_values_->set_precompiled_source(
110 input_dir_.ResolveRelativeFile( 114 input_dir_.ResolveRelativeFile(
111 *precompiled_source_value, err_, 115 *precompiled_source_value, err_,
112 scope_->settings()->build_settings()->root_path_utf8())); 116 scope_->settings()->build_settings()->root_path_utf8()));
113 if (err_->has_error()) 117 if (err_->has_error())
114 return; 118 return;
115 } 119 }
116 } 120 }
OLDNEW
« no previous file with comments | « tools/gn/config_values.h ('k') | tools/gn/gn.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698