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

Unified Diff: tools/gn/ninja_binary_target_writer.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 5 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gn/lib_file.cc ('k') | tools/gn/ninja_binary_target_writer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/ninja_binary_target_writer.cc
diff --git a/tools/gn/ninja_binary_target_writer.cc b/tools/gn/ninja_binary_target_writer.cc
index 98c6f1d40771c65d8d1214e9c572a379ffc5e7da..70ba039fa46759e50c0581001eb418ed197ad778 100644
--- a/tools/gn/ninja_binary_target_writer.cc
+++ b/tools/gn/ninja_binary_target_writer.cc
@@ -786,6 +786,15 @@ void NinjaBinaryTargetWriter::WriteLinkerStuff(
}
}
+ // Libraries specified by paths.
+ const OrderedSet<LibFile>& libs = target_->all_libs();
+ for (size_t i = 0; i < libs.size(); i++) {
+ if (libs[i].is_source_file()) {
+ implicit_deps.push_back(
+ OutputFile(settings_->build_settings(), libs[i].source_file()));
+ }
+ }
+
// Append implicit dependencies collected above.
if (!implicit_deps.empty()) {
out_ << " |";
@@ -857,20 +866,25 @@ void NinjaBinaryTargetWriter::WriteLibs() {
// Libraries that have been recursively pushed through the dependency tree.
EscapeOptions lib_escape_opts;
lib_escape_opts.mode = ESCAPE_NINJA_COMMAND;
- const OrderedSet<std::string> all_libs = target_->all_libs();
+ const OrderedSet<LibFile> all_libs = target_->all_libs();
const std::string framework_ending(".framework");
for (size_t i = 0; i < all_libs.size(); i++) {
- if (base::EndsWith(all_libs[i], framework_ending,
- base::CompareCase::INSENSITIVE_ASCII)) {
+ const LibFile& lib_file = all_libs[i];
+ const std::string& lib_value = lib_file.value();
+ if (lib_file.is_source_file()) {
+ out_ << " ";
+ path_output_.WriteFile(out_, lib_file.source_file());
+ } else if (base::EndsWith(lib_value, framework_ending,
+ base::CompareCase::INSENSITIVE_ASCII)) {
// Special-case libraries ending in ".framework" to support Mac: Add the
// -framework switch and don't add the extension to the output.
out_ << " -framework ";
- EscapeStringToStream(out_,
- all_libs[i].substr(0, all_libs[i].size() - framework_ending.size()),
+ EscapeStringToStream(
+ out_, lib_value.substr(0, lib_value.size() - framework_ending.size()),
lib_escape_opts);
} else {
out_ << " " << tool_->lib_switch();
- EscapeStringToStream(out_, all_libs[i], lib_escape_opts);
+ EscapeStringToStream(out_, lib_value, lib_escape_opts);
}
}
out_ << std::endl;
« no previous file with comments | « tools/gn/lib_file.cc ('k') | tools/gn/ninja_binary_target_writer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698