| OLD | NEW |
| 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 <cstring> | 7 #include <cstring> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <sstream> | 9 #include <sstream> |
| 10 | 10 |
| (...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 850 | 850 |
| 851 out_ << std::endl; | 851 out_ << std::endl; |
| 852 } | 852 } |
| 853 | 853 |
| 854 void NinjaBinaryTargetWriter::WriteLibs() { | 854 void NinjaBinaryTargetWriter::WriteLibs() { |
| 855 out_ << " libs ="; | 855 out_ << " libs ="; |
| 856 | 856 |
| 857 // Libraries that have been recursively pushed through the dependency tree. | 857 // Libraries that have been recursively pushed through the dependency tree. |
| 858 EscapeOptions lib_escape_opts; | 858 EscapeOptions lib_escape_opts; |
| 859 lib_escape_opts.mode = ESCAPE_NINJA_COMMAND; | 859 lib_escape_opts.mode = ESCAPE_NINJA_COMMAND; |
| 860 const OrderedSet<std::string> all_libs = target_->all_libs(); | 860 const OrderedSet<LibFile> all_libs = target_->all_libs(); |
| 861 const std::string framework_ending(".framework"); | 861 const std::string framework_ending(".framework"); |
| 862 for (size_t i = 0; i < all_libs.size(); i++) { | 862 for (size_t i = 0; i < all_libs.size(); i++) { |
| 863 if (base::EndsWith(all_libs[i], framework_ending, | 863 const LibFile& lib_file = all_libs[i]; |
| 864 base::CompareCase::INSENSITIVE_ASCII)) { | 864 std::string value = lib_file.value(); |
| 865 if (lib_file.is_source_file()) { |
| 866 out_ << " "; |
| 867 path_output_.WriteFile(out_, lib_file.source_file()); |
| 868 } else if (base::EndsWith(value, framework_ending, |
| 869 base::CompareCase::INSENSITIVE_ASCII)) { |
| 865 // Special-case libraries ending in ".framework" to support Mac: Add the | 870 // Special-case libraries ending in ".framework" to support Mac: Add the |
| 866 // -framework switch and don't add the extension to the output. | 871 // -framework switch and don't add the extension to the output. |
| 867 out_ << " -framework "; | 872 out_ << " -framework "; |
| 868 EscapeStringToStream(out_, | 873 EscapeStringToStream( |
| 869 all_libs[i].substr(0, all_libs[i].size() - framework_ending.size()), | 874 out_, value.substr(0, value.size() - framework_ending.size()), |
| 870 lib_escape_opts); | 875 lib_escape_opts); |
| 871 } else { | 876 } else { |
| 872 out_ << " " << tool_->lib_switch(); | 877 out_ << " " << tool_->lib_switch(); |
| 873 EscapeStringToStream(out_, all_libs[i], lib_escape_opts); | 878 EscapeStringToStream(out_, value, lib_escape_opts); |
| 874 } | 879 } |
| 875 } | 880 } |
| 876 out_ << std::endl; | 881 out_ << std::endl; |
| 877 } | 882 } |
| 878 | 883 |
| 879 void NinjaBinaryTargetWriter::WriteOutputExtension() { | 884 void NinjaBinaryTargetWriter::WriteOutputExtension() { |
| 880 out_ << " output_extension = "; | 885 out_ << " output_extension = "; |
| 881 if (target_->output_extension().empty()) { | 886 if (target_->output_extension().empty()) { |
| 882 // Use the default from the tool. | 887 // Use the default from the tool. |
| 883 out_ << tool_->default_output_extension(); | 888 out_ << tool_->default_output_extension(); |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1027 "\n" | 1032 "\n" |
| 1028 "In the latter case, either rename one of the files or move one of\n" | 1033 "In the latter case, either rename one of the files or move one of\n" |
| 1029 "the sources to a separate source_set to avoid them both being in\n" | 1034 "the sources to a separate source_set to avoid them both being in\n" |
| 1030 "the same target."); | 1035 "the same target."); |
| 1031 g_scheduler->FailWithError(err); | 1036 g_scheduler->FailWithError(err); |
| 1032 return false; | 1037 return false; |
| 1033 } | 1038 } |
| 1034 } | 1039 } |
| 1035 return true; | 1040 return true; |
| 1036 } | 1041 } |
| OLD | NEW |