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

Unified Diff: tools/gn/ninja_binary_target_writer.cc

Issue 88813005: Support Mac frameworks in GN. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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/function_toolchain.cc ('k') | tools/gn/secondary/base/BUILD.gn » ('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 089a80e642b74421ad85dc0ac00b3f064859a11f..06d56ac00f4129fb52f831a38681ae5809dcff96 100644
--- a/tools/gn/ninja_binary_target_writer.cc
+++ b/tools/gn/ninja_binary_target_writer.cc
@@ -279,19 +279,24 @@ void NinjaBinaryTargetWriter::WriteLinkerFlags(
void NinjaBinaryTargetWriter::WriteLibs(const Toolchain::Tool& tool) {
out_ << "libs =";
- if (settings_->IsMac()) {
- // TODO(brettw) write frameworks correctly for Mac.
- out_ << " -framework AppKit -framework ApplicationServices -framework Carbon -framework CoreFoundation -framework Foundation -framework IOKit -framework Security";
- }
// Libraries that have been recursively pushed through the dependency tree.
EscapeOptions lib_escape_opts;
lib_escape_opts.mode = ESCAPE_NINJA_SHELL;
const OrderedSet<std::string> all_libs = target_->all_libs();
+ const std::string framework_ending(".framework");
for (size_t i = 0; i < all_libs.size(); i++) {
- out_ << " " << tool.lib_prefix;
- EscapeStringToStream(out_, all_libs[i], lib_escape_opts);
- out_ << "";
+ if (settings_->IsMac() && EndsWith(all_libs[i], framework_ending, false)) {
+ // Special-case libraries ending in ".framework" on 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()),
+ lib_escape_opts);
+ } else {
+ out_ << " " << tool.lib_prefix;
+ EscapeStringToStream(out_, all_libs[i], lib_escape_opts);
+ }
}
out_ << std::endl;
}
« no previous file with comments | « tools/gn/function_toolchain.cc ('k') | tools/gn/secondary/base/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698