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 944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
955 // SHARED_LIBRARY | 955 // SHARED_LIBRARY |
956 // _complete_ STATIC_LIBRARY | 956 // _complete_ STATIC_LIBRARY |
957 // | 957 // |
958 // Child deps of intermediate static libraries get pushed up the | 958 // Child deps of intermediate static libraries get pushed up the |
959 // dependency tree until one of these is reached, and source sets | 959 // dependency tree until one of these is reached, and source sets |
960 // don't link at all. | 960 // don't link at all. |
961 bool can_link_libs = target_->IsFinal(); | 961 bool can_link_libs = target_->IsFinal(); |
962 | 962 |
963 if (dep->output_type() == Target::SOURCE_SET) { | 963 if (dep->output_type() == Target::SOURCE_SET) { |
964 // Source sets have their object files linked into final targets | 964 // Source sets have their object files linked into final targets |
965 // (shared libraries, executables, and complete static | 965 // (shared libraries, executables, loadable modules, and complete static |
966 // libraries). Intermediate static libraries and other source sets | 966 // libraries). Intermediate static libraries and other source sets |
967 // just forward the dependency, otherwise the files in the source | 967 // just forward the dependency, otherwise the files in the source |
968 // set can easily get linked more than once which will cause | 968 // set can easily get linked more than once which will cause |
969 // multiple definition errors. | 969 // multiple definition errors. |
970 if (can_link_libs) | 970 if (can_link_libs) |
971 AddSourceSetObjectFiles(dep, extra_object_files); | 971 AddSourceSetObjectFiles(dep, extra_object_files); |
972 | 972 |
973 // Add the source set itself as a non-linkable dependency on the current | 973 // Add the source set itself as a non-linkable dependency on the current |
974 // target. This will make sure that anything the source set's stamp file | 974 // target. This will make sure that anything the source set's stamp file |
975 // depends on (like data deps) are also built before the current target | 975 // depends on (like data deps) are also built before the current target |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1028 "\n" | 1028 "\n" |
1029 "In the latter case, either rename one of the files or move one of\n" | 1029 "In the latter case, either rename one of the files or move one of\n" |
1030 "the sources to a separate source_set to avoid them both being in\n" | 1030 "the sources to a separate source_set to avoid them both being in\n" |
1031 "the same target."); | 1031 "the same target."); |
1032 g_scheduler->FailWithError(err); | 1032 g_scheduler->FailWithError(err); |
1033 return false; | 1033 return false; |
1034 } | 1034 } |
1035 } | 1035 } |
1036 return true; | 1036 return true; |
1037 } | 1037 } |
OLD | NEW |