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

Side by Side 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 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 | Annotate | Revision Log
« no previous file with comments | « tools/gn/function_toolchain.cc ('k') | tools/gn/secondary/base/BUILD.gn » ('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/ninja_binary_target_writer.h" 5 #include "tools/gn/ninja_binary_target_writer.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "tools/gn/config_values_extractors.h" 10 #include "tools/gn/config_values_extractors.h"
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 // HACK ERASEME BRETTW FIXME 272 // HACK ERASEME BRETTW FIXME
273 if (settings_->IsWin()) { 273 if (settings_->IsWin()) {
274 out_ << " /MANIFEST /ManifestFile:"; 274 out_ << " /MANIFEST /ManifestFile:";
275 path_output_.WriteFile(out_, windows_manifest); 275 path_output_.WriteFile(out_, windows_manifest);
276 } 276 }
277 out_ << std::endl; 277 out_ << std::endl;
278 } 278 }
279 279
280 void NinjaBinaryTargetWriter::WriteLibs(const Toolchain::Tool& tool) { 280 void NinjaBinaryTargetWriter::WriteLibs(const Toolchain::Tool& tool) {
281 out_ << "libs ="; 281 out_ << "libs =";
282 if (settings_->IsMac()) {
283 // TODO(brettw) write frameworks correctly for Mac.
284 out_ << " -framework AppKit -framework ApplicationServices -framework Carbon -framework CoreFoundation -framework Foundation -framework IOKit -framework Sec urity";
285 }
286 282
287 // Libraries that have been recursively pushed through the dependency tree. 283 // Libraries that have been recursively pushed through the dependency tree.
288 EscapeOptions lib_escape_opts; 284 EscapeOptions lib_escape_opts;
289 lib_escape_opts.mode = ESCAPE_NINJA_SHELL; 285 lib_escape_opts.mode = ESCAPE_NINJA_SHELL;
290 const OrderedSet<std::string> all_libs = target_->all_libs(); 286 const OrderedSet<std::string> all_libs = target_->all_libs();
287 const std::string framework_ending(".framework");
291 for (size_t i = 0; i < all_libs.size(); i++) { 288 for (size_t i = 0; i < all_libs.size(); i++) {
292 out_ << " " << tool.lib_prefix; 289 if (settings_->IsMac() && EndsWith(all_libs[i], framework_ending, false)) {
293 EscapeStringToStream(out_, all_libs[i], lib_escape_opts); 290 // Special-case libraries ending in ".framework" on Mac. Add the
294 out_ << ""; 291 // -framework switch and don't add the extension to the output.
292 out_ << " -framework ";
293 EscapeStringToStream(out_,
294 all_libs[i].substr(0, all_libs[i].size() - framework_ending.size()),
295 lib_escape_opts);
296 } else {
297 out_ << " " << tool.lib_prefix;
298 EscapeStringToStream(out_, all_libs[i], lib_escape_opts);
299 }
295 } 300 }
296 out_ << std::endl; 301 out_ << std::endl;
297 } 302 }
298 303
299 void NinjaBinaryTargetWriter::WriteLinkCommand( 304 void NinjaBinaryTargetWriter::WriteLinkCommand(
300 const OutputFile& external_output_file, 305 const OutputFile& external_output_file,
301 const OutputFile& internal_output_file, 306 const OutputFile& internal_output_file,
302 const std::vector<OutputFile>& object_files) { 307 const std::vector<OutputFile>& object_files) {
303 out_ << "build "; 308 out_ << "build ";
304 path_output_.WriteFile(out_, internal_output_file); 309 path_output_.WriteFile(out_, internal_output_file);
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 } 458 }
454 459
455 // Data files. 460 // Data files.
456 const std::vector<SourceFile>& data = target_->data(); 461 const std::vector<SourceFile>& data = target_->data();
457 for (size_t i = 0; i < data.size(); i++) { 462 for (size_t i = 0; i < data.size(); i++) {
458 out_ << " "; 463 out_ << " ";
459 path_output_.WriteFile(out_, data[i]); 464 path_output_.WriteFile(out_, data[i]);
460 } 465 }
461 } 466 }
462 } 467 }
OLDNEW
« 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