• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# 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
15import("../gn/perfetto.gni")
16import("../gn/standalone/libc++/libc++.gni")
17import("../gn/standalone/sanitizers/vars.gni")
18
19# We should never get here in embedder builds.
20assert(perfetto_build_standalone || is_perfetto_build_generator)
21
22# This is to make sure that we don't add accidental dependencies from build
23# files in src/ or include/ to buildtools. All deps (outside of /gn/*) should
24# go via the groups defined in gn/BUILD.gn, not directly into buildtools. This
25# is to allow embedders to re-route targets to their third_party directories.
26_buildtools_visibility = [
27  "./*",
28  "../gn:*",
29  "../gn/standalone:*",
30]
31
32# Used to suppress warnings coming from googletest macros expansions.
33# These suppressions apply both to gtest/gmock haders and to perfetto's
34# test translation units. See test/gtest_and_gmock.h for the subset of
35# suppressions that apply only to the gmock/gtest headers.
36config("test_warning_suppressions") {
37  visibility = _buildtools_visibility
38  if (is_clang) {
39    cflags = [
40      "-Wno-covered-switch-default",
41      "-Wno-deprecated-copy-dtor",
42      "-Wno-global-constructors",
43      "-Wno-inconsistent-missing-override",
44      "-Wno-language-extension-token",
45      "-Wno-suggest-destructor-override",
46      "-Wno-suggest-override",
47      "-Wno-undef",
48      "-Wno-unknown-warning-option",
49      "-Wno-unused-member-function",
50      "-Wno-used-but-marked-unused",
51      "-Wno-weak-vtables",
52      "-Wno-zero-as-null-pointer-constant",
53    ]
54  } else if (!is_win) {
55    cflags = [
56      "-Wno-unknown-warning-option",
57      "-Wno-deprecated-copy",
58      "-Wno-uninitialized",
59    ]
60  }
61}
62
63config("libunwindstack_config") {
64  visibility = _buildtools_visibility
65  cflags = [
66    # Using -isystem instead of include_dirs (-I), so we don't need to suppress
67    # warnings coming from libunwindstack headers. Doing so would mask warnings
68    # in our own code.
69    perfetto_isystem_cflag,
70    rebase_path("android-unwinding/libunwindstack/include", root_build_dir),
71    perfetto_isystem_cflag,
72    rebase_path("android-libprocinfo/include", root_build_dir),
73    perfetto_isystem_cflag,
74    rebase_path("android-libbase/include", root_build_dir),
75    perfetto_isystem_cflag,
76    rebase_path("android-core/demangle/include", root_build_dir),
77  ]
78  defines = [ "NO_LIBDEXFILE_SUPPORT" ]
79}
80
81# Config to include gtest.h in test targets.
82config("googletest_config") {
83  visibility = _buildtools_visibility
84  defines = [ "GTEST_LANG_CXX11=1" ]
85  include_dirs = [
86    "googletest/googletest/include",
87    "googletest/googlemock/include",
88  ]
89  configs = [ ":test_warning_suppressions" ]
90}
91
92source_set("gtest") {
93  visibility = _buildtools_visibility
94  testonly = true
95  include_dirs = [ "googletest/googletest" ]
96  configs -= [ "//gn/standalone:extra_warnings" ]
97  public_configs = [ ":googletest_config" ]
98  all_dependent_configs = [ ":googletest_config" ]
99  sources = [ "googletest/googletest/src/gtest-all.cc" ]
100  deps = [ "//gn:default_deps" ]
101}
102
103source_set("gtest_main") {
104  visibility = _buildtools_visibility
105  testonly = true
106  configs -= [ "//gn/standalone:extra_warnings" ]
107  configs += [ ":googletest_config" ]
108  sources = [ "googletest/googletest/src/gtest_main.cc" ]
109  deps = [ "//gn:default_deps" ]
110}
111
112source_set("gmock") {
113  visibility = _buildtools_visibility
114  testonly = true
115  include_dirs = [ "googletest/googlemock" ]
116  configs -= [ "//gn/standalone:extra_warnings" ]
117  public_configs = [ ":googletest_config" ]
118  all_dependent_configs = [ ":googletest_config" ]
119  sources = [ "googletest/googlemock/src/gmock-all.cc" ]
120  deps = [ "//gn:default_deps" ]
121}
122
123# Configuration used to build libprotobuf_* and the protoc compiler.
124config("protobuf_config") {
125  visibility = _buildtools_visibility
126
127  # Apply the lighter supressions and macro definitions from above.
128  configs = [ "//gn:protobuf_gen_config" ]
129
130  defines = [ "HAVE_PTHREAD=1" ]
131  cflags = []
132
133  # Fixed upstream in:
134  # https://github.com/protocolbuffers/protobuf/pull/10112
135  # But we don't have that yet.
136  if (is_mac) {
137    cflags += [ "-Wno-deprecated-declarations" ]
138  }
139  if (!is_clang && !is_win) {  # implies gcc
140    cflags += [ "-Wno-stringop-overread" ]
141  }
142  if (is_win) {
143    cflags += [ "/W0" ]
144  }
145}
146
147# Configuration propagated to targets depending on protobuf_full.
148config("protobuf_full_public_config") {
149  visibility = _buildtools_visibility
150  cflags = []
151  if (is_clang) {
152    cflags += [ "-Wno-switch-enum" ]
153    if (is_win) {
154      cflags += [ "-Wno-undef" ]
155    }
156  }
157}
158
159source_set("protobuf_lite") {
160  visibility = _buildtools_visibility
161  sources = [
162    "protobuf/src/google/protobuf/any.h",
163    "protobuf/src/google/protobuf/any.pb.h",
164    "protobuf/src/google/protobuf/any_lite.cc",
165    "protobuf/src/google/protobuf/api.pb.h",
166    "protobuf/src/google/protobuf/arena.cc",
167    "protobuf/src/google/protobuf/arena.h",
168    "protobuf/src/google/protobuf/arena_impl.h",
169    "protobuf/src/google/protobuf/arenastring.cc",
170    "protobuf/src/google/protobuf/arenastring.h",
171    "protobuf/src/google/protobuf/arenaz_sampler.cc",
172    "protobuf/src/google/protobuf/arenaz_sampler.h",
173    "protobuf/src/google/protobuf/compiler/importer.h",
174    "protobuf/src/google/protobuf/compiler/parser.h",
175    "protobuf/src/google/protobuf/descriptor.h",
176    "protobuf/src/google/protobuf/descriptor.pb.h",
177    "protobuf/src/google/protobuf/descriptor_database.h",
178    "protobuf/src/google/protobuf/duration.pb.h",
179    "protobuf/src/google/protobuf/dynamic_message.h",
180    "protobuf/src/google/protobuf/empty.pb.h",
181    "protobuf/src/google/protobuf/explicitly_constructed.h",
182    "protobuf/src/google/protobuf/extension_set.cc",
183    "protobuf/src/google/protobuf/extension_set.h",
184    "protobuf/src/google/protobuf/extension_set_inl.h",
185    "protobuf/src/google/protobuf/field_access_listener.h",
186    "protobuf/src/google/protobuf/field_mask.pb.h",
187    "protobuf/src/google/protobuf/generated_enum_reflection.h",
188    "protobuf/src/google/protobuf/generated_enum_util.cc",
189    "protobuf/src/google/protobuf/generated_enum_util.h",
190    "protobuf/src/google/protobuf/generated_message_bases.h",
191    "protobuf/src/google/protobuf/generated_message_reflection.h",
192    "protobuf/src/google/protobuf/generated_message_tctable_decl.h",
193    "protobuf/src/google/protobuf/generated_message_tctable_impl.h",
194    "protobuf/src/google/protobuf/generated_message_tctable_lite.cc",
195    "protobuf/src/google/protobuf/generated_message_util.cc",
196    "protobuf/src/google/protobuf/generated_message_util.h",
197    "protobuf/src/google/protobuf/has_bits.h",
198    "protobuf/src/google/protobuf/implicit_weak_message.cc",
199    "protobuf/src/google/protobuf/implicit_weak_message.h",
200    "protobuf/src/google/protobuf/inlined_string_field.cc",
201    "protobuf/src/google/protobuf/inlined_string_field.h",
202    "protobuf/src/google/protobuf/io/coded_stream.cc",
203    "protobuf/src/google/protobuf/io/coded_stream.h",
204    "protobuf/src/google/protobuf/io/io_win32.cc",
205    "protobuf/src/google/protobuf/io/io_win32.h",
206    "protobuf/src/google/protobuf/io/printer.h",
207    "protobuf/src/google/protobuf/io/strtod.cc",
208    "protobuf/src/google/protobuf/io/strtod.h",
209    "protobuf/src/google/protobuf/io/tokenizer.h",
210    "protobuf/src/google/protobuf/io/zero_copy_stream.cc",
211    "protobuf/src/google/protobuf/io/zero_copy_stream.h",
212    "protobuf/src/google/protobuf/io/zero_copy_stream_impl.cc",
213    "protobuf/src/google/protobuf/io/zero_copy_stream_impl.h",
214    "protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.cc",
215    "protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.h",
216    "protobuf/src/google/protobuf/map.cc",
217    "protobuf/src/google/protobuf/map.h",
218    "protobuf/src/google/protobuf/map_entry.h",
219    "protobuf/src/google/protobuf/map_entry_lite.h",
220    "protobuf/src/google/protobuf/map_field.h",
221    "protobuf/src/google/protobuf/map_field_inl.h",
222    "protobuf/src/google/protobuf/map_field_lite.h",
223    "protobuf/src/google/protobuf/map_type_handler.h",
224    "protobuf/src/google/protobuf/message.h",
225    "protobuf/src/google/protobuf/message_lite.cc",
226    "protobuf/src/google/protobuf/message_lite.h",
227    "protobuf/src/google/protobuf/metadata.h",
228    "protobuf/src/google/protobuf/metadata_lite.h",
229    "protobuf/src/google/protobuf/parse_context.cc",
230    "protobuf/src/google/protobuf/parse_context.h",
231    "protobuf/src/google/protobuf/port.h",
232    "protobuf/src/google/protobuf/port_def.inc",
233    "protobuf/src/google/protobuf/port_undef.inc",
234    "protobuf/src/google/protobuf/reflection.h",
235    "protobuf/src/google/protobuf/reflection_ops.h",
236    "protobuf/src/google/protobuf/repeated_field.cc",
237    "protobuf/src/google/protobuf/repeated_field.h",
238    "protobuf/src/google/protobuf/repeated_ptr_field.cc",
239    "protobuf/src/google/protobuf/repeated_ptr_field.h",
240    "protobuf/src/google/protobuf/service.h",
241    "protobuf/src/google/protobuf/source_context.pb.h",
242    "protobuf/src/google/protobuf/string_member_robber.h",
243    "protobuf/src/google/protobuf/struct.pb.h",
244    "protobuf/src/google/protobuf/stubs/bytestream.cc",
245    "protobuf/src/google/protobuf/stubs/bytestream.h",
246    "protobuf/src/google/protobuf/stubs/callback.h",
247    "protobuf/src/google/protobuf/stubs/casts.h",
248    "protobuf/src/google/protobuf/stubs/common.cc",
249    "protobuf/src/google/protobuf/stubs/common.h",
250    "protobuf/src/google/protobuf/stubs/hash.h",
251    "protobuf/src/google/protobuf/stubs/int128.cc",
252    "protobuf/src/google/protobuf/stubs/int128.h",
253    "protobuf/src/google/protobuf/stubs/logging.h",
254    "protobuf/src/google/protobuf/stubs/macros.h",
255    "protobuf/src/google/protobuf/stubs/map_util.h",
256    "protobuf/src/google/protobuf/stubs/mathutil.h",
257    "protobuf/src/google/protobuf/stubs/mutex.h",
258    "protobuf/src/google/protobuf/stubs/once.h",
259    "protobuf/src/google/protobuf/stubs/platform_macros.h",
260    "protobuf/src/google/protobuf/stubs/port.h",
261    "protobuf/src/google/protobuf/stubs/status.cc",
262    "protobuf/src/google/protobuf/stubs/status.h",
263    "protobuf/src/google/protobuf/stubs/status_macros.h",
264    "protobuf/src/google/protobuf/stubs/statusor.cc",
265    "protobuf/src/google/protobuf/stubs/statusor.h",
266    "protobuf/src/google/protobuf/stubs/stl_util.h",
267    "protobuf/src/google/protobuf/stubs/stringpiece.cc",
268    "protobuf/src/google/protobuf/stubs/stringpiece.h",
269    "protobuf/src/google/protobuf/stubs/stringprintf.cc",
270    "protobuf/src/google/protobuf/stubs/stringprintf.h",
271    "protobuf/src/google/protobuf/stubs/structurally_valid.cc",
272    "protobuf/src/google/protobuf/stubs/strutil.cc",
273    "protobuf/src/google/protobuf/stubs/strutil.h",
274    "protobuf/src/google/protobuf/stubs/template_util.h",
275    "protobuf/src/google/protobuf/stubs/time.cc",
276    "protobuf/src/google/protobuf/stubs/time.h",
277    "protobuf/src/google/protobuf/text_format.h",
278    "protobuf/src/google/protobuf/timestamp.pb.h",
279    "protobuf/src/google/protobuf/type.pb.h",
280    "protobuf/src/google/protobuf/unknown_field_set.h",
281    "protobuf/src/google/protobuf/util/delimited_message_util.h",
282    "protobuf/src/google/protobuf/util/field_comparator.h",
283    "protobuf/src/google/protobuf/util/field_mask_util.h",
284    "protobuf/src/google/protobuf/util/json_util.h",
285    "protobuf/src/google/protobuf/util/message_differencer.h",
286    "protobuf/src/google/protobuf/util/time_util.h",
287    "protobuf/src/google/protobuf/util/type_resolver.h",
288    "protobuf/src/google/protobuf/util/type_resolver_util.h",
289    "protobuf/src/google/protobuf/wire_format.h",
290    "protobuf/src/google/protobuf/wire_format_lite.cc",
291    "protobuf/src/google/protobuf/wire_format_lite.h",
292    "protobuf/src/google/protobuf/wrappers.pb.h",
293  ]
294  configs -= [ "//gn/standalone:extra_warnings" ]
295  if (is_win) {
296    # Protobuf has its own #define WIN32_LEAN_AND_MEAN.
297    configs -= [ "//gn/standalone:win32_lean_and_mean" ]
298  }
299  configs += [ ":protobuf_config" ]
300  public_configs = [ "//gn:protobuf_gen_config" ]
301  deps = [ "//gn:default_deps" ]
302}
303
304source_set("protobuf_full") {
305  visibility = _buildtools_visibility
306  deps = [
307    ":protobuf_lite",
308    "//gn:default_deps",
309  ]
310  sources = [
311    "protobuf/src/google/protobuf/any.cc",
312    "protobuf/src/google/protobuf/any.h",
313    "protobuf/src/google/protobuf/any.pb.cc",
314    "protobuf/src/google/protobuf/any.pb.h",
315    "protobuf/src/google/protobuf/api.pb.cc",
316    "protobuf/src/google/protobuf/api.pb.h",
317    "protobuf/src/google/protobuf/arena.h",
318    "protobuf/src/google/protobuf/arena_impl.h",
319    "protobuf/src/google/protobuf/arenastring.h",
320    "protobuf/src/google/protobuf/arenaz_sampler.h",
321    "protobuf/src/google/protobuf/compiler/importer.cc",
322    "protobuf/src/google/protobuf/compiler/importer.h",
323    "protobuf/src/google/protobuf/compiler/parser.cc",
324    "protobuf/src/google/protobuf/compiler/parser.h",
325    "protobuf/src/google/protobuf/descriptor.cc",
326    "protobuf/src/google/protobuf/descriptor.h",
327    "protobuf/src/google/protobuf/descriptor.pb.cc",
328    "protobuf/src/google/protobuf/descriptor.pb.h",
329    "protobuf/src/google/protobuf/descriptor_database.cc",
330    "protobuf/src/google/protobuf/descriptor_database.h",
331    "protobuf/src/google/protobuf/duration.pb.cc",
332    "protobuf/src/google/protobuf/duration.pb.h",
333    "protobuf/src/google/protobuf/dynamic_message.cc",
334    "protobuf/src/google/protobuf/dynamic_message.h",
335    "protobuf/src/google/protobuf/empty.pb.cc",
336    "protobuf/src/google/protobuf/empty.pb.h",
337    "protobuf/src/google/protobuf/explicitly_constructed.h",
338    "protobuf/src/google/protobuf/extension_set.h",
339    "protobuf/src/google/protobuf/extension_set_heavy.cc",
340    "protobuf/src/google/protobuf/extension_set_inl.h",
341    "protobuf/src/google/protobuf/field_access_listener.h",
342    "protobuf/src/google/protobuf/field_mask.pb.cc",
343    "protobuf/src/google/protobuf/field_mask.pb.h",
344    "protobuf/src/google/protobuf/generated_enum_reflection.h",
345    "protobuf/src/google/protobuf/generated_enum_util.h",
346    "protobuf/src/google/protobuf/generated_message_bases.cc",
347    "protobuf/src/google/protobuf/generated_message_bases.h",
348    "protobuf/src/google/protobuf/generated_message_reflection.cc",
349    "protobuf/src/google/protobuf/generated_message_reflection.h",
350    "protobuf/src/google/protobuf/generated_message_tctable_decl.h",
351    "protobuf/src/google/protobuf/generated_message_tctable_full.cc",
352    "protobuf/src/google/protobuf/generated_message_tctable_impl.h",
353    "protobuf/src/google/protobuf/generated_message_util.h",
354    "protobuf/src/google/protobuf/has_bits.h",
355    "protobuf/src/google/protobuf/implicit_weak_message.h",
356    "protobuf/src/google/protobuf/inlined_string_field.h",
357    "protobuf/src/google/protobuf/io/coded_stream.h",
358    "protobuf/src/google/protobuf/io/gzip_stream.cc",
359    "protobuf/src/google/protobuf/io/io_win32.h",
360    "protobuf/src/google/protobuf/io/printer.cc",
361    "protobuf/src/google/protobuf/io/printer.h",
362    "protobuf/src/google/protobuf/io/strtod.h",
363    "protobuf/src/google/protobuf/io/tokenizer.cc",
364    "protobuf/src/google/protobuf/io/tokenizer.h",
365    "protobuf/src/google/protobuf/io/zero_copy_stream.h",
366    "protobuf/src/google/protobuf/io/zero_copy_stream_impl.h",
367    "protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.h",
368    "protobuf/src/google/protobuf/map.h",
369    "protobuf/src/google/protobuf/map_entry.h",
370    "protobuf/src/google/protobuf/map_entry_lite.h",
371    "protobuf/src/google/protobuf/map_field.cc",
372    "protobuf/src/google/protobuf/map_field.h",
373    "protobuf/src/google/protobuf/map_field_inl.h",
374    "protobuf/src/google/protobuf/map_field_lite.h",
375    "protobuf/src/google/protobuf/map_type_handler.h",
376    "protobuf/src/google/protobuf/message.cc",
377    "protobuf/src/google/protobuf/message.h",
378    "protobuf/src/google/protobuf/message_lite.h",
379    "protobuf/src/google/protobuf/metadata.h",
380    "protobuf/src/google/protobuf/metadata_lite.h",
381    "protobuf/src/google/protobuf/parse_context.h",
382    "protobuf/src/google/protobuf/port.h",
383    "protobuf/src/google/protobuf/port_def.inc",
384    "protobuf/src/google/protobuf/port_undef.inc",
385    "protobuf/src/google/protobuf/reflection.h",
386    "protobuf/src/google/protobuf/reflection_internal.h",
387    "protobuf/src/google/protobuf/reflection_ops.cc",
388    "protobuf/src/google/protobuf/reflection_ops.h",
389    "protobuf/src/google/protobuf/repeated_field.h",
390    "protobuf/src/google/protobuf/repeated_ptr_field.h",
391    "protobuf/src/google/protobuf/service.cc",
392    "protobuf/src/google/protobuf/service.h",
393    "protobuf/src/google/protobuf/source_context.pb.cc",
394    "protobuf/src/google/protobuf/source_context.pb.h",
395    "protobuf/src/google/protobuf/struct.pb.cc",
396    "protobuf/src/google/protobuf/struct.pb.h",
397    "protobuf/src/google/protobuf/stubs/bytestream.h",
398    "protobuf/src/google/protobuf/stubs/callback.h",
399    "protobuf/src/google/protobuf/stubs/casts.h",
400    "protobuf/src/google/protobuf/stubs/common.h",
401    "protobuf/src/google/protobuf/stubs/hash.h",
402    "protobuf/src/google/protobuf/stubs/logging.h",
403    "protobuf/src/google/protobuf/stubs/macros.h",
404    "protobuf/src/google/protobuf/stubs/map_util.h",
405    "protobuf/src/google/protobuf/stubs/mutex.h",
406    "protobuf/src/google/protobuf/stubs/once.h",
407    "protobuf/src/google/protobuf/stubs/platform_macros.h",
408    "protobuf/src/google/protobuf/stubs/port.h",
409    "protobuf/src/google/protobuf/stubs/status.h",
410    "protobuf/src/google/protobuf/stubs/stl_util.h",
411    "protobuf/src/google/protobuf/stubs/stringpiece.h",
412    "protobuf/src/google/protobuf/stubs/strutil.h",
413    "protobuf/src/google/protobuf/stubs/substitute.cc",
414    "protobuf/src/google/protobuf/stubs/substitute.h",
415    "protobuf/src/google/protobuf/stubs/template_util.h",
416    "protobuf/src/google/protobuf/text_format.cc",
417    "protobuf/src/google/protobuf/text_format.h",
418    "protobuf/src/google/protobuf/timestamp.pb.cc",
419    "protobuf/src/google/protobuf/timestamp.pb.h",
420    "protobuf/src/google/protobuf/type.pb.cc",
421    "protobuf/src/google/protobuf/type.pb.h",
422    "protobuf/src/google/protobuf/unknown_field_set.cc",
423    "protobuf/src/google/protobuf/unknown_field_set.h",
424    "protobuf/src/google/protobuf/util/delimited_message_util.cc",
425    "protobuf/src/google/protobuf/util/delimited_message_util.h",
426    "protobuf/src/google/protobuf/util/field_comparator.cc",
427    "protobuf/src/google/protobuf/util/field_comparator.h",
428    "protobuf/src/google/protobuf/util/field_mask_util.cc",
429    "protobuf/src/google/protobuf/util/field_mask_util.h",
430    "protobuf/src/google/protobuf/util/internal/constants.h",
431    "protobuf/src/google/protobuf/util/internal/datapiece.cc",
432    "protobuf/src/google/protobuf/util/internal/datapiece.h",
433    "protobuf/src/google/protobuf/util/internal/default_value_objectwriter.cc",
434    "protobuf/src/google/protobuf/util/internal/default_value_objectwriter.h",
435    "protobuf/src/google/protobuf/util/internal/error_listener.cc",
436    "protobuf/src/google/protobuf/util/internal/error_listener.h",
437    "protobuf/src/google/protobuf/util/internal/expecting_objectwriter.h",
438    "protobuf/src/google/protobuf/util/internal/field_mask_utility.cc",
439    "protobuf/src/google/protobuf/util/internal/field_mask_utility.h",
440    "protobuf/src/google/protobuf/util/internal/json_escaping.cc",
441    "protobuf/src/google/protobuf/util/internal/json_escaping.h",
442    "protobuf/src/google/protobuf/util/internal/json_objectwriter.cc",
443    "protobuf/src/google/protobuf/util/internal/json_objectwriter.h",
444    "protobuf/src/google/protobuf/util/internal/json_stream_parser.cc",
445    "protobuf/src/google/protobuf/util/internal/json_stream_parser.h",
446    "protobuf/src/google/protobuf/util/internal/location_tracker.h",
447    "protobuf/src/google/protobuf/util/internal/mock_error_listener.h",
448    "protobuf/src/google/protobuf/util/internal/object_location_tracker.h",
449    "protobuf/src/google/protobuf/util/internal/object_source.h",
450    "protobuf/src/google/protobuf/util/internal/object_writer.cc",
451    "protobuf/src/google/protobuf/util/internal/object_writer.h",
452    "protobuf/src/google/protobuf/util/internal/proto_writer.cc",
453    "protobuf/src/google/protobuf/util/internal/proto_writer.h",
454    "protobuf/src/google/protobuf/util/internal/protostream_objectsource.cc",
455    "protobuf/src/google/protobuf/util/internal/protostream_objectsource.h",
456    "protobuf/src/google/protobuf/util/internal/protostream_objectwriter.cc",
457    "protobuf/src/google/protobuf/util/internal/protostream_objectwriter.h",
458    "protobuf/src/google/protobuf/util/internal/structured_objectwriter.h",
459    "protobuf/src/google/protobuf/util/internal/type_info.cc",
460    "protobuf/src/google/protobuf/util/internal/type_info.h",
461    "protobuf/src/google/protobuf/util/internal/type_info_test_helper.h",
462    "protobuf/src/google/protobuf/util/internal/utility.cc",
463    "protobuf/src/google/protobuf/util/internal/utility.h",
464    "protobuf/src/google/protobuf/util/json_util.cc",
465    "protobuf/src/google/protobuf/util/json_util.h",
466    "protobuf/src/google/protobuf/util/message_differencer.cc",
467    "protobuf/src/google/protobuf/util/message_differencer.h",
468    "protobuf/src/google/protobuf/util/time_util.cc",
469    "protobuf/src/google/protobuf/util/time_util.h",
470    "protobuf/src/google/protobuf/util/type_resolver.h",
471    "protobuf/src/google/protobuf/util/type_resolver_util.cc",
472    "protobuf/src/google/protobuf/util/type_resolver_util.h",
473    "protobuf/src/google/protobuf/wire_format.cc",
474    "protobuf/src/google/protobuf/wire_format.h",
475    "protobuf/src/google/protobuf/wire_format_lite.h",
476    "protobuf/src/google/protobuf/wrappers.pb.cc",
477    "protobuf/src/google/protobuf/wrappers.pb.h",
478  ]
479  configs -= [ "//gn/standalone:extra_warnings" ]
480  if (is_win) {
481    # Protobuf has its own #define WIN32_LEAN_AND_MEAN.
482    configs -= [ "//gn/standalone:win32_lean_and_mean" ]
483  }
484  configs += [ ":protobuf_config" ]
485  public_configs = [
486    "//gn:protobuf_gen_config",
487    ":protobuf_full_public_config",
488  ]
489}
490
491source_set("protoc_lib") {
492  visibility = _buildtools_visibility
493  deps = [
494    ":protobuf_full",
495    "//gn:default_deps",
496  ]
497  sources = [
498    "protobuf/src/google/protobuf/compiler/code_generator.cc",
499    "protobuf/src/google/protobuf/compiler/code_generator.h",
500    "protobuf/src/google/protobuf/compiler/command_line_interface.cc",
501    "protobuf/src/google/protobuf/compiler/command_line_interface.h",
502    "protobuf/src/google/protobuf/compiler/cpp/cpp_enum.cc",
503    "protobuf/src/google/protobuf/compiler/cpp/cpp_enum.h",
504    "protobuf/src/google/protobuf/compiler/cpp/cpp_enum_field.cc",
505    "protobuf/src/google/protobuf/compiler/cpp/cpp_enum_field.h",
506    "protobuf/src/google/protobuf/compiler/cpp/cpp_extension.cc",
507    "protobuf/src/google/protobuf/compiler/cpp/cpp_extension.h",
508    "protobuf/src/google/protobuf/compiler/cpp/cpp_field.cc",
509    "protobuf/src/google/protobuf/compiler/cpp/cpp_field.h",
510    "protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc",
511    "protobuf/src/google/protobuf/compiler/cpp/cpp_file.h",
512    "protobuf/src/google/protobuf/compiler/cpp/cpp_generator.cc",
513    "protobuf/src/google/protobuf/compiler/cpp/cpp_generator.h",
514    "protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc",
515    "protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.h",
516    "protobuf/src/google/protobuf/compiler/cpp/cpp_map_field.cc",
517    "protobuf/src/google/protobuf/compiler/cpp/cpp_map_field.h",
518    "protobuf/src/google/protobuf/compiler/cpp/cpp_message.cc",
519    "protobuf/src/google/protobuf/compiler/cpp/cpp_message.h",
520    "protobuf/src/google/protobuf/compiler/cpp/cpp_message_field.cc",
521    "protobuf/src/google/protobuf/compiler/cpp/cpp_message_field.h",
522    "protobuf/src/google/protobuf/compiler/cpp/cpp_message_layout_helper.h",
523    "protobuf/src/google/protobuf/compiler/cpp/cpp_names.h",
524    "protobuf/src/google/protobuf/compiler/cpp/cpp_options.h",
525    "protobuf/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.cc",
526    "protobuf/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.h",
527    "protobuf/src/google/protobuf/compiler/cpp/cpp_parse_function_generator.cc",
528    "protobuf/src/google/protobuf/compiler/cpp/cpp_parse_function_generator.h",
529    "protobuf/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc",
530    "protobuf/src/google/protobuf/compiler/cpp/cpp_primitive_field.h",
531    "protobuf/src/google/protobuf/compiler/cpp/cpp_service.cc",
532    "protobuf/src/google/protobuf/compiler/cpp/cpp_service.h",
533    "protobuf/src/google/protobuf/compiler/cpp/cpp_string_field.cc",
534    "protobuf/src/google/protobuf/compiler/cpp/cpp_string_field.h",
535    "protobuf/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc",
536    "protobuf/src/google/protobuf/compiler/csharp/csharp_doc_comment.h",
537    "protobuf/src/google/protobuf/compiler/csharp/csharp_enum.cc",
538    "protobuf/src/google/protobuf/compiler/csharp/csharp_enum.h",
539    "protobuf/src/google/protobuf/compiler/csharp/csharp_enum_field.cc",
540    "protobuf/src/google/protobuf/compiler/csharp/csharp_enum_field.h",
541    "protobuf/src/google/protobuf/compiler/csharp/csharp_field_base.cc",
542    "protobuf/src/google/protobuf/compiler/csharp/csharp_field_base.h",
543    "protobuf/src/google/protobuf/compiler/csharp/csharp_generator.cc",
544    "protobuf/src/google/protobuf/compiler/csharp/csharp_generator.h",
545    "protobuf/src/google/protobuf/compiler/csharp/csharp_helpers.cc",
546    "protobuf/src/google/protobuf/compiler/csharp/csharp_helpers.h",
547    "protobuf/src/google/protobuf/compiler/csharp/csharp_map_field.cc",
548    "protobuf/src/google/protobuf/compiler/csharp/csharp_map_field.h",
549    "protobuf/src/google/protobuf/compiler/csharp/csharp_message.cc",
550    "protobuf/src/google/protobuf/compiler/csharp/csharp_message.h",
551    "protobuf/src/google/protobuf/compiler/csharp/csharp_message_field.cc",
552    "protobuf/src/google/protobuf/compiler/csharp/csharp_message_field.h",
553    "protobuf/src/google/protobuf/compiler/csharp/csharp_names.h",
554    "protobuf/src/google/protobuf/compiler/csharp/csharp_options.h",
555    "protobuf/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc",
556    "protobuf/src/google/protobuf/compiler/csharp/csharp_primitive_field.h",
557    "protobuf/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc",
558    "protobuf/src/google/protobuf/compiler/csharp/csharp_reflection_class.h",
559    "protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc",
560    "protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h",
561    "protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc",
562    "protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h",
563    "protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc",
564    "protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h",
565    "protobuf/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc",
566    "protobuf/src/google/protobuf/compiler/csharp/csharp_source_generator_base.h",
567    "protobuf/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc",
568    "protobuf/src/google/protobuf/compiler/csharp/csharp_wrapper_field.h",
569    "protobuf/src/google/protobuf/compiler/java/java_context.cc",
570    "protobuf/src/google/protobuf/compiler/java/java_context.h",
571    "protobuf/src/google/protobuf/compiler/java/java_doc_comment.cc",
572    "protobuf/src/google/protobuf/compiler/java/java_doc_comment.h",
573    "protobuf/src/google/protobuf/compiler/java/java_enum.cc",
574    "protobuf/src/google/protobuf/compiler/java/java_enum.h",
575    "protobuf/src/google/protobuf/compiler/java/java_enum_field.cc",
576    "protobuf/src/google/protobuf/compiler/java/java_enum_field.h",
577    "protobuf/src/google/protobuf/compiler/java/java_enum_field_lite.cc",
578    "protobuf/src/google/protobuf/compiler/java/java_enum_field_lite.h",
579    "protobuf/src/google/protobuf/compiler/java/java_enum_lite.cc",
580    "protobuf/src/google/protobuf/compiler/java/java_enum_lite.h",
581    "protobuf/src/google/protobuf/compiler/java/java_extension.cc",
582    "protobuf/src/google/protobuf/compiler/java/java_extension.h",
583    "protobuf/src/google/protobuf/compiler/java/java_extension_lite.cc",
584    "protobuf/src/google/protobuf/compiler/java/java_extension_lite.h",
585    "protobuf/src/google/protobuf/compiler/java/java_field.cc",
586    "protobuf/src/google/protobuf/compiler/java/java_field.h",
587    "protobuf/src/google/protobuf/compiler/java/java_file.cc",
588    "protobuf/src/google/protobuf/compiler/java/java_file.h",
589    "protobuf/src/google/protobuf/compiler/java/java_generator.cc",
590    "protobuf/src/google/protobuf/compiler/java/java_generator.h",
591    "protobuf/src/google/protobuf/compiler/java/java_generator_factory.cc",
592    "protobuf/src/google/protobuf/compiler/java/java_generator_factory.h",
593    "protobuf/src/google/protobuf/compiler/java/java_helpers.cc",
594    "protobuf/src/google/protobuf/compiler/java/java_helpers.h",
595    "protobuf/src/google/protobuf/compiler/java/java_kotlin_generator.cc",
596    "protobuf/src/google/protobuf/compiler/java/java_kotlin_generator.h",
597    "protobuf/src/google/protobuf/compiler/java/java_map_field.cc",
598    "protobuf/src/google/protobuf/compiler/java/java_map_field.h",
599    "protobuf/src/google/protobuf/compiler/java/java_map_field_lite.cc",
600    "protobuf/src/google/protobuf/compiler/java/java_map_field_lite.h",
601    "protobuf/src/google/protobuf/compiler/java/java_message.cc",
602    "protobuf/src/google/protobuf/compiler/java/java_message.h",
603    "protobuf/src/google/protobuf/compiler/java/java_message_builder.cc",
604    "protobuf/src/google/protobuf/compiler/java/java_message_builder.h",
605    "protobuf/src/google/protobuf/compiler/java/java_message_builder_lite.cc",
606    "protobuf/src/google/protobuf/compiler/java/java_message_builder_lite.h",
607    "protobuf/src/google/protobuf/compiler/java/java_message_field.cc",
608    "protobuf/src/google/protobuf/compiler/java/java_message_field.h",
609    "protobuf/src/google/protobuf/compiler/java/java_message_field_lite.cc",
610    "protobuf/src/google/protobuf/compiler/java/java_message_field_lite.h",
611    "protobuf/src/google/protobuf/compiler/java/java_message_lite.cc",
612    "protobuf/src/google/protobuf/compiler/java/java_message_lite.h",
613    "protobuf/src/google/protobuf/compiler/java/java_name_resolver.cc",
614    "protobuf/src/google/protobuf/compiler/java/java_name_resolver.h",
615    "protobuf/src/google/protobuf/compiler/java/java_names.h",
616    "protobuf/src/google/protobuf/compiler/java/java_options.h",
617    "protobuf/src/google/protobuf/compiler/java/java_primitive_field.cc",
618    "protobuf/src/google/protobuf/compiler/java/java_primitive_field.h",
619    "protobuf/src/google/protobuf/compiler/java/java_primitive_field_lite.cc",
620    "protobuf/src/google/protobuf/compiler/java/java_primitive_field_lite.h",
621    "protobuf/src/google/protobuf/compiler/java/java_service.cc",
622    "protobuf/src/google/protobuf/compiler/java/java_service.h",
623    "protobuf/src/google/protobuf/compiler/java/java_shared_code_generator.cc",
624    "protobuf/src/google/protobuf/compiler/java/java_shared_code_generator.h",
625    "protobuf/src/google/protobuf/compiler/java/java_string_field.cc",
626    "protobuf/src/google/protobuf/compiler/java/java_string_field.h",
627    "protobuf/src/google/protobuf/compiler/java/java_string_field_lite.cc",
628    "protobuf/src/google/protobuf/compiler/java/java_string_field_lite.h",
629    "protobuf/src/google/protobuf/compiler/js/js_generator.cc",
630    "protobuf/src/google/protobuf/compiler/js/js_generator.h",
631    "protobuf/src/google/protobuf/compiler/js/well_known_types_embed.cc",
632    "protobuf/src/google/protobuf/compiler/js/well_known_types_embed.h",
633    "protobuf/src/google/protobuf/compiler/objectivec/objectivec_enum.cc",
634    "protobuf/src/google/protobuf/compiler/objectivec/objectivec_enum.h",
635    "protobuf/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc",
636    "protobuf/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h",
637    "protobuf/src/google/protobuf/compiler/objectivec/objectivec_extension.cc",
638    "protobuf/src/google/protobuf/compiler/objectivec/objectivec_extension.h",
639    "protobuf/src/google/protobuf/compiler/objectivec/objectivec_field.cc",
640    "protobuf/src/google/protobuf/compiler/objectivec/objectivec_field.h",
641    "protobuf/src/google/protobuf/compiler/objectivec/objectivec_file.cc",
642    "protobuf/src/google/protobuf/compiler/objectivec/objectivec_file.h",
643    "protobuf/src/google/protobuf/compiler/objectivec/objectivec_generator.cc",
644    "protobuf/src/google/protobuf/compiler/objectivec/objectivec_generator.h",
645    "protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc",
646    "protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.h",
647    "protobuf/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc",
648    "protobuf/src/google/protobuf/compiler/objectivec/objectivec_map_field.h",
649    "protobuf/src/google/protobuf/compiler/objectivec/objectivec_message.cc",
650    "protobuf/src/google/protobuf/compiler/objectivec/objectivec_message.h",
651    "protobuf/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc",
652    "protobuf/src/google/protobuf/compiler/objectivec/objectivec_message_field.h",
653    "protobuf/src/google/protobuf/compiler/objectivec/objectivec_nsobject_methods.h",
654    "protobuf/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc",
655    "protobuf/src/google/protobuf/compiler/objectivec/objectivec_oneof.h",
656    "protobuf/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc",
657    "protobuf/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.h",
658    "protobuf/src/google/protobuf/compiler/php/php_generator.cc",
659    "protobuf/src/google/protobuf/compiler/php/php_generator.h",
660    "protobuf/src/google/protobuf/compiler/plugin.cc",
661    "protobuf/src/google/protobuf/compiler/plugin.h",
662    "protobuf/src/google/protobuf/compiler/plugin.pb.cc",
663    "protobuf/src/google/protobuf/compiler/plugin.pb.h",
664    "protobuf/src/google/protobuf/compiler/python/python_generator.cc",
665    "protobuf/src/google/protobuf/compiler/python/python_generator.h",
666    "protobuf/src/google/protobuf/compiler/python/python_helpers.cc",
667    "protobuf/src/google/protobuf/compiler/python/python_helpers.h",
668    "protobuf/src/google/protobuf/compiler/python/python_pyi_generator.cc",
669    "protobuf/src/google/protobuf/compiler/python/python_pyi_generator.h",
670    "protobuf/src/google/protobuf/compiler/ruby/ruby_generator.cc",
671    "protobuf/src/google/protobuf/compiler/ruby/ruby_generator.h",
672    "protobuf/src/google/protobuf/compiler/scc.h",
673    "protobuf/src/google/protobuf/compiler/subprocess.cc",
674    "protobuf/src/google/protobuf/compiler/subprocess.h",
675    "protobuf/src/google/protobuf/compiler/zip_writer.cc",
676    "protobuf/src/google/protobuf/compiler/zip_writer.h",
677  ]
678  configs -= [ "//gn/standalone:extra_warnings" ]
679  if (is_win) {
680    # Protobuf does has its own #define WIN32_LEAN_AND_MEAN.
681    configs -= [ "//gn/standalone:win32_lean_and_mean" ]
682  }
683  configs += [ ":protobuf_config" ]
684  public_configs = [
685    "//gn:protobuf_gen_config",
686    ":protobuf_full_public_config",
687  ]
688}
689
690if (current_toolchain == host_toolchain) {
691  executable("protoc") {
692    visibility = _buildtools_visibility
693    deps = [
694      ":protoc_lib",
695      "//gn:default_deps",
696    ]
697    sources = [ "protobuf/src/google/protobuf/compiler/main.cc" ]
698    configs -= [ "//gn/standalone:extra_warnings" ]
699    if (is_win) {
700      # Protobuf does has its own #define WIN32_LEAN_AND_MEAN.
701      configs -= [ "//gn/standalone:win32_lean_and_mean" ]
702    }
703  }
704}  # host_toolchain
705
706if (use_custom_libcxx) {
707  config("libunwind_config") {
708    defines = [ "_LIBUNWIND_IS_NATIVE_ONLY" ]
709    cflags = [
710      "-fstrict-aliasing",
711      "-fPIC",
712
713      # ValueAsBitPattern in Unwind-EHABI.cpp is only used on Debug builds.
714      "-Wno-unused-function",
715
716      # libunwind expects to be compiled with unwind tables so it can
717      # unwind its own frames.
718      "-funwind-tables",
719    ]
720  }
721
722  source_set("libunwind") {
723    visibility = _buildtools_visibility
724    sources = [
725      # C++ sources
726      "libunwind/src/Unwind-EHABI.cpp",
727      "libunwind/src/libunwind.cpp",
728
729      # C sources
730      "libunwind/src/Unwind-sjlj.c",
731      "libunwind/src/UnwindLevel1-gcc-ext.c",
732      "libunwind/src/UnwindLevel1.c",
733
734      # ASM sources
735      "libunwind/src/UnwindRegistersRestore.S",
736      "libunwind/src/UnwindRegistersSave.S",
737    ]
738    include_dirs = [
739      "libunwind/include",
740      "libunwind/src",
741    ]
742    configs -= [
743      "//gn/standalone:extra_warnings",
744      "//gn/standalone:no_exceptions",
745      "//gn/standalone:no_rtti",
746
747      # When building with msan, libunwind itself triggers memory violations
748      # that causes msan to get stuck into an infinite loop. Just don't
749      # instrument libunwind itself.
750      "//gn/standalone/sanitizers:sanitizers_cflags",
751    ]
752    configs += [
753      "//gn/standalone/sanitizers:sanitizer_options_link_helper",
754
755      ":libunwind_config",
756    ]
757  }
758
759  # Config applied to both libc++ and libc++abi targets below.
760  config("libc++config") {
761    visibility = _buildtools_visibility
762    cflags = [ "-fstrict-aliasing" ]
763    if (is_win) {
764      cflags += [
765        # libc++ wants to redefine the macros WIN32_LEAN_AND_MEAN and
766        # _CRT_RAND_S in its implementation.
767        "-Wno-macro-redefined",
768      ]
769    } else {
770      cflags += [ "-fPIC" ]
771    }
772    configs = [ "//gn/standalone:c++20" ]
773    defines = [ "_LIBCPP_BUILDING_LIBRARY" ]
774  }
775
776  source_set("libc++abi") {
777    visibility = _buildtools_visibility
778
779    # Fuchsia builds don't link against any libraries that provide stack
780    # unwinding symbols, unlike Linux does with glibc (same applies for
781    # Android). Build and link against libunwind manually to get this
782    # functionality.
783    if (is_fuchsia || is_android) {
784      deps = [ ":libunwind" ]
785    }
786
787    sources = [
788      "libcxxabi/src/abort_message.cpp",
789      "libcxxabi/src/cxa_aux_runtime.cpp",
790      "libcxxabi/src/cxa_default_handlers.cpp",
791      "libcxxabi/src/cxa_exception.cpp",
792      "libcxxabi/src/cxa_exception_storage.cpp",
793      "libcxxabi/src/cxa_handlers.cpp",
794
795      # This file is supposed to be used in fno-exception builds of
796      # libc++abi.  We build lib++/libc++abi with exceptions enabled.
797      #"trunk/src/cxa_noexception.cpp",
798      "libcxxabi/src/cxa_personality.cpp",
799      "libcxxabi/src/cxa_vector.cpp",
800      "libcxxabi/src/cxa_virtual.cpp",
801      "libcxxabi/src/fallback_malloc.cpp",
802      "libcxxabi/src/private_typeinfo.cpp",
803      "libcxxabi/src/stdlib_exception.cpp",
804      "libcxxabi/src/stdlib_stdexcept.cpp",
805      "libcxxabi/src/stdlib_typeinfo.cpp",
806    ]
807
808    if (!is_tsan) {
809      sources += [ "libcxxabi/src/cxa_guard.cpp" ]
810    }
811
812    # See the comment in cxa_demangle_stub.cc for why we don't use LLVM's
813    # demangler on android.
814    sources += [ "libcxxabi/src/cxa_demangle.cpp" ]
815
816    if (is_fuchsia || is_android || is_linux) {
817      sources += [ "libcxxabi/src/cxa_thread_atexit.cpp" ]
818    }
819
820    defines = [
821      "LIBCXXABI_SILENT_TERMINATE",
822
823      # TODO(crbug.com/1298070) _LIBCPP_CONSTINIT is defined in a libc++
824      # revision more recent than the one currently used in Perfetto/Chrome.
825      "_LIBCPP_CONSTINIT=constinit",
826    ]
827
828    configs -= [
829      "//gn/standalone:extra_warnings",
830      "//gn/standalone:no_exceptions",
831      "//gn/standalone:no_rtti",
832      "//gn/standalone:c++17",
833    ]
834    configs += [
835      ":libc++config",
836      "//gn/standalone/sanitizers:sanitizer_options_link_helper",
837    ]
838    if (!custom_libcxx_is_static) {
839      configs -= [ "//gn/standalone:visibility_hidden" ]
840    }
841
842    # libc++abi depends on libc++ internals.
843    include_dirs = [ "libcxx/src" ]
844  }
845
846  # Explicitly set version macros to Windows 7 to prevent libc++ from adding a
847  # hard dependency on GetSystemTimePreciseAsFileTime, which was introduced in
848  # Windows 8.
849  config("libc++winver") {
850    defines = [
851      "NTDDI_VERSION=NTDDI_WIN7",
852      "_WIN32_WINNT=_WIN32_WINNT_WIN7",
853      "WINVER=_WIN32_WINNT_WIN7",
854    ]
855  }
856
857  if (custom_libcxx_is_static) {
858    libcxx_target_type = "source_set"
859  } else {
860    libcxx_target_type = "shared_library"
861  }
862
863  target(libcxx_target_type, "libc++") {
864    visibility = _buildtools_visibility
865    visibility += [ "../gn/standalone/libc++:*" ]
866
867    if (is_linux && !is_clang) {
868      libs = [ "atomic" ]
869    }
870
871    inputs = [ "libcxx_config/__config_site" ]
872
873    sources = [
874      "libcxx/src/algorithm.cpp",
875      "libcxx/src/any.cpp",
876      "libcxx/src/atomic.cpp",
877      "libcxx/src/barrier.cpp",
878      "libcxx/src/bind.cpp",
879      "libcxx/src/charconv.cpp",
880      "libcxx/src/chrono.cpp",
881      "libcxx/src/condition_variable.cpp",
882      "libcxx/src/condition_variable_destructor.cpp",
883      "libcxx/src/exception.cpp",
884      "libcxx/src/format.cpp",
885      "libcxx/src/functional.cpp",
886      "libcxx/src/future.cpp",
887      "libcxx/src/hash.cpp",
888      "libcxx/src/ios.cpp",
889      "libcxx/src/ios.instantiations.cpp",
890      "libcxx/src/iostream.cpp",
891      "libcxx/src/legacy_pointer_safety.cpp",
892      "libcxx/src/locale.cpp",
893      "libcxx/src/memory.cpp",
894      "libcxx/src/mutex.cpp",
895      "libcxx/src/mutex_destructor.cpp",
896      "libcxx/src/new.cpp",
897      "libcxx/src/optional.cpp",
898      "libcxx/src/random.cpp",
899      "libcxx/src/random_shuffle.cpp",
900      "libcxx/src/regex.cpp",
901      "libcxx/src/ryu/d2fixed.cpp",
902      "libcxx/src/ryu/d2s.cpp",
903      "libcxx/src/ryu/f2s.cpp",
904      "libcxx/src/shared_mutex.cpp",
905      "libcxx/src/stdexcept.cpp",
906      "libcxx/src/string.cpp",
907      "libcxx/src/strstream.cpp",
908      "libcxx/src/system_error.cpp",
909      "libcxx/src/thread.cpp",
910      "libcxx/src/typeinfo.cpp",
911      "libcxx/src/utility.cpp",
912      "libcxx/src/valarray.cpp",
913      "libcxx/src/variant.cpp",
914      "libcxx/src/vector.cpp",
915      "libcxx/src/verbose_abort.cpp",
916    ]
917
918    include_dirs = [ "libcxx/src" ]
919    if (is_win) {
920      sources += [
921        "libcxx/src/support/win32/locale_win32.cpp",
922        "libcxx/src/support/win32/support.cpp",
923        "libcxx/src/support/win32/thread_win32.cpp",
924      ]
925      configs += [ ":libc++winver" ]
926    }
927    configs -= [
928      "//gn/standalone:extra_warnings",
929      "//gn/standalone:no_exceptions",
930      "//gn/standalone:no_rtti",
931      "//gn/standalone:c++17",
932    ]
933    if ((is_android || is_mac) && !custom_libcxx_is_static) {
934      # Use libc++_perfetto to avoid conflicting with system libc++
935      output_name = "libc++_perfettto"
936    }
937    configs += [
938      ":libc++config",
939      "//gn/standalone/sanitizers:sanitizer_options_link_helper",
940    ]
941    if (!custom_libcxx_is_static) {
942      configs -= [ "//gn/standalone:visibility_hidden" ]
943    }
944
945    defines = []
946    if (custom_libcxx_is_static) {
947      if (is_mac && is_clang) {
948        # We want operator new/delete to be private on Mac, but these functions
949        # are implicitly created by the compiler for each translation unit, as
950        # specified in the C++ spec 3.7.4p2, which makes them always have
951        # default visibility.  This option is needed to force hidden visibility
952        # since -fvisibility=hidden doesn't have the desired effect.
953        cflags = [ "-fvisibility-global-new-delete-hidden" ]
954      } else {
955        defines += [
956          # This resets the visibility to default only for the various
957          # flavors of operator new and operator delete.  These symbols
958          # are weak and get overriden by Chromium-provided ones, but if
959          # these symbols had hidden visibility, this would make the
960          # Chromium symbols hidden too because elf visibility rules
961          # require that linkers use the least visible form when merging,
962          # and if this is hidden, then when we merge it with tcmalloc's
963          # operator new, hidden visibility would win. However, tcmalloc
964          # needs a visible operator new to also override operator new
965          # references from system libraries.
966          # TODO(lld): Ask lld for a --force-public-visibility flag or
967          # similar to that overrides the default elf merging rules, and
968          # make tcmalloc's gn config pass that to all its dependencies,
969          # then remove this override here.
970          "_LIBCPP_OVERRIDABLE_FUNC_VIS=__attribute__((__visibility__(\"default\")))",
971        ]
972      }
973    }
974    if (!is_mac && using_sanitizer && (is_asan || is_tsan || is_msan)) {
975      # In {a,t,m}san configurations, operator new and operator delete will be
976      # provided by the sanitizer runtime library.  Since libc++ defines these
977      # symbols with weak linkage, and the *san runtime uses strong linkage, it
978      # should technically be OK to omit this, but it's added to be explicit.
979      defines += [ "_LIBCPP_DISABLE_NEW_DELETE_DEFINITIONS" ]
980    }
981
982    if (!is_win) {
983      defines += [ "LIBCXX_BUILDING_LIBCXXABI" ]
984      deps = [ ":libc++abi" ]
985    }
986  }
987}  # if (use_custom_libcxx)
988
989config("benchmark_config") {
990  visibility = _buildtools_visibility
991  include_dirs = [ "benchmark/include" ]
992  configs = [ ":test_warning_suppressions" ]
993}
994
995source_set("benchmark") {
996  visibility = _buildtools_visibility
997  testonly = true
998  sources = [
999    "benchmark/include/benchmark/benchmark.h",
1000    "benchmark/src/arraysize.h",
1001    "benchmark/src/benchmark.cc",
1002    "benchmark/src/benchmark_api_internal.cc",
1003    "benchmark/src/benchmark_api_internal.h",
1004    "benchmark/src/benchmark_name.cc",
1005    "benchmark/src/benchmark_register.cc",
1006    "benchmark/src/benchmark_register.h",
1007    "benchmark/src/benchmark_runner.cc",
1008    "benchmark/src/benchmark_runner.h",
1009    "benchmark/src/check.h",
1010    "benchmark/src/colorprint.cc",
1011    "benchmark/src/colorprint.h",
1012    "benchmark/src/commandlineflags.cc",
1013    "benchmark/src/commandlineflags.h",
1014    "benchmark/src/complexity.cc",
1015    "benchmark/src/complexity.h",
1016    "benchmark/src/console_reporter.cc",
1017    "benchmark/src/counter.cc",
1018    "benchmark/src/counter.h",
1019    "benchmark/src/csv_reporter.cc",
1020    "benchmark/src/cycleclock.h",
1021    "benchmark/src/internal_macros.h",
1022    "benchmark/src/json_reporter.cc",
1023    "benchmark/src/log.h",
1024    "benchmark/src/mutex.h",
1025    "benchmark/src/perf_counters.cc",
1026    "benchmark/src/perf_counters.h",
1027    "benchmark/src/re.h",
1028    "benchmark/src/reporter.cc",
1029    "benchmark/src/sleep.cc",
1030    "benchmark/src/sleep.h",
1031    "benchmark/src/statistics.cc",
1032    "benchmark/src/statistics.h",
1033    "benchmark/src/string_util.cc",
1034    "benchmark/src/string_util.h",
1035    "benchmark/src/sysinfo.cc",
1036    "benchmark/src/thread_manager.h",
1037    "benchmark/src/thread_timer.h",
1038    "benchmark/src/timers.cc",
1039    "benchmark/src/timers.h",
1040  ]
1041  defines = [ "HAVE_POSIX_REGEX" ]
1042  public_configs = [ ":benchmark_config" ]
1043  all_dependent_configs = [ ":benchmark_config" ]
1044  if (!is_win) {
1045    cflags = [ "-Wno-deprecated-declarations" ]
1046  }
1047  configs -= [ "//gn/standalone:extra_warnings" ]
1048  deps = [ "//gn:default_deps" ]
1049}
1050
1051# On Linux/Android use libbacktrace in debug builds for better stacktraces.
1052if (is_linux || is_android) {
1053  config("libbacktrace_config") {
1054    visibility = _buildtools_visibility
1055    include_dirs = [
1056      "libbacktrace_config",
1057      "libbacktrace",
1058    ]
1059    cflags = [
1060      # We force include this config file because "config.h" is too generic as a
1061      # file name and on some platforms #include "config.h" ends up colliding
1062      # importing some other project's config.h.
1063      "-include",
1064      rebase_path("libbacktrace_config/config.h", root_build_dir),
1065    ]
1066  }
1067
1068  source_set("libbacktrace") {
1069    visibility = _buildtools_visibility
1070    sources = [
1071      "libbacktrace/dwarf.c",
1072      "libbacktrace/elf.c",
1073      "libbacktrace/fileline.c",
1074      "libbacktrace/mmap.c",
1075      "libbacktrace/mmapio.c",
1076      "libbacktrace/posix.c",
1077      "libbacktrace/sort.c",
1078      "libbacktrace/state.c",
1079    ]
1080    configs -= [ "//gn/standalone:extra_warnings" ]
1081    public_configs = [ ":libbacktrace_config" ]
1082    deps = [ "//gn:default_deps" ]
1083  }
1084}
1085
1086config("sqlite_config") {
1087  visibility = _buildtools_visibility
1088  include_dirs = [ "sqlite" ]
1089  cflags = [
1090    "-DSQLITE_THREADSAFE=0",
1091    "-DSQLITE_DEFAULT_MEMSTATUS=0",
1092    "-DSQLITE_LIKE_DOESNT_MATCH_BLOBS",
1093    "-DSQLITE_OMIT_DEPRECATED",
1094    "-DSQLITE_OMIT_SHARED_CACHE",
1095    "-DHAVE_USLEEP",
1096    "-DHAVE_UTIME",
1097    "-DSQLITE_BYTEORDER=1234",
1098    "-DSQLITE_DEFAULT_AUTOVACUUM=0",
1099    "-DSQLITE_DEFAULT_MMAP_SIZE=0",
1100    "-DSQLITE_CORE",
1101    "-DSQLITE_TEMP_STORE=3",
1102    "-DSQLITE_OMIT_LOAD_EXTENSION",
1103    "-DSQLITE_OMIT_RANDOMNESS",
1104    "-DSQLITE_OMIT_AUTOINIT",
1105    "-DSQLITE_ENABLE_JSON1",
1106  ]
1107  if (is_clang && is_win) {
1108    # SQLite uses __int64 which clang complains about unless
1109    # we specify this flag.
1110    cflags += [ "-Wno-language-extension-token" ]
1111  }
1112}
1113
1114source_set("sqlite") {
1115  visibility = _buildtools_visibility
1116  if (perfetto_use_system_sqlite) {
1117    # Use the system sqlite library instead of the hermetic one.
1118    libs = [ "sqlite3" ]
1119  } else {
1120    sources = [
1121      "sqlite/sqlite3.c",
1122      "sqlite/sqlite3.h",
1123      "sqlite/sqlite3ext.h",
1124      "sqlite_src/ext/misc/percentile.c",
1125    ]
1126  }
1127  configs -= [ "//gn/standalone:extra_warnings" ]
1128  public_configs = [ ":sqlite_config" ]
1129  deps = [ "//gn:default_deps" ]
1130}
1131
1132source_set("lzma") {
1133  visibility = _buildtools_visibility
1134  defines = [ "_7ZIP_ST" ]
1135  sources = [
1136    "lzma/C/7zAlloc.c",
1137    "lzma/C/7zArcIn.c",
1138    "lzma/C/7zBuf.c",
1139    "lzma/C/7zBuf2.c",
1140    "lzma/C/7zCrc.c",
1141    "lzma/C/7zCrcOpt.c",
1142    "lzma/C/7zDec.c",
1143    "lzma/C/7zFile.c",
1144    "lzma/C/7zStream.c",
1145    "lzma/C/Aes.c",
1146    "lzma/C/AesOpt.c",
1147    "lzma/C/Alloc.c",
1148    "lzma/C/Bcj2.c",
1149    "lzma/C/Bra.c",
1150    "lzma/C/Bra86.c",
1151    "lzma/C/BraIA64.c",
1152    "lzma/C/CpuArch.c",
1153    "lzma/C/Delta.c",
1154    "lzma/C/LzFind.c",
1155    "lzma/C/Lzma2Dec.c",
1156    "lzma/C/Lzma2Enc.c",
1157    "lzma/C/Lzma86Dec.c",
1158    "lzma/C/Lzma86Enc.c",
1159    "lzma/C/LzmaDec.c",
1160    "lzma/C/LzmaEnc.c",
1161    "lzma/C/LzmaLib.c",
1162    "lzma/C/Ppmd7.c",
1163    "lzma/C/Ppmd7Dec.c",
1164    "lzma/C/Ppmd7Enc.c",
1165    "lzma/C/Sha256.c",
1166    "lzma/C/Sort.c",
1167    "lzma/C/Xz.c",
1168    "lzma/C/XzCrc64.c",
1169    "lzma/C/XzCrc64Opt.c",
1170    "lzma/C/XzDec.c",
1171    "lzma/C/XzEnc.c",
1172    "lzma/C/XzIn.c",
1173  ]
1174  configs -= [ "//gn/standalone:extra_warnings" ]
1175  cflags = [
1176    "-Wno-empty-body",
1177    "-Wno-enum-conversion",
1178  ]
1179  deps = [ "//gn:default_deps" ]
1180}
1181
1182source_set("zlib") {
1183  visibility = _buildtools_visibility
1184  sources = [
1185    "zlib/adler32.c",
1186    "zlib/chromeconf.h",
1187    "zlib/compress.c",
1188    "zlib/contrib/optimizations/insert_string.h",
1189    "zlib/cpu_features.c",
1190    "zlib/cpu_features.h",
1191    "zlib/crc32.c",
1192    "zlib/crc32.h",
1193    "zlib/deflate.c",
1194    "zlib/deflate.h",
1195    "zlib/gzclose.c",
1196    "zlib/gzguts.h",
1197    "zlib/gzlib.c",
1198    "zlib/gzread.c",
1199    "zlib/gzwrite.c",
1200    "zlib/infback.c",
1201    "zlib/inffast.c",
1202    "zlib/inffast.h",
1203    "zlib/inffixed.h",
1204    "zlib/inflate.c",
1205    "zlib/inflate.h",
1206    "zlib/inftrees.c",
1207    "zlib/inftrees.h",
1208    "zlib/trees.c",
1209    "zlib/trees.h",
1210    "zlib/uncompr.c",
1211    "zlib/zconf.h",
1212    "zlib/zlib.h",
1213    "zlib/zutil.c",
1214    "zlib/zutil.h",
1215  ]
1216  configs -= [ "//gn/standalone:extra_warnings" ]
1217  public_configs = [ ":zlib_config" ]
1218  deps = [ "//gn:default_deps" ]
1219
1220  if (is_win) {
1221    defines = [ "X86_WINDOWS" ]
1222  }
1223
1224  # TODO(primiano): look into ADLER32_SIMD_SSSE3 and other SIMD optimizations
1225  # (from chromium's third_party/zlib/BUILD.gn).
1226}
1227
1228config("zlib_config") {
1229  visibility = _buildtools_visibility
1230  defines = [
1231    "ZLIB_IMPLEMENTATION",
1232    "CHROMIUM_ZLIB_NO_CHROMECONF",
1233  ]
1234  cflags = [
1235    # Using -isystem instead of include_dirs (-I), so we don't need to suppress
1236    # warnings coming from third-party headers. Doing so would mask warnings in
1237    # our own code.
1238    perfetto_isystem_cflag,
1239    rebase_path("zlib", root_build_dir),
1240  ]
1241  if (is_clang) {
1242    cflags += [
1243      "-Wno-unknown-warning-option",
1244      "-Wno-deprecated-non-prototype",
1245    ]
1246  }
1247}
1248
1249# Here be dragons. Used only by standalone profiler builds, which are
1250# considered best effort. Since the headers use c++17 features, this source_set
1251# pushes -std=c++17 flags up the dependency tree, whereas the rest of the
1252# project continues to build under c++11. So the profilers end up linking
1253# together code built under different standards, and rely on that to be ABI
1254# compatible.
1255source_set("libunwindstack") {
1256  visibility = _buildtools_visibility
1257  include_dirs = [
1258    "android-unwinding/libunwindstack/include",
1259    "android-unwinding/libunwindstack",
1260    "android-libbase/include",
1261    "android-logging/liblog/include",
1262    "android-libprocinfo/include",
1263    "android-core/include",
1264    "android-core/libcutils/include",
1265    "bionic/libc/async_safe/include",
1266    "bionic/libc/platform/",
1267    "lzma/C",
1268  ]
1269  deps = [
1270    ":lzma",
1271    "//gn:default_deps",
1272  ]
1273  sources = [
1274    "android-libbase/file.cpp",
1275    "android-libbase/stringprintf.cpp",
1276    "android-libbase/strings.cpp",
1277    "android-unwinding/libunwindstack/ArmExidx.cpp",
1278    "android-unwinding/libunwindstack/DwarfCfa.cpp",
1279    "android-unwinding/libunwindstack/DwarfEhFrameWithHdr.cpp",
1280    "android-unwinding/libunwindstack/DwarfMemory.cpp",
1281    "android-unwinding/libunwindstack/DwarfOp.cpp",
1282    "android-unwinding/libunwindstack/DwarfSection.cpp",
1283    "android-unwinding/libunwindstack/Elf.cpp",
1284    "android-unwinding/libunwindstack/ElfInterface.cpp",
1285    "android-unwinding/libunwindstack/ElfInterfaceArm.cpp",
1286    "android-unwinding/libunwindstack/Global.cpp",
1287    "android-unwinding/libunwindstack/JitDebug.cpp",
1288    "android-unwinding/libunwindstack/MapInfo.cpp",
1289    "android-unwinding/libunwindstack/Maps.cpp",
1290    "android-unwinding/libunwindstack/Memory.cpp",
1291    "android-unwinding/libunwindstack/MemoryXz.cpp",
1292    "android-unwinding/libunwindstack/Regs.cpp",
1293    "android-unwinding/libunwindstack/RegsArm.cpp",
1294    "android-unwinding/libunwindstack/RegsArm64.cpp",
1295    "android-unwinding/libunwindstack/RegsMips.cpp",
1296    "android-unwinding/libunwindstack/RegsMips64.cpp",
1297    "android-unwinding/libunwindstack/RegsRiscv64.cpp",
1298    "android-unwinding/libunwindstack/RegsX86.cpp",
1299    "android-unwinding/libunwindstack/RegsX86_64.cpp",
1300    "android-unwinding/libunwindstack/Symbols.cpp",
1301    "android-unwinding/libunwindstack/Unwinder.cpp",
1302  ]
1303  if (!is_android) {
1304    sources += [
1305      "android-libbase/liblog_symbols.cpp",
1306      "android-libbase/logging.cpp",
1307      "android-libbase/threads.cpp",
1308      "android-logging/liblog/logger_write.cpp",
1309      "android-logging/liblog/properties.cpp",
1310      "android-unwinding/libunwindstack/LogStdout.cpp",
1311      "android-unwinding/libunwindstack/MemoryMte.cpp",
1312    ]
1313  } else {
1314    sources += [ "android-unwinding/libunwindstack/LogAndroid.cpp" ]
1315  }
1316  if (current_cpu == "x86") {
1317    sources += [ "android-unwinding/libunwindstack/AsmGetRegsX86.S" ]
1318  } else if (current_cpu == "x64") {
1319    sources += [ "android-unwinding/libunwindstack/AsmGetRegsX86_64.S" ]
1320  }
1321  configs -= [
1322    "//gn/standalone:extra_warnings",
1323    "//gn/standalone:visibility_hidden",
1324  ]
1325  cflags = [ "-DFAKE_LOG_DEVICE=1" ]
1326  if (!is_win) {
1327    cflags += [ "-Wno-deprecated-declarations" ]
1328  }
1329  public_configs = [ ":libunwindstack_config" ]
1330}
1331
1332config("bionic_kernel_uapi_headers") {
1333  visibility = _buildtools_visibility
1334  cflags = [
1335    perfetto_isystem_cflag,
1336    rebase_path("bionic/libc/kernel", root_build_dir),
1337  ]
1338}
1339
1340config("jsoncpp_config") {
1341  visibility = _buildtools_visibility
1342  cflags = [ "-DJSON_USE_EXCEPTION=0" ]
1343  cflags += [
1344    # Using -isystem instead of include_dirs (-I), so we don't need to suppress
1345    # warnings coming from third-party headers. Doing so would mask warnings in
1346    # our own code.
1347    perfetto_isystem_cflag,
1348    rebase_path("jsoncpp/include", root_build_dir),
1349  ]
1350  if (!is_win) {
1351    cflags += [ "-Wno-deprecated-declarations" ]
1352  }
1353  if (is_clang && is_win) {
1354    # JSON uses __int64 which clang complains about unless we specify this flag.
1355    cflags += [ "-Wno-language-extension-token" ]
1356  }
1357}
1358
1359source_set("jsoncpp") {
1360  visibility = _buildtools_visibility
1361  sources = [
1362    "jsoncpp/src/lib_json/json_reader.cpp",
1363    "jsoncpp/src/lib_json/json_value.cpp",
1364    "jsoncpp/src/lib_json/json_writer.cpp",
1365  ]
1366  configs -= [ "//gn/standalone:extra_warnings" ]
1367  public_configs = [ ":jsoncpp_config" ]
1368  deps = [ "//gn:default_deps" ]
1369}
1370
1371config("linenoise_config") {
1372  visibility = _buildtools_visibility
1373  cflags = [
1374    # Using -isystem instead of include_dirs (-I), so we don't need to suppress
1375    # warnings coming from third-party headers. Doing so would mask warnings in
1376    # our own code.
1377    perfetto_isystem_cflag,
1378    rebase_path("linenoise", root_build_dir),
1379  ]
1380}
1381
1382source_set("linenoise") {
1383  visibility = _buildtools_visibility
1384  sources = [
1385    "linenoise/linenoise.c",
1386    "linenoise/linenoise.h",
1387  ]
1388  configs -= [ "//gn/standalone:extra_warnings" ]
1389  public_configs = [ ":linenoise_config" ]
1390  cflags = [ "-Wno-tautological-unsigned-zero-compare" ]
1391  deps = [ "//gn:default_deps" ]
1392}
1393
1394if (use_libfuzzer) {
1395  source_set("libfuzzer") {
1396    visibility = _buildtools_visibility
1397    configs -= [
1398      "//gn/standalone:extra_warnings",
1399      "//gn/standalone/sanitizers:sanitizers_cflags",
1400    ]
1401    sources = [
1402      "libfuzzer/FuzzerCrossOver.cpp",
1403      "libfuzzer/FuzzerDataFlowTrace.cpp",
1404      "libfuzzer/FuzzerDriver.cpp",
1405      "libfuzzer/FuzzerExtFunctionsDlsym.cpp",
1406      "libfuzzer/FuzzerExtFunctionsWeak.cpp",
1407      "libfuzzer/FuzzerExtFunctionsWindows.cpp",
1408      "libfuzzer/FuzzerExtraCounters.cpp",
1409      "libfuzzer/FuzzerFork.cpp",
1410      "libfuzzer/FuzzerIO.cpp",
1411      "libfuzzer/FuzzerIOPosix.cpp",
1412      "libfuzzer/FuzzerIOWindows.cpp",
1413      "libfuzzer/FuzzerLoop.cpp",
1414      "libfuzzer/FuzzerMain.cpp",
1415      "libfuzzer/FuzzerMerge.cpp",
1416      "libfuzzer/FuzzerMutate.cpp",
1417      "libfuzzer/FuzzerSHA1.cpp",
1418      "libfuzzer/FuzzerTracePC.cpp",
1419      "libfuzzer/FuzzerUtil.cpp",
1420      "libfuzzer/FuzzerUtilDarwin.cpp",
1421      "libfuzzer/FuzzerUtilFuchsia.cpp",
1422      "libfuzzer/FuzzerUtilLinux.cpp",
1423      "libfuzzer/FuzzerUtilPosix.cpp",
1424      "libfuzzer/FuzzerUtilWindows.cpp",
1425    ]
1426    deps = [ "//gn:default_deps" ]
1427  }
1428}
1429
1430config("llvm_demangle_config") {
1431  visibility = _buildtools_visibility
1432  include_dirs = [ "llvm-project/llvm/include" ]
1433}
1434
1435source_set("llvm_demangle") {
1436  visibility = _buildtools_visibility
1437  configs -= [ "//gn/standalone:extra_warnings" ]
1438  public_configs = [ ":llvm_demangle_config" ]
1439  sources = [
1440    "llvm-project/llvm/include/llvm/Demangle/Demangle.h",
1441    "llvm-project/llvm/include/llvm/Demangle/DemangleConfig.h",
1442    "llvm-project/llvm/include/llvm/Demangle/ItaniumDemangle.h",
1443    "llvm-project/llvm/include/llvm/Demangle/MicrosoftDemangle.h",
1444    "llvm-project/llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h",
1445    "llvm-project/llvm/include/llvm/Demangle/StringView.h",
1446    "llvm-project/llvm/include/llvm/Demangle/Utility.h",
1447    "llvm-project/llvm/lib/Demangle/DLangDemangle.cpp",
1448    "llvm-project/llvm/lib/Demangle/Demangle.cpp",
1449    "llvm-project/llvm/lib/Demangle/ItaniumDemangle.cpp",
1450    "llvm-project/llvm/lib/Demangle/MicrosoftDemangle.cpp",
1451    "llvm-project/llvm/lib/Demangle/MicrosoftDemangleNodes.cpp",
1452    "llvm-project/llvm/lib/Demangle/RustDemangle.cpp",
1453  ]
1454  deps = [ "//gn:default_deps" ]
1455}
1456
1457if (enable_perfetto_grpc) {
1458  config("grpc_absl_config") {
1459    visibility = _buildtools_visibility
1460    include_dirs = [ "grpc/src/third_party/abseil-cpp" ]
1461    cflags = [ "-Wno-deprecated-builtins" ]
1462  }
1463
1464  config("grpc_boringssl_config") {
1465    visibility = _buildtools_visibility
1466    include_dirs = [ "grpc/src/third_party/boringssl-with-bazel/src/include" ]
1467  }
1468
1469  config("grpc_upb_config") {
1470    visibility = _buildtools_visibility
1471    include_dirs = [
1472      "grpc/src/third_party/upb",
1473      "grpc/src/src/core/ext/upb-generated",
1474      "grpc/src/src/core/ext/upbdefs-generated",
1475    ]
1476  }
1477
1478  config("grpc_re2_config") {
1479    visibility = _buildtools_visibility
1480    include_dirs = [ "grpc/src/third_party/re2" ]
1481  }
1482
1483  config("grpc_internal_config") {
1484    visibility = _buildtools_visibility
1485    include_dirs = [
1486      "grpc/src/include",
1487      "grpc/src",
1488      "grpc/src/third_party/address_sorting/include",
1489      "grpc/src/third_party/re2",
1490      "grpc/src/src/core/ext/upb-generated",
1491      "grpc/src/src/core/ext/upbdefs-generated",
1492      "grpc/src/third_party/xxhash",
1493    ]
1494    cflags = [ "-DGRPC_ARES=0" ]
1495  }
1496
1497  config("grpc_gen_config") {
1498    cflags = [
1499      # Using -isystem instead of include_dirs (-I), so we don't need to
1500      # suppress warnings coming from libprotobuf headers. Doing so would mask
1501      # warnings in our own code.
1502      perfetto_isystem_cflag,
1503      rebase_path("grpc/src/include", root_build_dir),
1504      perfetto_isystem_cflag,
1505      rebase_path("grpc/src/third_party/abseil-cpp", root_build_dir),
1506    ]
1507
1508    # This issues appear in .grpc.pb.h files so we unfortunately need to leak
1509    # the cflags outside of just compiling this code.
1510    if (is_clang && !is_win) {
1511      cflags += [
1512        "-Wno-weak-vtables",
1513        "-Wno-suggest-destructor-override",
1514      ]
1515    }
1516  }
1517}
1518