blob: 836a8a31df6957b7066ce6820731d8d470aa5c58 [file] [log] [blame]
Primiano Tucciae2879e2017-09-27 11:02:09 +09001# Copyright (C) 2017 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
Primiano Tucci7a40e4d2017-12-06 09:51:09 +000015import("//gn/standalone/libc++/libc++.gni")
Primiano Tucci0825bc82017-09-28 18:50:23 +010016
Primiano Tucci2a29ac72017-10-24 17:47:19 +010017# Mimimal config to be used in production (i.e. non-test) targets. This is
18# really just to allowing include "gtest/gtest_prod.h" for the FRIEND_TEST macro
19# and avoid to pull in warning suppressions that are not really necessary for
20# production code.
21config("googletest_prod_config") {
22 visibility = [ ":*" ]
23 include_dirs = [ "googletest/googletest/include" ]
24}
25
26# Config to include gtest.h in test targets.
Primiano Tucciae2879e2017-09-27 11:02:09 +090027config("googletest_config") {
28 visibility = [ ":*" ]
29 defines = [ "GTEST_LANG_CXX11=1" ]
30 include_dirs = [
31 "googletest/googletest/include",
32 "googletest/googlemock/include",
33 ]
34 cflags = [
Primiano Tucci13331342017-10-25 17:08:13 +010035 "-Wno-covered-switch-default",
Primiano Tucciae2879e2017-09-27 11:02:09 +090036 "-Wno-deprecated",
37 "-Wno-global-constructors",
Primiano Tuccice720022017-10-30 12:50:06 +000038 "-Wno-inconsistent-missing-override",
Primiano Tucciae2879e2017-09-27 11:02:09 +090039 "-Wno-missing-noreturn",
Primiano Tucci91cc11d2017-11-14 18:34:24 +000040 "-Wno-overloaded-virtual",
Primiano Tucciae2879e2017-09-27 11:02:09 +090041 "-Wno-shift-sign-overflow",
Primiano Tuccice720022017-10-30 12:50:06 +000042 "-Wno-sign-conversion",
Primiano Tucciae2879e2017-09-27 11:02:09 +090043 "-Wno-undef",
Primiano Tuccice720022017-10-30 12:50:06 +000044 "-Wno-unused-member-function",
Primiano Tucciae2879e2017-09-27 11:02:09 +090045 "-Wno-used-but-marked-unused",
Primiano Tuccifd484232017-10-25 00:15:39 +010046 "-Wno-zero-as-null-pointer-constant",
Primiano Tucciae2879e2017-09-27 11:02:09 +090047 ]
48}
49
50source_set("gtest") {
51 testonly = true
52 include_dirs = [ "googletest/googletest" ]
Primiano Tucci7a40e4d2017-12-06 09:51:09 +000053 configs -= [ "//gn/standalone:extra_warnings" ]
Primiano Tucciae2879e2017-09-27 11:02:09 +090054 public_configs = [ ":googletest_config" ]
55 all_dependent_configs = [ ":googletest_config" ]
56 sources = [
57 "googletest/googletest/src/gtest-all.cc",
58 ]
59}
60
61source_set("gtest_main") {
62 testonly = true
Primiano Tucci7a40e4d2017-12-06 09:51:09 +000063 configs -= [ "//gn/standalone:extra_warnings" ]
Primiano Tucciae2879e2017-09-27 11:02:09 +090064 configs += [ ":googletest_config" ]
65 sources = [
66 "googletest/googletest/src/gtest_main.cc",
67 ]
68}
69
70source_set("gmock") {
71 testonly = true
72 include_dirs = [ "googletest/googlemock" ]
Primiano Tucci7a40e4d2017-12-06 09:51:09 +000073 configs -= [ "//gn/standalone:extra_warnings" ]
Primiano Tucciae2879e2017-09-27 11:02:09 +090074 public_configs = [ ":googletest_config" ]
75 all_dependent_configs = [ ":googletest_config" ]
76 sources = [
77 "googletest/googlemock/src/gmock-all.cc",
78 ]
79}
80
Primiano Tuccifd484232017-10-25 00:15:39 +010081# This config is applied to the autogenerated .pb.{cc,h} files in
Primiano Tucci7a40e4d2017-12-06 09:51:09 +000082# //gn/standalone/proto_library.gni. This config is propagated up to the source sets
Primiano Tuccifd484232017-10-25 00:15:39 +010083# that depend on generated proto headers. Therefore this should stay as lean and
84# clean as possible in terms of -W-no* suppressions. Thankfully the
85# autogenerated .pb.h headers violate less warnings than the libprotobuf_*
86# library itself.
87config("protobuf_gen_config") {
Primiano Tucciae2879e2017-09-27 11:02:09 +090088 visibility = [ ":*" ]
89 defines = [
90 "GOOGLE_PROTOBUF_NO_RTTI",
91 "GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER",
Primiano Tucciae2879e2017-09-27 11:02:09 +090092 ]
Primiano Tuccifd484232017-10-25 00:15:39 +010093 include_dirs = [ "protobuf/src" ]
Primiano Tucciae2879e2017-09-27 11:02:09 +090094 cflags = [
95 "-Wno-deprecated",
Primiano Tuccifd484232017-10-25 00:15:39 +010096 "-Wno-disabled-macro-expansion",
Primiano Tuccid7d1be02017-10-30 17:41:34 +000097 "-Wno-int-to-void-pointer-cast",
Primiano Tuccifd484232017-10-25 00:15:39 +010098 "-Wno-missing-variable-declarations",
99 "-Wno-old-style-cast",
Primiano Tuccid7d1be02017-10-30 17:41:34 +0000100 "-Wno-shorten-64-to-32",
Primiano Tuccid7d1be02017-10-30 17:41:34 +0000101 "-Wno-sign-conversion",
102 "-Wno-undef",
Primiano Tuccifd484232017-10-25 00:15:39 +0100103 "-Wno-zero-as-null-pointer-constant",
104 ]
Oystein Eftevaag6eea3222017-12-08 16:58:42 -0800105
106 if (!is_clang) {
107 cflags += [
108 "-Wno-sign-compare",
109 "-Wno-maybe-uninitialized",
110 ]
111 }
Primiano Tuccifd484232017-10-25 00:15:39 +0100112}
113
114# Configuration used to build libprotobuf_* and the protoc compiler.
115config("protobuf_config") {
116 # Apply the lighter supressions and macro definitions from above.
117 configs = [ ":protobuf_gen_config" ]
118
119 visibility = [ ":*" ]
120 defines = [ "HAVE_PTHREAD=1" ]
121 cflags = [
122 "-Wno-ignored-qualifiers",
Primiano Tucciae2879e2017-09-27 11:02:09 +0900123 "-Wno-missing-noreturn",
124 "-Wno-undef",
Primiano Tucciae2879e2017-09-27 11:02:09 +0900125 "-Wno-unused-parameter",
126 "-Wno-unused",
Primiano Tucciae2879e2017-09-27 11:02:09 +0900127 ]
Hector Dearmanedb3beb2017-10-09 17:53:36 +0100128 if (is_clang) {
Primiano Tucciae2879e2017-09-27 11:02:09 +0900129 cflags += [
Primiano Tuccib60d4b02017-11-10 11:03:00 +0000130 "-Wno-enum-compare-switch",
Primiano Tucciae2879e2017-09-27 11:02:09 +0900131 "-Wno-global-constructors",
Primiano Tuccib60d4b02017-11-10 11:03:00 +0000132 "-Wno-shift-sign-overflow",
133 "-Wno-used-but-marked-unused",
134 "-Wno-user-defined-warnings",
Primiano Tucciae2879e2017-09-27 11:02:09 +0900135 ]
Hector Dearmanedb3beb2017-10-09 17:53:36 +0100136 } else {
137 cflags += [
138 "-Wno-misleading-indentation",
139 "-Wno-return-type",
140 ]
Primiano Tucciae2879e2017-09-27 11:02:09 +0900141 }
142}
143
144source_set("protobuf_lite") {
145 sources = [
146 "protobuf/src/google/protobuf/arena.cc",
147 "protobuf/src/google/protobuf/arenastring.cc",
148 "protobuf/src/google/protobuf/extension_set.cc",
149 "protobuf/src/google/protobuf/generated_message_util.cc",
150 "protobuf/src/google/protobuf/io/coded_stream.cc",
151 "protobuf/src/google/protobuf/io/zero_copy_stream.cc",
152 "protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.cc",
153 "protobuf/src/google/protobuf/message_lite.cc",
154 "protobuf/src/google/protobuf/repeated_field.cc",
155 "protobuf/src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc",
156 "protobuf/src/google/protobuf/stubs/atomicops_internals_x86_msvc.cc",
157 "protobuf/src/google/protobuf/stubs/bytestream.cc",
158 "protobuf/src/google/protobuf/stubs/common.cc",
159 "protobuf/src/google/protobuf/stubs/int128.cc",
160 "protobuf/src/google/protobuf/stubs/once.cc",
161 "protobuf/src/google/protobuf/stubs/status.cc",
162 "protobuf/src/google/protobuf/stubs/statusor.cc",
163 "protobuf/src/google/protobuf/stubs/stringpiece.cc",
164 "protobuf/src/google/protobuf/stubs/stringprintf.cc",
165 "protobuf/src/google/protobuf/stubs/structurally_valid.cc",
166 "protobuf/src/google/protobuf/stubs/strutil.cc",
167 "protobuf/src/google/protobuf/stubs/time.cc",
168 "protobuf/src/google/protobuf/wire_format_lite.cc",
169 ]
Primiano Tucci7a40e4d2017-12-06 09:51:09 +0000170 configs -= [ "//gn/standalone:extra_warnings" ]
Primiano Tucciae2879e2017-09-27 11:02:09 +0900171 public_configs = [ ":protobuf_config" ]
172}
173
174source_set("protobuf_full") {
Oystein Eftevaagdd727e42017-12-05 08:49:55 -0800175 deps = [
176 ":protobuf_lite",
177 ]
Primiano Tucciae2879e2017-09-27 11:02:09 +0900178 sources = [
179 "protobuf/src/google/protobuf/any.cc",
180 "protobuf/src/google/protobuf/any.pb.cc",
181 "protobuf/src/google/protobuf/api.pb.cc",
182 "protobuf/src/google/protobuf/compiler/importer.cc",
183 "protobuf/src/google/protobuf/compiler/parser.cc",
184 "protobuf/src/google/protobuf/descriptor.cc",
185 "protobuf/src/google/protobuf/descriptor.pb.cc",
186 "protobuf/src/google/protobuf/descriptor_database.cc",
187 "protobuf/src/google/protobuf/duration.pb.cc",
188 "protobuf/src/google/protobuf/dynamic_message.cc",
189 "protobuf/src/google/protobuf/empty.pb.cc",
190 "protobuf/src/google/protobuf/extension_set_heavy.cc",
191 "protobuf/src/google/protobuf/field_mask.pb.cc",
192 "protobuf/src/google/protobuf/generated_message_reflection.cc",
193 "protobuf/src/google/protobuf/io/gzip_stream.cc",
194 "protobuf/src/google/protobuf/io/printer.cc",
195 "protobuf/src/google/protobuf/io/strtod.cc",
196 "protobuf/src/google/protobuf/io/tokenizer.cc",
197 "protobuf/src/google/protobuf/io/zero_copy_stream_impl.cc",
198 "protobuf/src/google/protobuf/map_field.cc",
199 "protobuf/src/google/protobuf/message.cc",
200 "protobuf/src/google/protobuf/reflection_ops.cc",
201 "protobuf/src/google/protobuf/service.cc",
202 "protobuf/src/google/protobuf/source_context.pb.cc",
203 "protobuf/src/google/protobuf/struct.pb.cc",
204 "protobuf/src/google/protobuf/stubs/mathlimits.cc",
205 "protobuf/src/google/protobuf/stubs/substitute.cc",
206 "protobuf/src/google/protobuf/text_format.cc",
207 "protobuf/src/google/protobuf/timestamp.pb.cc",
208 "protobuf/src/google/protobuf/type.pb.cc",
209 "protobuf/src/google/protobuf/unknown_field_set.cc",
210 "protobuf/src/google/protobuf/util/field_comparator.cc",
211 "protobuf/src/google/protobuf/util/field_mask_util.cc",
212 "protobuf/src/google/protobuf/util/internal/datapiece.cc",
213 "protobuf/src/google/protobuf/util/internal/default_value_objectwriter.cc",
214 "protobuf/src/google/protobuf/util/internal/error_listener.cc",
215 "protobuf/src/google/protobuf/util/internal/field_mask_utility.cc",
216 "protobuf/src/google/protobuf/util/internal/json_escaping.cc",
217 "protobuf/src/google/protobuf/util/internal/json_objectwriter.cc",
218 "protobuf/src/google/protobuf/util/internal/json_stream_parser.cc",
219 "protobuf/src/google/protobuf/util/internal/object_writer.cc",
220 "protobuf/src/google/protobuf/util/internal/proto_writer.cc",
221 "protobuf/src/google/protobuf/util/internal/protostream_objectsource.cc",
222 "protobuf/src/google/protobuf/util/internal/protostream_objectwriter.cc",
223 "protobuf/src/google/protobuf/util/internal/type_info.cc",
224 "protobuf/src/google/protobuf/util/internal/type_info_test_helper.cc",
225 "protobuf/src/google/protobuf/util/internal/utility.cc",
226 "protobuf/src/google/protobuf/util/json_util.cc",
227 "protobuf/src/google/protobuf/util/message_differencer.cc",
228 "protobuf/src/google/protobuf/util/time_util.cc",
229 "protobuf/src/google/protobuf/util/type_resolver_util.cc",
230 "protobuf/src/google/protobuf/wire_format.cc",
231 "protobuf/src/google/protobuf/wrappers.pb.cc",
232 ]
Primiano Tucci7a40e4d2017-12-06 09:51:09 +0000233 configs -= [ "//gn/standalone:extra_warnings" ]
Primiano Tucciae2879e2017-09-27 11:02:09 +0900234 public_configs = [ ":protobuf_config" ]
235}
236
237if (current_toolchain == host_toolchain) {
Primiano Tuccifd484232017-10-25 00:15:39 +0100238 source_set("protoc_lib") {
Oystein Eftevaagdd727e42017-12-05 08:49:55 -0800239 deps = [
240 ":protobuf_full",
241 ]
Primiano Tucciae2879e2017-09-27 11:02:09 +0900242 sources = [
243 "protobuf/src/google/protobuf/compiler/code_generator.cc",
244 "protobuf/src/google/protobuf/compiler/command_line_interface.cc",
245 "protobuf/src/google/protobuf/compiler/cpp/cpp_enum.cc",
246 "protobuf/src/google/protobuf/compiler/cpp/cpp_enum_field.cc",
247 "protobuf/src/google/protobuf/compiler/cpp/cpp_extension.cc",
248 "protobuf/src/google/protobuf/compiler/cpp/cpp_field.cc",
249 "protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc",
250 "protobuf/src/google/protobuf/compiler/cpp/cpp_generator.cc",
251 "protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc",
252 "protobuf/src/google/protobuf/compiler/cpp/cpp_map_field.cc",
253 "protobuf/src/google/protobuf/compiler/cpp/cpp_message.cc",
254 "protobuf/src/google/protobuf/compiler/cpp/cpp_message_field.cc",
255 "protobuf/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc",
256 "protobuf/src/google/protobuf/compiler/cpp/cpp_service.cc",
257 "protobuf/src/google/protobuf/compiler/cpp/cpp_string_field.cc",
258 "protobuf/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc",
259 "protobuf/src/google/protobuf/compiler/csharp/csharp_enum.cc",
260 "protobuf/src/google/protobuf/compiler/csharp/csharp_enum_field.cc",
261 "protobuf/src/google/protobuf/compiler/csharp/csharp_field_base.cc",
262 "protobuf/src/google/protobuf/compiler/csharp/csharp_generator.cc",
263 "protobuf/src/google/protobuf/compiler/csharp/csharp_helpers.cc",
264 "protobuf/src/google/protobuf/compiler/csharp/csharp_map_field.cc",
265 "protobuf/src/google/protobuf/compiler/csharp/csharp_message.cc",
266 "protobuf/src/google/protobuf/compiler/csharp/csharp_message_field.cc",
267 "protobuf/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc",
268 "protobuf/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc",
269 "protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc",
270 "protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc",
271 "protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc",
272 "protobuf/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc",
273 "protobuf/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc",
274 "protobuf/src/google/protobuf/compiler/java/java_context.cc",
275 "protobuf/src/google/protobuf/compiler/java/java_doc_comment.cc",
276 "protobuf/src/google/protobuf/compiler/java/java_enum.cc",
277 "protobuf/src/google/protobuf/compiler/java/java_enum_field.cc",
278 "protobuf/src/google/protobuf/compiler/java/java_enum_field_lite.cc",
279 "protobuf/src/google/protobuf/compiler/java/java_enum_lite.cc",
280 "protobuf/src/google/protobuf/compiler/java/java_extension.cc",
281 "protobuf/src/google/protobuf/compiler/java/java_extension_lite.cc",
282 "protobuf/src/google/protobuf/compiler/java/java_field.cc",
283 "protobuf/src/google/protobuf/compiler/java/java_file.cc",
284 "protobuf/src/google/protobuf/compiler/java/java_generator.cc",
285 "protobuf/src/google/protobuf/compiler/java/java_generator_factory.cc",
286 "protobuf/src/google/protobuf/compiler/java/java_helpers.cc",
287 "protobuf/src/google/protobuf/compiler/java/java_lazy_message_field.cc",
288 "protobuf/src/google/protobuf/compiler/java/java_lazy_message_field_lite.cc",
289 "protobuf/src/google/protobuf/compiler/java/java_map_field.cc",
290 "protobuf/src/google/protobuf/compiler/java/java_map_field_lite.cc",
291 "protobuf/src/google/protobuf/compiler/java/java_message.cc",
292 "protobuf/src/google/protobuf/compiler/java/java_message_builder.cc",
293 "protobuf/src/google/protobuf/compiler/java/java_message_builder_lite.cc",
294 "protobuf/src/google/protobuf/compiler/java/java_message_field.cc",
295 "protobuf/src/google/protobuf/compiler/java/java_message_field_lite.cc",
296 "protobuf/src/google/protobuf/compiler/java/java_message_lite.cc",
297 "protobuf/src/google/protobuf/compiler/java/java_name_resolver.cc",
298 "protobuf/src/google/protobuf/compiler/java/java_primitive_field.cc",
299 "protobuf/src/google/protobuf/compiler/java/java_primitive_field_lite.cc",
300 "protobuf/src/google/protobuf/compiler/java/java_service.cc",
301 "protobuf/src/google/protobuf/compiler/java/java_shared_code_generator.cc",
302 "protobuf/src/google/protobuf/compiler/java/java_string_field.cc",
303 "protobuf/src/google/protobuf/compiler/java/java_string_field_lite.cc",
304 "protobuf/src/google/protobuf/compiler/javanano/javanano_enum.cc",
305 "protobuf/src/google/protobuf/compiler/javanano/javanano_enum_field.cc",
306 "protobuf/src/google/protobuf/compiler/javanano/javanano_extension.cc",
307 "protobuf/src/google/protobuf/compiler/javanano/javanano_field.cc",
308 "protobuf/src/google/protobuf/compiler/javanano/javanano_file.cc",
309 "protobuf/src/google/protobuf/compiler/javanano/javanano_generator.cc",
310 "protobuf/src/google/protobuf/compiler/javanano/javanano_helpers.cc",
311 "protobuf/src/google/protobuf/compiler/javanano/javanano_map_field.cc",
312 "protobuf/src/google/protobuf/compiler/javanano/javanano_message.cc",
313 "protobuf/src/google/protobuf/compiler/javanano/javanano_message_field.cc",
314 "protobuf/src/google/protobuf/compiler/javanano/javanano_primitive_field.cc",
315 "protobuf/src/google/protobuf/compiler/js/js_generator.cc",
Primiano Tucciae2879e2017-09-27 11:02:09 +0900316 "protobuf/src/google/protobuf/compiler/objectivec/objectivec_enum.cc",
317 "protobuf/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc",
318 "protobuf/src/google/protobuf/compiler/objectivec/objectivec_extension.cc",
319 "protobuf/src/google/protobuf/compiler/objectivec/objectivec_field.cc",
320 "protobuf/src/google/protobuf/compiler/objectivec/objectivec_file.cc",
321 "protobuf/src/google/protobuf/compiler/objectivec/objectivec_generator.cc",
322 "protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc",
323 "protobuf/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc",
324 "protobuf/src/google/protobuf/compiler/objectivec/objectivec_message.cc",
325 "protobuf/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc",
326 "protobuf/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc",
327 "protobuf/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc",
328 "protobuf/src/google/protobuf/compiler/plugin.cc",
329 "protobuf/src/google/protobuf/compiler/plugin.pb.cc",
330 "protobuf/src/google/protobuf/compiler/python/python_generator.cc",
331 "protobuf/src/google/protobuf/compiler/ruby/ruby_generator.cc",
332 "protobuf/src/google/protobuf/compiler/subprocess.cc",
333 "protobuf/src/google/protobuf/compiler/zip_writer.cc",
334 ]
Primiano Tucci7a40e4d2017-12-06 09:51:09 +0000335 configs -= [ "//gn/standalone:extra_warnings" ]
Primiano Tucciae2879e2017-09-27 11:02:09 +0900336 public_configs = [ ":protobuf_config" ]
337 }
Primiano Tuccifd484232017-10-25 00:15:39 +0100338
339 executable("protoc") {
Oystein Eftevaagdd727e42017-12-05 08:49:55 -0800340 deps = [
341 ":protoc_lib",
342 "../gn:default_deps",
343 ]
Primiano Tuccifd484232017-10-25 00:15:39 +0100344 sources = [
345 "protobuf/src/google/protobuf/compiler/main.cc",
346 ]
Primiano Tucci7a40e4d2017-12-06 09:51:09 +0000347 configs -= [ "//gn/standalone:extra_warnings" ]
Primiano Tuccifd484232017-10-25 00:15:39 +0100348 }
Primiano Tucciae2879e2017-09-27 11:02:09 +0900349} # host_toolchain
Primiano Tucci0825bc82017-09-28 18:50:23 +0100350
351if (use_custom_libcxx) {
352 # Config applied to both libc++ and libc++abi targets below.
353 config("libc++config") {
354 defines = [
355 "LIBCXX_BUILDING_LIBCXXABI",
356 "_LIBCXXABI_NO_EXCEPTIONS",
357 "_LIBCPP_OVERRIDABLE_FUNC_VIS=__attribute__((__visibility__(\"default\")))",
358 ]
359 cflags = [
360 "-fPIC",
361 "-fstrict-aliasing",
362 ]
363 }
364
Primiano Tucci7278dea2017-10-31 11:50:32 +0000365 source_set("libunwind") {
366 sources = [
367 "libunwind/src/Unwind-EHABI.cpp",
368 "libunwind/src/Unwind-sjlj.c",
369 "libunwind/src/UnwindLevel1-gcc-ext.c",
370 "libunwind/src/UnwindLevel1.c",
371 "libunwind/src/UnwindRegistersRestore.S",
372 "libunwind/src/UnwindRegistersSave.S",
373 "libunwind/src/libunwind.cpp",
374 ]
375 include_dirs = [ "libunwind/include" ]
376 configs -= [
Primiano Tucci7a40e4d2017-12-06 09:51:09 +0000377 "//gn/standalone:extra_warnings",
378 "//gn/standalone:no_exceptions",
379 "//gn/standalone:no_rtti",
Primiano Tucci7278dea2017-10-31 11:50:32 +0000380
381 # When building with msan, libunwind itself triggers memory violations
382 # that causes msan to get stuck into an infinite loop. Just don't
383 # instrument libunwind itself.
Primiano Tucci7a40e4d2017-12-06 09:51:09 +0000384 "//gn/standalone/sanitizers:sanitizers_cflags",
Primiano Tucci7278dea2017-10-31 11:50:32 +0000385 ]
386 configs += [
387 ":libc++config",
Primiano Tucci7a40e4d2017-12-06 09:51:09 +0000388 "//gn/standalone/sanitizers:sanitizer_options_link_helper",
Primiano Tucci7278dea2017-10-31 11:50:32 +0000389 ]
390 }
391
Primiano Tucci0825bc82017-09-28 18:50:23 +0100392 source_set("libc++abi") {
393 sources = [
394 "libcxxabi/src/abort_message.cpp",
395 "libcxxabi/src/cxa_aux_runtime.cpp",
396 "libcxxabi/src/cxa_default_handlers.cpp",
397 "libcxxabi/src/cxa_demangle.cpp",
398 "libcxxabi/src/cxa_exception.cpp",
399 "libcxxabi/src/cxa_exception_storage.cpp",
400 "libcxxabi/src/cxa_guard.cpp",
401 "libcxxabi/src/cxa_handlers.cpp",
402 "libcxxabi/src/cxa_personality.cpp",
403 "libcxxabi/src/cxa_unexpected.cpp",
404 "libcxxabi/src/cxa_vector.cpp",
405 "libcxxabi/src/cxa_virtual.cpp",
406 "libcxxabi/src/fallback_malloc.cpp",
407 "libcxxabi/src/private_typeinfo.cpp",
408 "libcxxabi/src/stdlib_exception.cpp",
409 "libcxxabi/src/stdlib_stdexcept.cpp",
410 "libcxxabi/src/stdlib_typeinfo.cpp",
411 ]
412
413 # On linux this seems to introduce an unwanted glibc 2.18 dependency.
414 if (is_android) {
415 sources += [ "libcxxabi/src/cxa_thread_atexit.cpp" ]
416 }
417 configs -= [
Primiano Tucci7a40e4d2017-12-06 09:51:09 +0000418 "//gn/standalone:extra_warnings",
419 "//gn/standalone:no_exceptions",
420 "//gn/standalone:no_rtti",
Primiano Tucci5aab7582017-12-07 12:22:03 +0000421 "//gn/standalone:visibility_hidden",
Primiano Tucci0825bc82017-09-28 18:50:23 +0100422 ]
423 configs += [
424 ":libc++config",
Primiano Tucci7a40e4d2017-12-06 09:51:09 +0000425 "//gn/standalone/sanitizers:sanitizer_options_link_helper",
Primiano Tucci0825bc82017-09-28 18:50:23 +0100426 ]
Oystein Eftevaagdd727e42017-12-05 08:49:55 -0800427 deps = [
428 ":libunwind",
429 ]
Primiano Tucci0825bc82017-09-28 18:50:23 +0100430 }
431
Primiano Tucci7278dea2017-10-31 11:50:32 +0000432 if (custom_libcxx_is_static) {
433 libcxx_target_type = "source_set"
434 } else {
435 libcxx_target_type = "shared_library"
436 }
437
438 target(libcxx_target_type, "libc++") {
Primiano Tucci0825bc82017-09-28 18:50:23 +0100439 sources = [
440 "libcxx/src/algorithm.cpp",
441 "libcxx/src/any.cpp",
442 "libcxx/src/bind.cpp",
443 "libcxx/src/chrono.cpp",
444 "libcxx/src/condition_variable.cpp",
445 "libcxx/src/debug.cpp",
446 "libcxx/src/exception.cpp",
447 "libcxx/src/functional.cpp",
448 "libcxx/src/future.cpp",
449 "libcxx/src/hash.cpp",
450 "libcxx/src/ios.cpp",
451 "libcxx/src/iostream.cpp",
452 "libcxx/src/locale.cpp",
453 "libcxx/src/memory.cpp",
454 "libcxx/src/mutex.cpp",
455 "libcxx/src/new.cpp",
456 "libcxx/src/optional.cpp",
457 "libcxx/src/random.cpp",
458 "libcxx/src/regex.cpp",
459 "libcxx/src/shared_mutex.cpp",
460 "libcxx/src/stdexcept.cpp",
461 "libcxx/src/string.cpp",
462 "libcxx/src/strstream.cpp",
463 "libcxx/src/system_error.cpp",
464 "libcxx/src/thread.cpp",
465 "libcxx/src/typeinfo.cpp",
466 "libcxx/src/utility.cpp",
467 "libcxx/src/valarray.cpp",
468 "libcxx/src/variant.cpp",
469 ]
470 configs -= [
Primiano Tucci7a40e4d2017-12-06 09:51:09 +0000471 "//gn/standalone:extra_warnings",
472 "//gn/standalone:no_exceptions",
473 "//gn/standalone:no_rtti",
Primiano Tucci5aab7582017-12-07 12:22:03 +0000474 "//gn/standalone:visibility_hidden",
Primiano Tucci0825bc82017-09-28 18:50:23 +0100475 ]
476 configs += [
477 ":libc++config",
Primiano Tucci7a40e4d2017-12-06 09:51:09 +0000478 "//gn/standalone/sanitizers:sanitizer_options_link_helper",
Primiano Tucci0825bc82017-09-28 18:50:23 +0100479 ]
480 defines = [ "_LIBCPP_BUILDING_LIBRARY" ]
Oystein Eftevaagdd727e42017-12-05 08:49:55 -0800481 deps = [
482 ":libc++abi",
483 ]
Primiano Tucci0825bc82017-09-28 18:50:23 +0100484 }
485} # if (use_custom_libcxx)
Hector Dearman88a10112017-10-12 11:07:10 +0100486
487config("benchmark_config") {
488 visibility = [ ":*" ]
Primiano Tucci2a29ac72017-10-24 17:47:19 +0100489 include_dirs = [ "benchmark/include" ]
Hector Dearman88a10112017-10-12 11:07:10 +0100490 cflags = [
491 "-Wno-global-constructors",
492 "-Wno-covered-switch-default",
Lalit Magantic99d93c2018-03-22 15:09:30 +0000493 "-Wno-used-but-marked-unused",
Hector Dearman88a10112017-10-12 11:07:10 +0100494 ]
495}
496
497source_set("benchmark") {
498 testonly = true
499 sources = [
500 "benchmark/include/benchmark/benchmark.h",
501 "benchmark/include/benchmark/benchmark_api.h",
502 "benchmark/include/benchmark/reporter.h",
503 "benchmark/src/arraysize.h",
504 "benchmark/src/benchmark.cc",
505 "benchmark/src/benchmark_api_internal.h",
506 "benchmark/src/benchmark_register.cc",
507 "benchmark/src/check.h",
508 "benchmark/src/colorprint.cc",
509 "benchmark/src/colorprint.h",
510 "benchmark/src/commandlineflags.cc",
511 "benchmark/src/commandlineflags.h",
512 "benchmark/src/complexity.cc",
513 "benchmark/src/complexity.h",
514 "benchmark/src/console_reporter.cc",
515 "benchmark/src/counter.cc",
516 "benchmark/src/counter.h",
517 "benchmark/src/csv_reporter.cc",
518 "benchmark/src/cycleclock.h",
519 "benchmark/src/internal_macros.h",
520 "benchmark/src/json_reporter.cc",
521 "benchmark/src/log.h",
522 "benchmark/src/mutex.h",
523 "benchmark/src/re.h",
524 "benchmark/src/reporter.cc",
525 "benchmark/src/sleep.cc",
526 "benchmark/src/sleep.h",
Lalit Magantic99d93c2018-03-22 15:09:30 +0000527 "benchmark/src/statistics.cc",
528 "benchmark/src/statistics.h",
Hector Dearman88a10112017-10-12 11:07:10 +0100529 "benchmark/src/string_util.cc",
530 "benchmark/src/string_util.h",
531 "benchmark/src/sysinfo.cc",
532 "benchmark/src/sysinfo.h",
533 "benchmark/src/timers.cc",
534 "benchmark/src/timers.h",
535 ]
536 defines = [ "HAVE_POSIX_REGEX" ]
537 public_configs = [ ":benchmark_config" ]
538 all_dependent_configs = [ ":benchmark_config" ]
Primiano Tucci7a40e4d2017-12-06 09:51:09 +0000539 configs -= [ "//gn/standalone:extra_warnings" ]
Hector Dearman88a10112017-10-12 11:07:10 +0100540}
Primiano Tucci38faa6f2018-04-01 20:12:08 +0200541
542# On Linux/Android use libbacktrace in debug builds for better stacktraces.
543if (is_linux || is_android) {
544 config("libbacktrace_config") {
545 visibility = [ ":*" ]
546 include_dirs = [
547 "libbacktrace_config",
548 "libbacktrace",
549 ]
550 cflags = [
551 "-include",
552 rebase_path("libbacktrace_config/config.h", root_build_dir),
553 ]
554 }
555
556 source_set("libbacktrace") {
557 sources = [
558 "libbacktrace/backtrace.c",
559 "libbacktrace/dwarf.c",
560 "libbacktrace/elf.c",
561 "libbacktrace/fileline.c",
562 "libbacktrace/mmap.c",
563 "libbacktrace/mmapio.c",
564 "libbacktrace/posix.c",
565 "libbacktrace/print.c",
566 "libbacktrace/simple.c",
567 "libbacktrace/sort.c",
568 "libbacktrace/state.c",
569 ]
570 configs -= [ "//gn/standalone:extra_warnings" ]
571 public_configs = [ ":libbacktrace_config" ]
572 }
573}