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

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

Issue 21983003: Make the Mac build work. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: dunnow Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « tools/gn/ninja_helper.cc ('k') | tools/gn/secondary/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_target_writer.h" 5 #include "tools/gn/ninja_target_writer.h"
6 6
7 #include <fstream> 7 #include <fstream>
8 #include <sstream> 8 #include <sstream>
9 9
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 out_ << std::endl; 353 out_ << std::endl;
354 354
355 // Includes. 355 // Includes.
356 out_ << "includes ="; 356 out_ << "includes =";
357 RecursiveTargetConfigToStream(target_, &ConfigValues::includes, 357 RecursiveTargetConfigToStream(target_, &ConfigValues::includes,
358 IncludeWriter(path_output_, helper_), out_); 358 IncludeWriter(path_output_, helper_), out_);
359 359
360 out_ << std::endl; 360 out_ << std::endl;
361 361
362 // C flags and friends. 362 // C flags and friends.
363 out_ << "cflags ="; 363 #define WRITE_FLAGS(name) \
364 RecursiveTargetConfigStringsToStream(target_, &ConfigValues::cflags, out_); 364 out_ << #name " ="; \
365 out_ << std::endl; 365 RecursiveTargetConfigStringsToStream(target_, &ConfigValues::name, out_); \
366 out_ << "cflags_c ="; 366 out_ << std::endl;
367 RecursiveTargetConfigStringsToStream(target_, &ConfigValues::cflags_c, out_); 367
368 out_ << std::endl; 368 WRITE_FLAGS(cflags)
369 out_ << "cflags_cc ="; 369 WRITE_FLAGS(cflags_c)
370 RecursiveTargetConfigStringsToStream(target_, &ConfigValues::cflags_cc, out_); 370 WRITE_FLAGS(cflags_cc)
371 out_ << std::endl; 371 WRITE_FLAGS(cflags_objc)
372 WRITE_FLAGS(cflags_objcc)
373
374 #undef WRITE_FLAGS
372 375
373 out_ << std::endl; 376 out_ << std::endl;
374 } 377 }
375 378
376 void NinjaTargetWriter::WriteSources( 379 void NinjaTargetWriter::WriteSources(
377 std::vector<OutputFile>* object_files) { 380 std::vector<OutputFile>* object_files) {
378 const Target::FileList& sources = target_->sources(); 381 const Target::FileList& sources = target_->sources();
379 object_files->reserve(sources.size()); 382 object_files->reserve(sources.size());
380 383
381 for (size_t i = 0; i < sources.size(); i++) { 384 for (size_t i = 0; i < sources.size(); i++) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 RecursiveTargetConfigStringsToStream(target_, &ConfigValues::ldflags, out_); 425 RecursiveTargetConfigStringsToStream(target_, &ConfigValues::ldflags, out_);
423 // HACK ERASEME BRETTW FIXME 426 // HACK ERASEME BRETTW FIXME
424 if (settings_->IsWin()) { 427 if (settings_->IsWin()) {
425 out_ << " /MANIFEST /ManifestFile:"; 428 out_ << " /MANIFEST /ManifestFile:";
426 path_output_.WriteFile(out_, windows_manifest); 429 path_output_.WriteFile(out_, windows_manifest);
427 out_ << " /DEBUG /MACHINE:X86 /LIBPATH:\"C:\\Program Files (x86)\\Windows Ki ts\\8.0\\Lib\\win8\\um\\x86\" /DELAYLOAD:dbghelp.dll /DELAYLOAD:dwmapi.dll /DELA YLOAD:shell32.dll /DELAYLOAD:uxtheme.dll /safeseh /dynamicbase /ignore:4199 /ign ore:4221 /nxcompat /SUBSYSTEM:CONSOLE /INCREMENTAL /FIXED:NO /DYNAMICBASE:NO win inet.lib dnsapi.lib version.lib msimg32.lib ws2_32.lib usp10.lib psapi.lib dbghe lp.lib winmm.lib shlwapi.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib ad vapi32.lib shell32.lib ole32.lib oleaut32.lib user32.lib uuid.lib odbc32.lib odb ccp32.lib delayimp.lib /NXCOMPAT"; 430 out_ << " /DEBUG /MACHINE:X86 /LIBPATH:\"C:\\Program Files (x86)\\Windows Ki ts\\8.0\\Lib\\win8\\um\\x86\" /DELAYLOAD:dbghelp.dll /DELAYLOAD:dwmapi.dll /DELA YLOAD:shell32.dll /DELAYLOAD:uxtheme.dll /safeseh /dynamicbase /ignore:4199 /ign ore:4221 /nxcompat /SUBSYSTEM:CONSOLE /INCREMENTAL /FIXED:NO /DYNAMICBASE:NO win inet.lib dnsapi.lib version.lib msimg32.lib ws2_32.lib usp10.lib psapi.lib dbghe lp.lib winmm.lib shlwapi.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib ad vapi32.lib shell32.lib ole32.lib oleaut32.lib user32.lib uuid.lib odbc32.lib odb ccp32.lib delayimp.lib /NXCOMPAT";
428 } 431 }
429 out_ << std::endl; 432 out_ << std::endl;
430 433
431 // Libraries to link. 434 // Libraries to link.
432 out_ << "libs =" << std::endl; 435 out_ << "libs =";
436 if (settings_->IsMac()) {
437 // TODO(brettw) fix this.
438 out_ << " -framework AppKit -framework ApplicationServices -framework Carbon -framework CoreFoundation -framework Foundation -framework IOKit -framework Sec urity";
439 }
440 out_ << std::endl;
433 441
434 // The external output file is the one that other libs depend on. 442 // The external output file is the one that other libs depend on.
435 OutputFile external_output_file = helper_.GetTargetOutputFile(target_); 443 OutputFile external_output_file = helper_.GetTargetOutputFile(target_);
436 444
437 // The internal output file is the "main thing" we think we're making. In 445 // The internal output file is the "main thing" we think we're making. In
438 // the case of shared libraries, this is the shared library and the external 446 // the case of shared libraries, this is the shared library and the external
439 // output file is the import library. In other cases, the internal one and 447 // output file is the import library. In other cases, the internal one and
440 // the external one are the same. 448 // the external one are the same.
441 OutputFile internal_output_file; 449 OutputFile internal_output_file;
442 if (target_->output_type() == Target::SHARED_LIBRARY) { 450 if (target_->output_type() == Target::SHARED_LIBRARY) {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 506
499 out_ << " dll = "; 507 out_ << " dll = ";
500 path_output_.WriteFile(out_, internal_output_file); 508 path_output_.WriteFile(out_, internal_output_file);
501 out_ << std::endl; 509 out_ << std::endl;
502 510
503 if (settings_->IsWin()) { 511 if (settings_->IsWin()) {
504 out_ << " implibflag = /IMPLIB:"; 512 out_ << " implibflag = /IMPLIB:";
505 path_output_.WriteFile(out_, external_output_file); 513 path_output_.WriteFile(out_, external_output_file);
506 out_ << std::endl; 514 out_ << std::endl;
507 } 515 }
516
517 // TODO(brettw) postbuild steps.
518 if (settings_->IsMac())
519 out_ << " postbuilds = $ && (export BUILT_PRODUCTS_DIR=/Users/brettw/prj/ src/out/gn; export CONFIGURATION=Debug; export DYLIB_INSTALL_NAME_BASE=@rpath; e xport EXECUTABLE_NAME=libbase.dylib; export EXECUTABLE_PATH=libbase.dylib; expor t FULL_PRODUCT_NAME=libbase.dylib; export LD_DYLIB_INSTALL_NAME=@rpath/libbase.d ylib; export MACH_O_TYPE=mh_dylib; export PRODUCT_NAME=base; export PRODUCT_TYPE =com.apple.product-type.library.dynamic; export SDKROOT=/Applications/Xcode.app/ Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk; expo rt SRCROOT=/Users/brettw/prj/src/out/gn/../../base; export SOURCE_ROOT=\"$${SRCR OOT}\"; export TARGET_BUILD_DIR=/Users/brettw/prj/src/out/gn; export TEMP_DIR=\" $${TMPDIR}\"; (cd ../../base && ../build/mac/strip_from_xcode); G=$$?; ((exit $$ G) || rm -rf libbase.dylib) && exit $$G)";
508 } 520 }
509 521
510 // TODO(brettw) postbuild steps here.
511 522
512 out_ << std::endl; 523 out_ << std::endl;
513 } 524 }
514 525
515 const char* NinjaTargetWriter::GetCommandForSourceType( 526 const char* NinjaTargetWriter::GetCommandForSourceType(
516 SourceFileType type) const { 527 SourceFileType type) const {
517 if (type == SOURCE_C) 528 if (type == SOURCE_C)
518 return "cc"; 529 return "cc";
519 if (type == SOURCE_CC) 530 if (type == SOURCE_CC)
520 return "cxx"; 531 return "cxx";
(...skipping 26 matching lines...) Expand all
547 // TODO(brettw) stuff about standalong static libraryes on Unix in 558 // TODO(brettw) stuff about standalong static libraryes on Unix in
548 // WriteTarget in the Python one, and lots of postbuild steps. 559 // WriteTarget in the Python one, and lots of postbuild steps.
549 return "alink"; 560 return "alink";
550 } 561 }
551 562
552 if (target_->output_type() == Target::SHARED_LIBRARY) 563 if (target_->output_type() == Target::SHARED_LIBRARY)
553 return "solink"; 564 return "solink";
554 565
555 return "link"; 566 return "link";
556 } 567 }
OLDNEW
« no previous file with comments | « tools/gn/ninja_helper.cc ('k') | tools/gn/secondary/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698