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/binary_target_generator.h" | 5 #include "tools/gn/binary_target_generator.h" |
6 | 6 |
7 #include "tools/gn/config_values_generator.h" | 7 #include "tools/gn/config_values_generator.h" |
8 #include "tools/gn/deps_iterator.h" | 8 #include "tools/gn/deps_iterator.h" |
9 #include "tools/gn/err.h" | 9 #include "tools/gn/err.h" |
10 #include "tools/gn/functions.h" | 10 #include "tools/gn/functions.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 if (!FillConfigs()) | 49 if (!FillConfigs()) |
50 return; | 50 return; |
51 | 51 |
52 if (!FillAllowCircularIncludesFrom()) | 52 if (!FillAllowCircularIncludesFrom()) |
53 return; | 53 return; |
54 | 54 |
55 if (!FillCompleteStaticLib()) | 55 if (!FillCompleteStaticLib()) |
56 return; | 56 return; |
57 | 57 |
| 58 if (!FillDarwinBundle()) |
| 59 return; |
| 60 |
58 // Config values (compiler flags, etc.) set directly on this target. | 61 // Config values (compiler flags, etc.) set directly on this target. |
59 ConfigValuesGenerator gen(&target_->config_values(), scope_, | 62 ConfigValuesGenerator gen(&target_->config_values(), scope_, |
60 scope_->GetSourceDir(), err_); | 63 scope_->GetSourceDir(), err_); |
61 gen.Run(); | 64 gen.Run(); |
62 if (err_->has_error()) | 65 if (err_->has_error()) |
63 return; | 66 return; |
64 } | 67 } |
65 | 68 |
66 bool BinaryTargetGenerator::FillCompleteStaticLib() { | 69 bool BinaryTargetGenerator::FillCompleteStaticLib() { |
67 if (target_->output_type() == Target::STATIC_LIBRARY) { | 70 if (target_->output_type() == Target::STATIC_LIBRARY) { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 "deps."); | 127 "deps."); |
125 return false; | 128 return false; |
126 } | 129 } |
127 } | 130 } |
128 | 131 |
129 // Add to the set. | 132 // Add to the set. |
130 for (const auto& cur : circular) | 133 for (const auto& cur : circular) |
131 target_->allow_circular_includes_from().insert(cur); | 134 target_->allow_circular_includes_from().insert(cur); |
132 return true; | 135 return true; |
133 } | 136 } |
| 137 |
| 138 bool BinaryTargetGenerator::FillDarwinBundle() { |
| 139 // This flag only applies to executable and shared_library target types. |
| 140 if (target_->output_type() == Target::STATIC_LIBRARY) |
| 141 return true; |
| 142 |
| 143 const Value* value = scope_->GetValue(variables::kDarwinBundle, true); |
| 144 if (value) { |
| 145 if (!value->VerifyTypeIs(Value::BOOLEAN, err_)) |
| 146 return false; |
| 147 target_->set_darwin_bundle(value->boolean_value()); |
| 148 } |
| 149 return true; |
| 150 } |
| 151 |
| 152 bool BinaryTargetGenerator::FillLoadableModule() { |
| 153 // This flag only applies to shared_library target types. |
| 154 if (target_->output_type() != Target::SHARED_LIBRARY) |
| 155 return true; |
| 156 |
| 157 const Value* value = scope_->GetValue(variables::kLoadableModule, true); |
| 158 if (value) { |
| 159 if (!value->VerifyTypeIs(Value::BOOLEAN, err_)) |
| 160 return false; |
| 161 target_->set_loadable_module(value->boolean_value()); |
| 162 } |
| 163 return true; |
| 164 } |
OLD | NEW |