Home | History | Annotate | Download | only in buildtools
      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 
     15 import("//gn/standalone/libc++/libc++.gni")
     16 
     17 # Used to suppress warnings coming from googletest macros expansions.
     18 config("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 
     34 # 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.
     38 config("googletest_prod_config") {
     39   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   ]
     46 }
     47 
     48 # Config to include gtest.h in test targets.
     49 config("googletest_config") {
     50   defines = [ "GTEST_LANG_CXX11=1" ]
     51   cflags = [
     52     # 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),
     59   ]
     60   configs = [ ":test_warning_suppressions" ]
     61 }
     62 
     63 source_set("gtest") {
     64   testonly = true
     65   include_dirs = [ "googletest/googletest" ]
     66   configs -= [ "//gn/standalone:extra_warnings" ]
     67   public_configs = [ ":googletest_config" ]
     68   all_dependent_configs = [ ":googletest_config" ]
     69   sources = [
     70     "googletest/googletest/src/gtest-all.cc",
     71   ]
     72 }
     73 
     74 source_set("gtest_main") {
     75   testonly = true
     76   configs -= [ "//gn/standalone:extra_warnings" ]
     77   configs += [ ":googletest_config" ]
     78   sources = [
     79     "googletest/googletest/src/gtest_main.cc",
     80   ]
     81 }
     82 
     83 source_set("gmock") {
     84   testonly = true
     85   include_dirs = [ "googletest/googlemock" ]
     86   configs -= [ "//gn/standalone:extra_warnings" ]
     87   public_configs = [ ":googletest_config" ]
     88   all_dependent_configs = [ ":googletest_config" ]
     89   sources = [
     90     "googletest/googlemock/src/gmock-all.cc",
     91   ]
     92 }
     93 
     94 # This config is applied to the autogenerated .pb.{cc,h} files in
     95 # //gn/standalone/proto_library.gni. This config is propagated up to the source sets
     96 # 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.
    100 config("protobuf_gen_config") {
    101   defines = [
    102     "GOOGLE_PROTOBUF_NO_RTTI",
    103     "GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER",
    104   ]
    105   cflags = [
    106     # 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",
    112     "-Wno-deprecated",
    113     "-Wno-undef",
    114     "-Wno-zero-as-null-pointer-constant",
    115   ]
    116 }
    117 
    118 # Configuration used to build libprotobuf_* and the protoc compiler.
    119 config("protobuf_config") {
    120   # Apply the lighter supressions and macro definitions from above.
    121   configs = [ ":protobuf_gen_config" ]
    122 
    123   defines = [ "HAVE_PTHREAD=1" ]
    124   if (is_clang) {
    125     cflags = [
    126       "-Wno-unknown-warning-option",
    127       "-Wno-enum-compare-switch",
    128       "-Wno-user-defined-warnings",
    129     ]
    130   }
    131 }
    132 
    133 source_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   ]
    159   configs -= [ "//gn/standalone:extra_warnings" ]
    160   configs += [ ":protobuf_config" ]
    161   public_configs = [ ":protobuf_gen_config" ]
    162 }
    163 
    164 source_set("protobuf_full") {
    165   deps = [
    166     ":protobuf_lite",
    167   ]
    168   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   ]
    223   configs -= [ "//gn/standalone:extra_warnings" ]
    224   configs += [ ":protobuf_config" ]
    225   public_configs = [ ":protobuf_gen_config" ]
    226 }
    227 
    228 if (current_toolchain == host_toolchain) {
    229   source_set("protoc_lib") {
    230     deps = [
    231       ":protobuf_full",
    232     ]
    233     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",
    307       "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     ]
    326     configs -= [ "//gn/standalone:extra_warnings" ]
    327     configs += [ ":protobuf_config" ]
    328     public_configs = [ ":protobuf_gen_config" ]
    329   }
    330 
    331   executable("protoc") {
    332     deps = [
    333       ":protoc_lib",
    334       "//gn:default_deps",
    335     ]
    336     sources = [
    337       "protobuf/src/google/protobuf/compiler/main.cc",
    338     ]
    339     configs -= [ "//gn/standalone:extra_warnings" ]
    340   }
    341 }  # host_toolchain
    342 
    343 if (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 
    357   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 -= [
    369       "//gn/standalone:extra_warnings",
    370       "//gn/standalone:no_exceptions",
    371       "//gn/standalone:no_rtti",
    372 
    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.
    376       "//gn/standalone/sanitizers:sanitizers_cflags",
    377     ]
    378     configs += [
    379       ":libc++config",
    380       "//gn/standalone/sanitizers:sanitizer_options_link_helper",
    381     ]
    382   }
    383 
    384   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 -= [
    410       "//gn/standalone:extra_warnings",
    411       "//gn/standalone:no_exceptions",
    412       "//gn/standalone:no_rtti",
    413       "//gn/standalone:visibility_hidden",
    414     ]
    415     configs += [
    416       ":libc++config",
    417       "//gn/standalone/sanitizers:sanitizer_options_link_helper",
    418     ]
    419     deps = [
    420       ":libunwind",
    421     ]
    422   }
    423 
    424   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++") {
    431     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 -= [
    463       "//gn/standalone:extra_warnings",
    464       "//gn/standalone:no_exceptions",
    465       "//gn/standalone:no_rtti",
    466       "//gn/standalone:visibility_hidden",
    467     ]
    468     configs += [
    469       ":libc++config",
    470       "//gn/standalone/sanitizers:sanitizer_options_link_helper",
    471     ]
    472     defines = [ "_LIBCPP_BUILDING_LIBRARY" ]
    473     deps = [
    474       ":libc++abi",
    475     ]
    476   }
    477 }  # if (use_custom_libcxx)
    478 
    479 config("benchmark_config") {
    480   include_dirs = [ "benchmark/include" ]
    481   configs = [ ":test_warning_suppressions" ]
    482 }
    483 
    484 source_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",
    514     "benchmark/src/statistics.cc",
    515     "benchmark/src/statistics.h",
    516     "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" ]
    526   configs -= [ "//gn/standalone:extra_warnings" ]
    527 }
    528 
    529 # On Linux/Android use libbacktrace in debug builds for better stacktraces.
    530 if (is_linux || is_android) {
    531   config("libbacktrace_config") {
    532     include_dirs = [
    533       "libbacktrace_config",
    534       "libbacktrace",
    535     ]
    536     cflags = [
    537       # 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.
    540       "-include",
    541       rebase_path("libbacktrace_config/config.h", root_build_dir),
    542     ]
    543   }
    544 
    545   source_set("libbacktrace") {
    546     sources = [
    547       "libbacktrace/dwarf.c",
    548       "libbacktrace/elf.c",
    549       "libbacktrace/fileline.c",
    550       "libbacktrace/mmap.c",
    551       "libbacktrace/mmapio.c",
    552       "libbacktrace/posix.c",
    553       "libbacktrace/sort.c",
    554       "libbacktrace/state.c",
    555     ]
    556     configs -= [ "//gn/standalone:extra_warnings" ]
    557     public_configs = [ ":libbacktrace_config" ]
    558   }
    559 }
    560