blob: 347fed015c9b40c8acf03e398fb61cccb56ea626 [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 Tucci3cbb10a2018-04-10 17:52:40 +010017# Used to suppress warnings coming from googletest macros expansions.
18config("test_warning_suppressions") {
19 cflags = [
20 "-Wno-unknown-warning-option",
21 "-Wno-global-constructors",
22 "-Wno-covered-switch-default",
23 "-Wno-used-but-marked-unused",
24 "-Wno-covered-switch-default",
25 "-Wno-global-constructors",
26 "-Wno-used-but-marked-unused",
27 "-Wno-inconsistent-missing-override",
28 "-Wno-unused-member-function",
29 "-Wno-zero-as-null-pointer-constant",
30 "-Wno-weak-vtables",
31 ]
32}
33
Primiano Tucci2a29ac72017-10-24 17:47:19 +010034# Mimimal config to be used in production (i.e. non-test) targets. This is
35# really just to allowing include "gtest/gtest_prod.h" for the FRIEND_TEST macro
36# and avoid to pull in warning suppressions that are not really necessary for
37# production code.
38config("googletest_prod_config") {
Primiano Tucci3cbb10a2018-04-10 17:52:40 +010039 cflags = [
40 # Using -isystem instead of include_dirs (-I), so we don't need to suppress
41 # warnings coming from libprotobuf headers. Doing so would mask warnings in
42 # our own code.
43 "-isystem",
44 rebase_path("googletest/googletest/include", root_build_dir),
45 ]
Primiano Tucci2a29ac72017-10-24 17:47:19 +010046}
47
48# Config to include gtest.h in test targets.
Primiano Tucciae2879e2017-09-27 11:02:09 +090049config("googletest_config") {
Primiano Tucciae2879e2017-09-27 11:02:09 +090050 defines = [ "GTEST_LANG_CXX11=1" ]
Primiano Tucciae2879e2017-09-27 11:02:09 +090051 cflags = [
Primiano Tucci3cbb10a2018-04-10 17:52:40 +010052 # Using -isystem instead of include_dirs (-I), so we don't need to suppress
53 # warnings coming from libprotobuf headers. Doing so would mask warnings in
54 # our own code.
55 "-isystem",
56 rebase_path("googletest/googletest/include", root_build_dir),
57 "-isystem",
58 rebase_path("googletest/googlemock/include", root_build_dir),
Primiano Tucciae2879e2017-09-27 11:02:09 +090059 ]
Primiano Tucci3cbb10a2018-04-10 17:52:40 +010060 configs = [ ":test_warning_suppressions" ]
Primiano Tucciae2879e2017-09-27 11:02:09 +090061}
62
63source_set("gtest") {
64 testonly = true
65 include_dirs = [ "googletest/googletest" ]
Primiano Tucci7a40e4d2017-12-06 09:51:09 +000066 configs -= [ "//gn/standalone:extra_warnings" ]
Primiano Tucciae2879e2017-09-27 11:02:09 +090067 public_configs = [ ":googletest_config" ]
68 all_dependent_configs = [ ":googletest_config" ]
69 sources = [
70 "googletest/googletest/src/gtest-all.cc",
71 ]
72}
73
74source_set("gtest_main") {
75 testonly = true
Primiano Tucci7a40e4d2017-12-06 09:51:09 +000076 configs -= [ "//gn/standalone:extra_warnings" ]
Primiano Tucciae2879e2017-09-27 11:02:09 +090077 configs += [ ":googletest_config" ]
78 sources = [
79 "googletest/googletest/src/gtest_main.cc",
80 ]
81}
82
83source_set("gmock") {
84 testonly = true
85 include_dirs = [ "googletest/googlemock" ]
Primiano Tucci7a40e4d2017-12-06 09:51:09 +000086 configs -= [ "//gn/standalone:extra_warnings" ]
Primiano Tucciae2879e2017-09-27 11:02:09 +090087 public_configs = [ ":googletest_config" ]
88 all_dependent_configs = [ ":googletest_config" ]
89 sources = [
90 "googletest/googlemock/src/gmock-all.cc",
91 ]
92}
93
Primiano Tuccifd484232017-10-25 00:15:39 +010094# This config is applied to the autogenerated .pb.{cc,h} files in
Primiano Tucci7a40e4d2017-12-06 09:51:09 +000095# //gn/standalone/proto_library.gni. This config is propagated up to the source sets
Primiano Tuccifd484232017-10-25 00:15:39 +010096# that depend on generated proto headers. Therefore this should stay as lean and
97# clean as possible in terms of -W-no* suppressions. Thankfully the
98# autogenerated .pb.h headers violate less warnings than the libprotobuf_*
99# library itself.
100config("protobuf_gen_config") {
Primiano Tucciae2879e2017-09-27 11:02:09 +0900101 defines = [
102 "GOOGLE_PROTOBUF_NO_RTTI",
103 "GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER",
Primiano Tucciae2879e2017-09-27 11:02:09 +0900104 ]
Primiano Tucciae2879e2017-09-27 11:02:09 +0900105 cflags = [
Primiano Tucci3cbb10a2018-04-10 17:52:40 +0100106 # Using -isystem instead of include_dirs (-I), so we don't need to suppress
107 # warnings coming from libprotobuf headers. Doing so would mask warnings in
108 # our own code.
109 "-isystem",
110 rebase_path("protobuf/src", root_build_dir),
111 "-Wno-unknown-warning-option",
Primiano Tucciae2879e2017-09-27 11:02:09 +0900112 "-Wno-deprecated",
Primiano Tuccid7d1be02017-10-30 17:41:34 +0000113 "-Wno-undef",
Primiano Tuccifd484232017-10-25 00:15:39 +0100114 "-Wno-zero-as-null-pointer-constant",
115 ]
Primiano Tuccifd484232017-10-25 00:15:39 +0100116}
117
118# Configuration used to build libprotobuf_* and the protoc compiler.
119config("protobuf_config") {
120 # Apply the lighter supressions and macro definitions from above.
121 configs = [ ":protobuf_gen_config" ]
122
Primiano Tuccifd484232017-10-25 00:15:39 +0100123 defines = [ "HAVE_PTHREAD=1" ]
Hector Dearmanedb3beb2017-10-09 17:53:36 +0100124 if (is_clang) {
Primiano Tucci3cbb10a2018-04-10 17:52:40 +0100125 cflags = [
126 "-Wno-unknown-warning-option",
Primiano Tuccib60d4b02017-11-10 11:03:00 +0000127 "-Wno-enum-compare-switch",
Primiano Tuccib60d4b02017-11-10 11:03:00 +0000128 "-Wno-user-defined-warnings",
Primiano Tucciae2879e2017-09-27 11:02:09 +0900129 ]
130 }
131}
132
133source_set("protobuf_lite") {
134 sources = [
135 "protobuf/src/google/protobuf/arena.cc",
136 "protobuf/src/google/protobuf/arenastring.cc",
137 "protobuf/src/google/protobuf/extension_set.cc",
138 "protobuf/src/google/protobuf/generated_message_util.cc",
139 "protobuf/src/google/protobuf/io/coded_stream.cc",
140 "protobuf/src/google/protobuf/io/zero_copy_stream.cc",
141 "protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.cc",
142 "protobuf/src/google/protobuf/message_lite.cc",
143 "protobuf/src/google/protobuf/repeated_field.cc",
144 "protobuf/src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc",
145 "protobuf/src/google/protobuf/stubs/atomicops_internals_x86_msvc.cc",
146 "protobuf/src/google/protobuf/stubs/bytestream.cc",
147 "protobuf/src/google/protobuf/stubs/common.cc",
148 "protobuf/src/google/protobuf/stubs/int128.cc",
149 "protobuf/src/google/protobuf/stubs/once.cc",
150 "protobuf/src/google/protobuf/stubs/status.cc",
151 "protobuf/src/google/protobuf/stubs/statusor.cc",
152 "protobuf/src/google/protobuf/stubs/stringpiece.cc",
153 "protobuf/src/google/protobuf/stubs/stringprintf.cc",
154 "protobuf/src/google/protobuf/stubs/structurally_valid.cc",
155 "protobuf/src/google/protobuf/stubs/strutil.cc",
156 "protobuf/src/google/protobuf/stubs/time.cc",
157 "protobuf/src/google/protobuf/wire_format_lite.cc",
158 ]
Primiano Tucci7a40e4d2017-12-06 09:51:09 +0000159 configs -= [ "//gn/standalone:extra_warnings" ]
Primiano Tucci3cbb10a2018-04-10 17:52:40 +0100160 configs += [ ":protobuf_config" ]
161 public_configs = [ ":protobuf_gen_config" ]
Primiano Tucciae2879e2017-09-27 11:02:09 +0900162}
163
164source_set("protobuf_full") {
Oystein Eftevaagdd727e42017-12-05 08:49:55 -0800165 deps = [
166 ":protobuf_lite",
167 ]
Primiano Tucciae2879e2017-09-27 11:02:09 +0900168 sources = [
169 "protobuf/src/google/protobuf/any.cc",
170 "protobuf/src/google/protobuf/any.pb.cc",
171 "protobuf/src/google/protobuf/api.pb.cc",
172 "protobuf/src/google/protobuf/compiler/importer.cc",
173 "protobuf/src/google/protobuf/compiler/parser.cc",
174 "protobuf/src/google/protobuf/descriptor.cc",
175 "protobuf/src/google/protobuf/descriptor.pb.cc",
176 "protobuf/src/google/protobuf/descriptor_database.cc",
177 "protobuf/src/google/protobuf/duration.pb.cc",
178 "protobuf/src/google/protobuf/dynamic_message.cc",
179 "protobuf/src/google/protobuf/empty.pb.cc",
180 "protobuf/src/google/protobuf/extension_set_heavy.cc",
181 "protobuf/src/google/protobuf/field_mask.pb.cc",
182 "protobuf/src/google/protobuf/generated_message_reflection.cc",
183 "protobuf/src/google/protobuf/io/gzip_stream.cc",
184 "protobuf/src/google/protobuf/io/printer.cc",
185 "protobuf/src/google/protobuf/io/strtod.cc",
186 "protobuf/src/google/protobuf/io/tokenizer.cc",
187 "protobuf/src/google/protobuf/io/zero_copy_stream_impl.cc",
188 "protobuf/src/google/protobuf/map_field.cc",
189 "protobuf/src/google/protobuf/message.cc",
190 "protobuf/src/google/protobuf/reflection_ops.cc",
191 "protobuf/src/google/protobuf/service.cc",
192 "protobuf/src/google/protobuf/source_context.pb.cc",
193 "protobuf/src/google/protobuf/struct.pb.cc",
194 "protobuf/src/google/protobuf/stubs/mathlimits.cc",
195 "protobuf/src/google/protobuf/stubs/substitute.cc",
196 "protobuf/src/google/protobuf/text_format.cc",
197 "protobuf/src/google/protobuf/timestamp.pb.cc",
198 "protobuf/src/google/protobuf/type.pb.cc",
199 "protobuf/src/google/protobuf/unknown_field_set.cc",
200 "protobuf/src/google/protobuf/util/field_comparator.cc",
201 "protobuf/src/google/protobuf/util/field_mask_util.cc",
202 "protobuf/src/google/protobuf/util/internal/datapiece.cc",
203 "protobuf/src/google/protobuf/util/internal/default_value_objectwriter.cc",
204 "protobuf/src/google/protobuf/util/internal/error_listener.cc",
205 "protobuf/src/google/protobuf/util/internal/field_mask_utility.cc",
206 "protobuf/src/google/protobuf/util/internal/json_escaping.cc",
207 "protobuf/src/google/protobuf/util/internal/json_objectwriter.cc",
208 "protobuf/src/google/protobuf/util/internal/json_stream_parser.cc",
209 "protobuf/src/google/protobuf/util/internal/object_writer.cc",
210 "protobuf/src/google/protobuf/util/internal/proto_writer.cc",
211 "protobuf/src/google/protobuf/util/internal/protostream_objectsource.cc",
212 "protobuf/src/google/protobuf/util/internal/protostream_objectwriter.cc",
213 "protobuf/src/google/protobuf/util/internal/type_info.cc",
214 "protobuf/src/google/protobuf/util/internal/type_info_test_helper.cc",
215 "protobuf/src/google/protobuf/util/internal/utility.cc",
216 "protobuf/src/google/protobuf/util/json_util.cc",
217 "protobuf/src/google/protobuf/util/message_differencer.cc",
218 "protobuf/src/google/protobuf/util/time_util.cc",
219 "protobuf/src/google/protobuf/util/type_resolver_util.cc",
220 "protobuf/src/google/protobuf/wire_format.cc",
221 "protobuf/src/google/protobuf/wrappers.pb.cc",
222 ]
Primiano Tucci7a40e4d2017-12-06 09:51:09 +0000223 configs -= [ "//gn/standalone:extra_warnings" ]
Primiano Tucci3cbb10a2018-04-10 17:52:40 +0100224 configs += [ ":protobuf_config" ]
225 public_configs = [ ":protobuf_gen_config" ]
Primiano Tucciae2879e2017-09-27 11:02:09 +0900226}
227
228if (current_toolchain == host_toolchain) {
Primiano Tuccifd484232017-10-25 00:15:39 +0100229 source_set("protoc_lib") {
Oystein Eftevaagdd727e42017-12-05 08:49:55 -0800230 deps = [
231 ":protobuf_full",
232 ]
Primiano Tucciae2879e2017-09-27 11:02:09 +0900233 sources = [
234 "protobuf/src/google/protobuf/compiler/code_generator.cc",
235 "protobuf/src/google/protobuf/compiler/command_line_interface.cc",
236 "protobuf/src/google/protobuf/compiler/cpp/cpp_enum.cc",
237 "protobuf/src/google/protobuf/compiler/cpp/cpp_enum_field.cc",
238 "protobuf/src/google/protobuf/compiler/cpp/cpp_extension.cc",
239 "protobuf/src/google/protobuf/compiler/cpp/cpp_field.cc",
240 "protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc",
241 "protobuf/src/google/protobuf/compiler/cpp/cpp_generator.cc",
242 "protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc",
243 "protobuf/src/google/protobuf/compiler/cpp/cpp_map_field.cc",
244 "protobuf/src/google/protobuf/compiler/cpp/cpp_message.cc",
245 "protobuf/src/google/protobuf/compiler/cpp/cpp_message_field.cc",
246 "protobuf/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc",
247 "protobuf/src/google/protobuf/compiler/cpp/cpp_service.cc",
248 "protobuf/src/google/protobuf/compiler/cpp/cpp_string_field.cc",
249 "protobuf/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc",
250 "protobuf/src/google/protobuf/compiler/csharp/csharp_enum.cc",
251 "protobuf/src/google/protobuf/compiler/csharp/csharp_enum_field.cc",
252 "protobuf/src/google/protobuf/compiler/csharp/csharp_field_base.cc",
253 "protobuf/src/google/protobuf/compiler/csharp/csharp_generator.cc",
254 "protobuf/src/google/protobuf/compiler/csharp/csharp_helpers.cc",
255 "protobuf/src/google/protobuf/compiler/csharp/csharp_map_field.cc",
256 "protobuf/src/google/protobuf/compiler/csharp/csharp_message.cc",
257 "protobuf/src/google/protobuf/compiler/csharp/csharp_message_field.cc",
258 "protobuf/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc",
259 "protobuf/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc",
260 "protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc",
261 "protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc",
262 "protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc",
263 "protobuf/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc",
264 "protobuf/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc",
265 "protobuf/src/google/protobuf/compiler/java/java_context.cc",
266 "protobuf/src/google/protobuf/compiler/java/java_doc_comment.cc",
267 "protobuf/src/google/protobuf/compiler/java/java_enum.cc",
268 "protobuf/src/google/protobuf/compiler/java/java_enum_field.cc",
269 "protobuf/src/google/protobuf/compiler/java/java_enum_field_lite.cc",
270 "protobuf/src/google/protobuf/compiler/java/java_enum_lite.cc",
271 "protobuf/src/google/protobuf/compiler/java/java_extension.cc",
272 "protobuf/src/google/protobuf/compiler/java/java_extension_lite.cc",
273 "protobuf/src/google/protobuf/compiler/java/java_field.cc",
274 "protobuf/src/google/protobuf/compiler/java/java_file.cc",
275 "protobuf/src/google/protobuf/compiler/java/java_generator.cc",
276 "protobuf/src/google/protobuf/compiler/java/java_generator_factory.cc",
277 "protobuf/src/google/protobuf/compiler/java/java_helpers.cc",
278 "protobuf/src/google/protobuf/compiler/java/java_lazy_message_field.cc",
279 "protobuf/src/google/protobuf/compiler/java/java_lazy_message_field_lite.cc",
280 "protobuf/src/google/protobuf/compiler/java/java_map_field.cc",
281 "protobuf/src/google/protobuf/compiler/java/java_map_field_lite.cc",
282 "protobuf/src/google/protobuf/compiler/java/java_message.cc",
283 "protobuf/src/google/protobuf/compiler/java/java_message_builder.cc",
284 "protobuf/src/google/protobuf/compiler/java/java_message_builder_lite.cc",
285 "protobuf/src/google/protobuf/compiler/java/java_message_field.cc",
286 "protobuf/src/google/protobuf/compiler/java/java_message_field_lite.cc",
287 "protobuf/src/google/protobuf/compiler/java/java_message_lite.cc",
288 "protobuf/src/google/protobuf/compiler/java/java_name_resolver.cc",
289 "protobuf/src/google/protobuf/compiler/java/java_primitive_field.cc",
290 "protobuf/src/google/protobuf/compiler/java/java_primitive_field_lite.cc",
291 "protobuf/src/google/protobuf/compiler/java/java_service.cc",
292 "protobuf/src/google/protobuf/compiler/java/java_shared_code_generator.cc",
293 "protobuf/src/google/protobuf/compiler/java/java_string_field.cc",
294 "protobuf/src/google/protobuf/compiler/java/java_string_field_lite.cc",
295 "protobuf/src/google/protobuf/compiler/javanano/javanano_enum.cc",
296 "protobuf/src/google/protobuf/compiler/javanano/javanano_enum_field.cc",
297 "protobuf/src/google/protobuf/compiler/javanano/javanano_extension.cc",
298 "protobuf/src/google/protobuf/compiler/javanano/javanano_field.cc",
299 "protobuf/src/google/protobuf/compiler/javanano/javanano_file.cc",
300 "protobuf/src/google/protobuf/compiler/javanano/javanano_generator.cc",
301 "protobuf/src/google/protobuf/compiler/javanano/javanano_helpers.cc",
302 "protobuf/src/google/protobuf/compiler/javanano/javanano_map_field.cc",
303 "protobuf/src/google/protobuf/compiler/javanano/javanano_message.cc",
304 "protobuf/src/google/protobuf/compiler/javanano/javanano_message_field.cc",
305 "protobuf/src/google/protobuf/compiler/javanano/javanano_primitive_field.cc",
306 "protobuf/src/google/protobuf/compiler/js/js_generator.cc",
Primiano Tucciae2879e2017-09-27 11:02:09 +0900307 "protobuf/src/google/protobuf/compiler/objectivec/objectivec_enum.cc",
308 "protobuf/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc",
309 "protobuf/src/google/protobuf/compiler/objectivec/objectivec_extension.cc",
310 "protobuf/src/google/protobuf/compiler/objectivec/objectivec_field.cc",
311 "protobuf/src/google/protobuf/compiler/objectivec/objectivec_file.cc",
312 "protobuf/src/google/protobuf/compiler/objectivec/objectivec_generator.cc",
313 "protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc",
314 "protobuf/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc",
315 "protobuf/src/google/protobuf/compiler/objectivec/objectivec_message.cc",
316 "protobuf/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc",
317 "protobuf/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc",
318 "protobuf/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc",
319 "protobuf/src/google/protobuf/compiler/plugin.cc",
320 "protobuf/src/google/protobuf/compiler/plugin.pb.cc",
321 "protobuf/src/google/protobuf/compiler/python/python_generator.cc",
322 "protobuf/src/google/protobuf/compiler/ruby/ruby_generator.cc",
323 "protobuf/src/google/protobuf/compiler/subprocess.cc",
324 "protobuf/src/google/protobuf/compiler/zip_writer.cc",
325 ]
Primiano Tucci7a40e4d2017-12-06 09:51:09 +0000326 configs -= [ "//gn/standalone:extra_warnings" ]
Primiano Tucci3cbb10a2018-04-10 17:52:40 +0100327 configs += [ ":protobuf_config" ]
328 public_configs = [ ":protobuf_gen_config" ]
Primiano Tucciae2879e2017-09-27 11:02:09 +0900329 }
Primiano Tuccifd484232017-10-25 00:15:39 +0100330
331 executable("protoc") {
Oystein Eftevaagdd727e42017-12-05 08:49:55 -0800332 deps = [
333 ":protoc_lib",
Primiano Tucci3cbb10a2018-04-10 17:52:40 +0100334 "//gn:default_deps",
Oystein Eftevaagdd727e42017-12-05 08:49:55 -0800335 ]
Primiano Tuccifd484232017-10-25 00:15:39 +0100336 sources = [
337 "protobuf/src/google/protobuf/compiler/main.cc",
338 ]
Primiano Tucci7a40e4d2017-12-06 09:51:09 +0000339 configs -= [ "//gn/standalone:extra_warnings" ]
Primiano Tuccifd484232017-10-25 00:15:39 +0100340 }
Primiano Tucciae2879e2017-09-27 11:02:09 +0900341} # host_toolchain
Primiano Tucci0825bc82017-09-28 18:50:23 +0100342
343if (use_custom_libcxx) {
344 # Config applied to both libc++ and libc++abi targets below.
345 config("libc++config") {
346 defines = [
347 "LIBCXX_BUILDING_LIBCXXABI",
348 "_LIBCXXABI_NO_EXCEPTIONS",
349 "_LIBCPP_OVERRIDABLE_FUNC_VIS=__attribute__((__visibility__(\"default\")))",
350 ]
351 cflags = [
352 "-fPIC",
353 "-fstrict-aliasing",
354 ]
355 }
356
Primiano Tucci7278dea2017-10-31 11:50:32 +0000357 source_set("libunwind") {
358 sources = [
359 "libunwind/src/Unwind-EHABI.cpp",
360 "libunwind/src/Unwind-sjlj.c",
361 "libunwind/src/UnwindLevel1-gcc-ext.c",
362 "libunwind/src/UnwindLevel1.c",
363 "libunwind/src/UnwindRegistersRestore.S",
364 "libunwind/src/UnwindRegistersSave.S",
365 "libunwind/src/libunwind.cpp",
366 ]
367 include_dirs = [ "libunwind/include" ]
368 configs -= [
Primiano Tucci7a40e4d2017-12-06 09:51:09 +0000369 "//gn/standalone:extra_warnings",
370 "//gn/standalone:no_exceptions",
371 "//gn/standalone:no_rtti",
Primiano Tucci7278dea2017-10-31 11:50:32 +0000372
373 # When building with msan, libunwind itself triggers memory violations
374 # that causes msan to get stuck into an infinite loop. Just don't
375 # instrument libunwind itself.
Primiano Tucci7a40e4d2017-12-06 09:51:09 +0000376 "//gn/standalone/sanitizers:sanitizers_cflags",
Primiano Tucci7278dea2017-10-31 11:50:32 +0000377 ]
378 configs += [
379 ":libc++config",
Primiano Tucci7a40e4d2017-12-06 09:51:09 +0000380 "//gn/standalone/sanitizers:sanitizer_options_link_helper",
Primiano Tucci7278dea2017-10-31 11:50:32 +0000381 ]
382 }
383
Primiano Tucci0825bc82017-09-28 18:50:23 +0100384 source_set("libc++abi") {
385 sources = [
386 "libcxxabi/src/abort_message.cpp",
387 "libcxxabi/src/cxa_aux_runtime.cpp",
388 "libcxxabi/src/cxa_default_handlers.cpp",
389 "libcxxabi/src/cxa_demangle.cpp",
390 "libcxxabi/src/cxa_exception.cpp",
391 "libcxxabi/src/cxa_exception_storage.cpp",
392 "libcxxabi/src/cxa_guard.cpp",
393 "libcxxabi/src/cxa_handlers.cpp",
394 "libcxxabi/src/cxa_personality.cpp",
395 "libcxxabi/src/cxa_unexpected.cpp",
396 "libcxxabi/src/cxa_vector.cpp",
397 "libcxxabi/src/cxa_virtual.cpp",
398 "libcxxabi/src/fallback_malloc.cpp",
399 "libcxxabi/src/private_typeinfo.cpp",
400 "libcxxabi/src/stdlib_exception.cpp",
401 "libcxxabi/src/stdlib_stdexcept.cpp",
402 "libcxxabi/src/stdlib_typeinfo.cpp",
403 ]
404
405 # On linux this seems to introduce an unwanted glibc 2.18 dependency.
406 if (is_android) {
407 sources += [ "libcxxabi/src/cxa_thread_atexit.cpp" ]
408 }
409 configs -= [
Primiano Tucci7a40e4d2017-12-06 09:51:09 +0000410 "//gn/standalone:extra_warnings",
411 "//gn/standalone:no_exceptions",
412 "//gn/standalone:no_rtti",
Primiano Tucci5aab7582017-12-07 12:22:03 +0000413 "//gn/standalone:visibility_hidden",
Primiano Tucci0825bc82017-09-28 18:50:23 +0100414 ]
415 configs += [
416 ":libc++config",
Primiano Tucci7a40e4d2017-12-06 09:51:09 +0000417 "//gn/standalone/sanitizers:sanitizer_options_link_helper",
Primiano Tucci0825bc82017-09-28 18:50:23 +0100418 ]
Oystein Eftevaagdd727e42017-12-05 08:49:55 -0800419 deps = [
420 ":libunwind",
421 ]
Primiano Tucci0825bc82017-09-28 18:50:23 +0100422 }
423
Primiano Tucci7278dea2017-10-31 11:50:32 +0000424 if (custom_libcxx_is_static) {
425 libcxx_target_type = "source_set"
426 } else {
427 libcxx_target_type = "shared_library"
428 }
429
430 target(libcxx_target_type, "libc++") {
Primiano Tucci0825bc82017-09-28 18:50:23 +0100431 sources = [
432 "libcxx/src/algorithm.cpp",
433 "libcxx/src/any.cpp",
434 "libcxx/src/bind.cpp",
435 "libcxx/src/chrono.cpp",
436 "libcxx/src/condition_variable.cpp",
437 "libcxx/src/debug.cpp",
438 "libcxx/src/exception.cpp",
439 "libcxx/src/functional.cpp",
440 "libcxx/src/future.cpp",
441 "libcxx/src/hash.cpp",
442 "libcxx/src/ios.cpp",
443 "libcxx/src/iostream.cpp",
444 "libcxx/src/locale.cpp",
445 "libcxx/src/memory.cpp",
446 "libcxx/src/mutex.cpp",
447 "libcxx/src/new.cpp",
448 "libcxx/src/optional.cpp",
449 "libcxx/src/random.cpp",
450 "libcxx/src/regex.cpp",
451 "libcxx/src/shared_mutex.cpp",
452 "libcxx/src/stdexcept.cpp",
453 "libcxx/src/string.cpp",
454 "libcxx/src/strstream.cpp",
455 "libcxx/src/system_error.cpp",
456 "libcxx/src/thread.cpp",
457 "libcxx/src/typeinfo.cpp",
458 "libcxx/src/utility.cpp",
459 "libcxx/src/valarray.cpp",
460 "libcxx/src/variant.cpp",
461 ]
462 configs -= [
Primiano Tucci7a40e4d2017-12-06 09:51:09 +0000463 "//gn/standalone:extra_warnings",
464 "//gn/standalone:no_exceptions",
465 "//gn/standalone:no_rtti",
Primiano Tucci5aab7582017-12-07 12:22:03 +0000466 "//gn/standalone:visibility_hidden",
Primiano Tucci0825bc82017-09-28 18:50:23 +0100467 ]
468 configs += [
469 ":libc++config",
Primiano Tucci7a40e4d2017-12-06 09:51:09 +0000470 "//gn/standalone/sanitizers:sanitizer_options_link_helper",
Primiano Tucci0825bc82017-09-28 18:50:23 +0100471 ]
472 defines = [ "_LIBCPP_BUILDING_LIBRARY" ]
Oystein Eftevaagdd727e42017-12-05 08:49:55 -0800473 deps = [
474 ":libc++abi",
475 ]
Primiano Tucci0825bc82017-09-28 18:50:23 +0100476 }
477} # if (use_custom_libcxx)
Hector Dearman88a10112017-10-12 11:07:10 +0100478
479config("benchmark_config") {
Primiano Tucci2a29ac72017-10-24 17:47:19 +0100480 include_dirs = [ "benchmark/include" ]
Primiano Tucci3cbb10a2018-04-10 17:52:40 +0100481 configs = [ ":test_warning_suppressions" ]
Hector Dearman88a10112017-10-12 11:07:10 +0100482}
483
484source_set("benchmark") {
485 testonly = true
486 sources = [
487 "benchmark/include/benchmark/benchmark.h",
488 "benchmark/include/benchmark/benchmark_api.h",
489 "benchmark/include/benchmark/reporter.h",
490 "benchmark/src/arraysize.h",
491 "benchmark/src/benchmark.cc",
492 "benchmark/src/benchmark_api_internal.h",
493 "benchmark/src/benchmark_register.cc",
494 "benchmark/src/check.h",
495 "benchmark/src/colorprint.cc",
496 "benchmark/src/colorprint.h",
497 "benchmark/src/commandlineflags.cc",
498 "benchmark/src/commandlineflags.h",
499 "benchmark/src/complexity.cc",
500 "benchmark/src/complexity.h",
501 "benchmark/src/console_reporter.cc",
502 "benchmark/src/counter.cc",
503 "benchmark/src/counter.h",
504 "benchmark/src/csv_reporter.cc",
505 "benchmark/src/cycleclock.h",
506 "benchmark/src/internal_macros.h",
507 "benchmark/src/json_reporter.cc",
508 "benchmark/src/log.h",
509 "benchmark/src/mutex.h",
510 "benchmark/src/re.h",
511 "benchmark/src/reporter.cc",
512 "benchmark/src/sleep.cc",
513 "benchmark/src/sleep.h",
Lalit Magantic99d93c2018-03-22 15:09:30 +0000514 "benchmark/src/statistics.cc",
515 "benchmark/src/statistics.h",
Hector Dearman88a10112017-10-12 11:07:10 +0100516 "benchmark/src/string_util.cc",
517 "benchmark/src/string_util.h",
518 "benchmark/src/sysinfo.cc",
519 "benchmark/src/sysinfo.h",
520 "benchmark/src/timers.cc",
521 "benchmark/src/timers.h",
522 ]
523 defines = [ "HAVE_POSIX_REGEX" ]
524 public_configs = [ ":benchmark_config" ]
525 all_dependent_configs = [ ":benchmark_config" ]
Primiano Tucci7a40e4d2017-12-06 09:51:09 +0000526 configs -= [ "//gn/standalone:extra_warnings" ]
Hector Dearman88a10112017-10-12 11:07:10 +0100527}
Primiano Tucci38faa6f2018-04-01 20:12:08 +0200528
529# On Linux/Android use libbacktrace in debug builds for better stacktraces.
530if (is_linux || is_android) {
531 config("libbacktrace_config") {
Primiano Tucci38faa6f2018-04-01 20:12:08 +0200532 include_dirs = [
533 "libbacktrace_config",
534 "libbacktrace",
535 ]
536 cflags = [
Primiano Tucci3cbb10a2018-04-10 17:52:40 +0100537 # We force include this config file because "config.h" is too generic as a
538 # file name and on some platforms #include "config.h" ends up colliding
539 # importing some other project's config.h.
Primiano Tucci38faa6f2018-04-01 20:12:08 +0200540 "-include",
541 rebase_path("libbacktrace_config/config.h", root_build_dir),
542 ]
543 }
544
545 source_set("libbacktrace") {
546 sources = [
Primiano Tucci38faa6f2018-04-01 20:12:08 +0200547 "libbacktrace/dwarf.c",
548 "libbacktrace/elf.c",
549 "libbacktrace/fileline.c",
550 "libbacktrace/mmap.c",
551 "libbacktrace/mmapio.c",
552 "libbacktrace/posix.c",
Primiano Tucci38faa6f2018-04-01 20:12:08 +0200553 "libbacktrace/sort.c",
554 "libbacktrace/state.c",
555 ]
556 configs -= [ "//gn/standalone:extra_warnings" ]
557 public_configs = [ ":libbacktrace_config" ]
558 }
559}