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

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

Issue 1904473002: Add arflags to GN (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 8 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/function_toolchain.cc ('k') | tools/gn/ninja_binary_target_writer_unittest.cc » ('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 <stddef.h> 7 #include <stddef.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include <cstring> 10 #include <cstring>
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 778
779 // End of the link "build" line. 779 // End of the link "build" line.
780 out_ << std::endl; 780 out_ << std::endl;
781 781
782 // The remaining things go in the inner scope of the link line. 782 // The remaining things go in the inner scope of the link line.
783 if (target_->output_type() == Target::EXECUTABLE || 783 if (target_->output_type() == Target::EXECUTABLE ||
784 target_->output_type() == Target::SHARED_LIBRARY || 784 target_->output_type() == Target::SHARED_LIBRARY ||
785 target_->output_type() == Target::LOADABLE_MODULE) { 785 target_->output_type() == Target::LOADABLE_MODULE) {
786 WriteLinkerFlags(optional_def_file); 786 WriteLinkerFlags(optional_def_file);
787 WriteLibs(); 787 WriteLibs();
788 } else if (target_->output_type() == Target::STATIC_LIBRARY) {
789 out_ << " arflags =";
790 RecursiveTargetConfigStringsToStream(target_, &ConfigValues::arflags,
791 GetFlagOptions(), out_);
792 out_ << std::endl;
788 } 793 }
789 WriteOutputSubstitutions(); 794 WriteOutputSubstitutions();
790 WriteSolibs(solibs); 795 WriteSolibs(solibs);
791 } 796 }
792 797
793 void NinjaBinaryTargetWriter::WriteLinkerFlags( 798 void NinjaBinaryTargetWriter::WriteLinkerFlags(
794 const SourceFile* optional_def_file) { 799 const SourceFile* optional_def_file) {
795 out_ << " ldflags ="; 800 out_ << " ldflags =";
796 801
797 // First the ldflags from the target and its config. 802 // First the ldflags from the target and its config.
798 EscapeOptions flag_options = GetFlagOptions();
799 RecursiveTargetConfigStringsToStream(target_, &ConfigValues::ldflags, 803 RecursiveTargetConfigStringsToStream(target_, &ConfigValues::ldflags,
800 flag_options, out_); 804 GetFlagOptions(), out_);
801 805
802 // Followed by library search paths that have been recursively pushed 806 // Followed by library search paths that have been recursively pushed
803 // through the dependency tree. 807 // through the dependency tree.
804 const OrderedSet<SourceDir> all_lib_dirs = target_->all_lib_dirs(); 808 const OrderedSet<SourceDir> all_lib_dirs = target_->all_lib_dirs();
805 if (!all_lib_dirs.empty()) { 809 if (!all_lib_dirs.empty()) {
806 // Since we're passing these on the command line to the linker and not 810 // Since we're passing these on the command line to the linker and not
807 // to Ninja, we need to do shell escaping. 811 // to Ninja, we need to do shell escaping.
808 PathOutput lib_path_output(path_output_.current_dir(), 812 PathOutput lib_path_output(path_output_.current_dir(),
809 settings_->build_settings()->root_path_utf8(), 813 settings_->build_settings()->root_path_utf8(),
810 ESCAPE_NINJA_COMMAND); 814 ESCAPE_NINJA_COMMAND);
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
1002 "\n" 1006 "\n"
1003 "In the latter case, either rename one of the files or move one of\n" 1007 "In the latter case, either rename one of the files or move one of\n"
1004 "the sources to a separate source_set to avoid them both being in\n" 1008 "the sources to a separate source_set to avoid them both being in\n"
1005 "the same target."); 1009 "the same target.");
1006 g_scheduler->FailWithError(err); 1010 g_scheduler->FailWithError(err);
1007 return false; 1011 return false;
1008 } 1012 }
1009 } 1013 }
1010 return true; 1014 return true;
1011 } 1015 }
OLDNEW
« no previous file with comments | « tools/gn/function_toolchain.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