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/standalone/libc++/libc++.gni") 16import("../gn/perfetto.gni") 17 18# Used to suppress warnings coming from googletest macros expansions. 19config("test_warning_suppressions") { 20 cflags = [ 21 "-Wno-unknown-warning-option", 22 "-Wno-global-constructors", 23 "-Wno-covered-switch-default", 24 "-Wno-used-but-marked-unused", 25 "-Wno-covered-switch-default", 26 "-Wno-global-constructors", 27 "-Wno-used-but-marked-unused", 28 "-Wno-inconsistent-missing-override", 29 "-Wno-unused-member-function", 30 "-Wno-zero-as-null-pointer-constant", 31 "-Wno-weak-vtables", 32 ] 33} 34 35# Mimimal config to be used in production (i.e. non-test) targets. This is 36# really just to allowing include "gtest/gtest_prod.h" for the FRIEND_TEST macro 37# and avoid to pull in warning suppressions that are not really necessary for 38# production code. 39config("googletest_prod_config") { 40 cflags = [ 41 # Using -isystem instead of include_dirs (-I), so we don't need to suppress 42 # warnings coming from third-party headers. Doing so would mask warnings in 43 # our own code. 44 "-isystem", 45 rebase_path("googletest/googletest/include", root_build_dir), 46 ] 47} 48 49config("libunwindstack_config") { 50 cflags = [ 51 # Using -isystem instead of include_dirs (-I), so we don't need to suppress 52 # warnings coming from libunwindstack headers. Doing so would mask warnings 53 # in our own code. 54 "-isystem", 55 rebase_path("android-core/libunwindstack/include", root_build_dir), 56 "-isystem", 57 rebase_path("android-core/libprocinfo/include", root_build_dir), 58 "-isystem", 59 rebase_path("android-core/base/include", root_build_dir), 60 "-isystem", 61 rebase_path("android-core/demangle/include", root_build_dir), 62 ] 63 if (is_android) { 64 cflags += [ 65 "-isystem", 66 rebase_path("bionic/libc/include", root_build_dir), 67 ] 68 } 69 defines = [ "NO_LIBDEXFILE_SUPPORT" ] 70} 71 72# Config to include gtest.h in test targets. 73config("googletest_config") { 74 defines = [ "GTEST_LANG_CXX11=1" ] 75 cflags = [ 76 # Using -isystem instead of include_dirs (-I), so we don't need to suppress 77 # warnings coming from third-party headers. Doing so would mask warnings in 78 # our own code. 79 "-isystem", 80 rebase_path("googletest/googletest/include", root_build_dir), 81 "-isystem", 82 rebase_path("googletest/googlemock/include", root_build_dir), 83 ] 84 configs = [ ":test_warning_suppressions" ] 85} 86 87source_set("gtest") { 88 testonly = true 89 include_dirs = [ "googletest/googletest" ] 90 configs -= [ "//gn/standalone:extra_warnings" ] 91 public_configs = [ ":googletest_config" ] 92 all_dependent_configs = [ ":googletest_config" ] 93 sources = [ 94 "googletest/googletest/src/gtest-all.cc", 95 ] 96} 97 98source_set("gtest_main") { 99 testonly = true 100 configs -= [ "//gn/standalone:extra_warnings" ] 101 configs += [ ":googletest_config" ] 102 sources = [ 103 "googletest/googletest/src/gtest_main.cc", 104 ] 105} 106 107source_set("gmock") { 108 testonly = true 109 include_dirs = [ "googletest/googlemock" ] 110 configs -= [ "//gn/standalone:extra_warnings" ] 111 public_configs = [ ":googletest_config" ] 112 all_dependent_configs = [ ":googletest_config" ] 113 sources = [ 114 "googletest/googlemock/src/gmock-all.cc", 115 ] 116} 117 118# This config is applied to the autogenerated .pb.{cc,h} files in 119# //gn/standalone/proto_library.gni. This config is propagated up to the source sets 120# that depend on generated proto headers. Therefore this should stay as lean and 121# clean as possible in terms of -W-no* suppressions. Thankfully the 122# autogenerated .pb.h headers violate less warnings than the libprotobuf_* 123# library itself. 124config("protobuf_gen_config") { 125 defines = [ 126 "GOOGLE_PROTOBUF_NO_RTTI", 127 "GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER", 128 ] 129 cflags = [ 130 # Using -isystem instead of include_dirs (-I), so we don't need to suppress 131 # warnings coming from libprotobuf headers. Doing so would mask warnings in 132 # our own code. 133 "-isystem", 134 rebase_path("protobuf/src", root_build_dir), 135 "-Wno-unknown-warning-option", 136 "-Wno-deprecated", 137 "-Wno-undef", 138 "-Wno-zero-as-null-pointer-constant", 139 ] 140} 141 142# Configuration used to build libprotobuf_* and the protoc compiler. 143config("protobuf_config") { 144 # Apply the lighter supressions and macro definitions from above. 145 configs = [ ":protobuf_gen_config" ] 146 147 defines = [ "HAVE_PTHREAD=1" ] 148 if (is_clang) { 149 cflags = [ 150 "-Wno-unknown-warning-option", 151 "-Wno-enum-compare-switch", 152 "-Wno-user-defined-warnings", 153 "-Wno-tautological-constant-compare", 154 ] 155 } 156} 157 158source_set("protobuf_lite") { 159 sources = [ 160 "protobuf/src/google/protobuf/arena.cc", 161 "protobuf/src/google/protobuf/arenastring.cc", 162 "protobuf/src/google/protobuf/extension_set.cc", 163 "protobuf/src/google/protobuf/generated_message_util.cc", 164 "protobuf/src/google/protobuf/io/coded_stream.cc", 165 "protobuf/src/google/protobuf/io/zero_copy_stream.cc", 166 "protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.cc", 167 "protobuf/src/google/protobuf/message_lite.cc", 168 "protobuf/src/google/protobuf/repeated_field.cc", 169 "protobuf/src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc", 170 "protobuf/src/google/protobuf/stubs/atomicops_internals_x86_msvc.cc", 171 "protobuf/src/google/protobuf/stubs/bytestream.cc", 172 "protobuf/src/google/protobuf/stubs/common.cc", 173 "protobuf/src/google/protobuf/stubs/int128.cc", 174 "protobuf/src/google/protobuf/stubs/once.cc", 175 "protobuf/src/google/protobuf/stubs/status.cc", 176 "protobuf/src/google/protobuf/stubs/statusor.cc", 177 "protobuf/src/google/protobuf/stubs/stringpiece.cc", 178 "protobuf/src/google/protobuf/stubs/stringprintf.cc", 179 "protobuf/src/google/protobuf/stubs/structurally_valid.cc", 180 "protobuf/src/google/protobuf/stubs/strutil.cc", 181 "protobuf/src/google/protobuf/stubs/time.cc", 182 "protobuf/src/google/protobuf/wire_format_lite.cc", 183 ] 184 configs -= [ "//gn/standalone:extra_warnings" ] 185 configs += [ ":protobuf_config" ] 186 public_configs = [ ":protobuf_gen_config" ] 187} 188 189source_set("protobuf_full") { 190 deps = [ 191 ":protobuf_lite", 192 ] 193 sources = [ 194 "protobuf/src/google/protobuf/any.cc", 195 "protobuf/src/google/protobuf/any.pb.cc", 196 "protobuf/src/google/protobuf/api.pb.cc", 197 "protobuf/src/google/protobuf/compiler/importer.cc", 198 "protobuf/src/google/protobuf/compiler/parser.cc", 199 "protobuf/src/google/protobuf/descriptor.cc", 200 "protobuf/src/google/protobuf/descriptor.pb.cc", 201 "protobuf/src/google/protobuf/descriptor_database.cc", 202 "protobuf/src/google/protobuf/duration.pb.cc", 203 "protobuf/src/google/protobuf/dynamic_message.cc", 204 "protobuf/src/google/protobuf/empty.pb.cc", 205 "protobuf/src/google/protobuf/extension_set_heavy.cc", 206 "protobuf/src/google/protobuf/field_mask.pb.cc", 207 "protobuf/src/google/protobuf/generated_message_reflection.cc", 208 "protobuf/src/google/protobuf/io/gzip_stream.cc", 209 "protobuf/src/google/protobuf/io/printer.cc", 210 "protobuf/src/google/protobuf/io/strtod.cc", 211 "protobuf/src/google/protobuf/io/tokenizer.cc", 212 "protobuf/src/google/protobuf/io/zero_copy_stream_impl.cc", 213 "protobuf/src/google/protobuf/map_field.cc", 214 "protobuf/src/google/protobuf/message.cc", 215 "protobuf/src/google/protobuf/reflection_ops.cc", 216 "protobuf/src/google/protobuf/service.cc", 217 "protobuf/src/google/protobuf/source_context.pb.cc", 218 "protobuf/src/google/protobuf/struct.pb.cc", 219 "protobuf/src/google/protobuf/stubs/mathlimits.cc", 220 "protobuf/src/google/protobuf/stubs/substitute.cc", 221 "protobuf/src/google/protobuf/text_format.cc", 222 "protobuf/src/google/protobuf/timestamp.pb.cc", 223 "protobuf/src/google/protobuf/type.pb.cc", 224 "protobuf/src/google/protobuf/unknown_field_set.cc", 225 "protobuf/src/google/protobuf/util/field_comparator.cc", 226 "protobuf/src/google/protobuf/util/field_mask_util.cc", 227 "protobuf/src/google/protobuf/util/internal/datapiece.cc", 228 "protobuf/src/google/protobuf/util/internal/default_value_objectwriter.cc", 229 "protobuf/src/google/protobuf/util/internal/error_listener.cc", 230 "protobuf/src/google/protobuf/util/internal/field_mask_utility.cc", 231 "protobuf/src/google/protobuf/util/internal/json_escaping.cc", 232 "protobuf/src/google/protobuf/util/internal/json_objectwriter.cc", 233 "protobuf/src/google/protobuf/util/internal/json_stream_parser.cc", 234 "protobuf/src/google/protobuf/util/internal/object_writer.cc", 235 "protobuf/src/google/protobuf/util/internal/proto_writer.cc", 236 "protobuf/src/google/protobuf/util/internal/protostream_objectsource.cc", 237 "protobuf/src/google/protobuf/util/internal/protostream_objectwriter.cc", 238 "protobuf/src/google/protobuf/util/internal/type_info.cc", 239 "protobuf/src/google/protobuf/util/internal/type_info_test_helper.cc", 240 "protobuf/src/google/protobuf/util/internal/utility.cc", 241 "protobuf/src/google/protobuf/util/json_util.cc", 242 "protobuf/src/google/protobuf/util/message_differencer.cc", 243 "protobuf/src/google/protobuf/util/time_util.cc", 244 "protobuf/src/google/protobuf/util/type_resolver_util.cc", 245 "protobuf/src/google/protobuf/wire_format.cc", 246 "protobuf/src/google/protobuf/wrappers.pb.cc", 247 ] 248 configs -= [ "//gn/standalone:extra_warnings" ] 249 configs += [ ":protobuf_config" ] 250 public_configs = [ ":protobuf_gen_config" ] 251} 252 253if (current_toolchain == host_toolchain) { 254 source_set("protoc_lib") { 255 deps = [ 256 ":protobuf_full", 257 ] 258 sources = [ 259 "protobuf/src/google/protobuf/compiler/code_generator.cc", 260 "protobuf/src/google/protobuf/compiler/command_line_interface.cc", 261 "protobuf/src/google/protobuf/compiler/cpp/cpp_enum.cc", 262 "protobuf/src/google/protobuf/compiler/cpp/cpp_enum_field.cc", 263 "protobuf/src/google/protobuf/compiler/cpp/cpp_extension.cc", 264 "protobuf/src/google/protobuf/compiler/cpp/cpp_field.cc", 265 "protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc", 266 "protobuf/src/google/protobuf/compiler/cpp/cpp_generator.cc", 267 "protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc", 268 "protobuf/src/google/protobuf/compiler/cpp/cpp_map_field.cc", 269 "protobuf/src/google/protobuf/compiler/cpp/cpp_message.cc", 270 "protobuf/src/google/protobuf/compiler/cpp/cpp_message_field.cc", 271 "protobuf/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc", 272 "protobuf/src/google/protobuf/compiler/cpp/cpp_service.cc", 273 "protobuf/src/google/protobuf/compiler/cpp/cpp_string_field.cc", 274 "protobuf/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc", 275 "protobuf/src/google/protobuf/compiler/csharp/csharp_enum.cc", 276 "protobuf/src/google/protobuf/compiler/csharp/csharp_enum_field.cc", 277 "protobuf/src/google/protobuf/compiler/csharp/csharp_field_base.cc", 278 "protobuf/src/google/protobuf/compiler/csharp/csharp_generator.cc", 279 "protobuf/src/google/protobuf/compiler/csharp/csharp_helpers.cc", 280 "protobuf/src/google/protobuf/compiler/csharp/csharp_map_field.cc", 281 "protobuf/src/google/protobuf/compiler/csharp/csharp_message.cc", 282 "protobuf/src/google/protobuf/compiler/csharp/csharp_message_field.cc", 283 "protobuf/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc", 284 "protobuf/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc", 285 "protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc", 286 "protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc", 287 "protobuf/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc", 288 "protobuf/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc", 289 "protobuf/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc", 290 "protobuf/src/google/protobuf/compiler/java/java_context.cc", 291 "protobuf/src/google/protobuf/compiler/java/java_doc_comment.cc", 292 "protobuf/src/google/protobuf/compiler/java/java_enum.cc", 293 "protobuf/src/google/protobuf/compiler/java/java_enum_field.cc", 294 "protobuf/src/google/protobuf/compiler/java/java_enum_field_lite.cc", 295 "protobuf/src/google/protobuf/compiler/java/java_enum_lite.cc", 296 "protobuf/src/google/protobuf/compiler/java/java_extension.cc", 297 "protobuf/src/google/protobuf/compiler/java/java_extension_lite.cc", 298 "protobuf/src/google/protobuf/compiler/java/java_field.cc", 299 "protobuf/src/google/protobuf/compiler/java/java_file.cc", 300 "protobuf/src/google/protobuf/compiler/java/java_generator.cc", 301 "protobuf/src/google/protobuf/compiler/java/java_generator_factory.cc", 302 "protobuf/src/google/protobuf/compiler/java/java_helpers.cc", 303 "protobuf/src/google/protobuf/compiler/java/java_lazy_message_field.cc", 304 "protobuf/src/google/protobuf/compiler/java/java_lazy_message_field_lite.cc", 305 "protobuf/src/google/protobuf/compiler/java/java_map_field.cc", 306 "protobuf/src/google/protobuf/compiler/java/java_map_field_lite.cc", 307 "protobuf/src/google/protobuf/compiler/java/java_message.cc", 308 "protobuf/src/google/protobuf/compiler/java/java_message_builder.cc", 309 "protobuf/src/google/protobuf/compiler/java/java_message_builder_lite.cc", 310 "protobuf/src/google/protobuf/compiler/java/java_message_field.cc", 311 "protobuf/src/google/protobuf/compiler/java/java_message_field_lite.cc", 312 "protobuf/src/google/protobuf/compiler/java/java_message_lite.cc", 313 "protobuf/src/google/protobuf/compiler/java/java_name_resolver.cc", 314 "protobuf/src/google/protobuf/compiler/java/java_primitive_field.cc", 315 "protobuf/src/google/protobuf/compiler/java/java_primitive_field_lite.cc", 316 "protobuf/src/google/protobuf/compiler/java/java_service.cc", 317 "protobuf/src/google/protobuf/compiler/java/java_shared_code_generator.cc", 318 "protobuf/src/google/protobuf/compiler/java/java_string_field.cc", 319 "protobuf/src/google/protobuf/compiler/java/java_string_field_lite.cc", 320 "protobuf/src/google/protobuf/compiler/javanano/javanano_enum.cc", 321 "protobuf/src/google/protobuf/compiler/javanano/javanano_enum_field.cc", 322 "protobuf/src/google/protobuf/compiler/javanano/javanano_extension.cc", 323 "protobuf/src/google/protobuf/compiler/javanano/javanano_field.cc", 324 "protobuf/src/google/protobuf/compiler/javanano/javanano_file.cc", 325 "protobuf/src/google/protobuf/compiler/javanano/javanano_generator.cc", 326 "protobuf/src/google/protobuf/compiler/javanano/javanano_helpers.cc", 327 "protobuf/src/google/protobuf/compiler/javanano/javanano_map_field.cc", 328 "protobuf/src/google/protobuf/compiler/javanano/javanano_message.cc", 329 "protobuf/src/google/protobuf/compiler/javanano/javanano_message_field.cc", 330 "protobuf/src/google/protobuf/compiler/javanano/javanano_primitive_field.cc", 331 "protobuf/src/google/protobuf/compiler/js/js_generator.cc", 332 "protobuf/src/google/protobuf/compiler/objectivec/objectivec_enum.cc", 333 "protobuf/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc", 334 "protobuf/src/google/protobuf/compiler/objectivec/objectivec_extension.cc", 335 "protobuf/src/google/protobuf/compiler/objectivec/objectivec_field.cc", 336 "protobuf/src/google/protobuf/compiler/objectivec/objectivec_file.cc", 337 "protobuf/src/google/protobuf/compiler/objectivec/objectivec_generator.cc", 338 "protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc", 339 "protobuf/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc", 340 "protobuf/src/google/protobuf/compiler/objectivec/objectivec_message.cc", 341 "protobuf/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc", 342 "protobuf/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc", 343 "protobuf/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc", 344 "protobuf/src/google/protobuf/compiler/plugin.cc", 345 "protobuf/src/google/protobuf/compiler/plugin.pb.cc", 346 "protobuf/src/google/protobuf/compiler/python/python_generator.cc", 347 "protobuf/src/google/protobuf/compiler/ruby/ruby_generator.cc", 348 "protobuf/src/google/protobuf/compiler/subprocess.cc", 349 "protobuf/src/google/protobuf/compiler/zip_writer.cc", 350 ] 351 configs -= [ "//gn/standalone:extra_warnings" ] 352 configs += [ ":protobuf_config" ] 353 public_configs = [ ":protobuf_gen_config" ] 354 } 355 356 executable("protoc") { 357 deps = [ 358 ":protoc_lib", 359 "//gn:default_deps", 360 ] 361 sources = [ 362 "protobuf/src/google/protobuf/compiler/main.cc", 363 ] 364 configs -= [ "//gn/standalone:extra_warnings" ] 365 } 366} # host_toolchain 367 368if (use_custom_libcxx) { 369 # Config applied to both libc++ and libc++abi targets below. 370 config("libc++config") { 371 defines = [ 372 "LIBCXX_BUILDING_LIBCXXABI", 373 "_LIBCXXABI_NO_EXCEPTIONS", 374 "_LIBCPP_OVERRIDABLE_FUNC_VIS=__attribute__((__visibility__(\"default\")))", 375 ] 376 cflags = [ 377 "-fPIC", 378 "-fstrict-aliasing", 379 ] 380 } 381 382 source_set("libunwind") { 383 sources = [ 384 "libunwind/src/Unwind-EHABI.cpp", 385 "libunwind/src/Unwind-sjlj.c", 386 "libunwind/src/UnwindLevel1-gcc-ext.c", 387 "libunwind/src/UnwindLevel1.c", 388 "libunwind/src/UnwindRegistersRestore.S", 389 "libunwind/src/UnwindRegistersSave.S", 390 "libunwind/src/libunwind.cpp", 391 ] 392 include_dirs = [ "libunwind/include" ] 393 configs -= [ 394 "//gn/standalone:extra_warnings", 395 "//gn/standalone:no_exceptions", 396 "//gn/standalone:no_rtti", 397 398 # When building with msan, libunwind itself triggers memory violations 399 # that causes msan to get stuck into an infinite loop. Just don't 400 # instrument libunwind itself. 401 "//gn/standalone/sanitizers:sanitizers_cflags", 402 ] 403 configs += [ 404 ":libc++config", 405 "//gn/standalone/sanitizers:sanitizer_options_link_helper", 406 ] 407 } 408 409 source_set("libc++abi") { 410 sources = [ 411 "libcxxabi/src/abort_message.cpp", 412 "libcxxabi/src/cxa_aux_runtime.cpp", 413 "libcxxabi/src/cxa_default_handlers.cpp", 414 "libcxxabi/src/cxa_demangle.cpp", 415 "libcxxabi/src/cxa_exception.cpp", 416 "libcxxabi/src/cxa_exception_storage.cpp", 417 "libcxxabi/src/cxa_guard.cpp", 418 "libcxxabi/src/cxa_handlers.cpp", 419 "libcxxabi/src/cxa_personality.cpp", 420 "libcxxabi/src/cxa_unexpected.cpp", 421 "libcxxabi/src/cxa_vector.cpp", 422 "libcxxabi/src/cxa_virtual.cpp", 423 "libcxxabi/src/fallback_malloc.cpp", 424 "libcxxabi/src/private_typeinfo.cpp", 425 "libcxxabi/src/stdlib_exception.cpp", 426 "libcxxabi/src/stdlib_stdexcept.cpp", 427 "libcxxabi/src/stdlib_typeinfo.cpp", 428 ] 429 430 # On linux this seems to introduce an unwanted glibc 2.18 dependency. 431 if (is_android) { 432 sources += [ "libcxxabi/src/cxa_thread_atexit.cpp" ] 433 } 434 configs -= [ 435 "//gn/standalone:extra_warnings", 436 "//gn/standalone:no_exceptions", 437 "//gn/standalone:no_rtti", 438 "//gn/standalone:visibility_hidden", 439 ] 440 configs += [ 441 ":libc++config", 442 "//gn/standalone/sanitizers:sanitizer_options_link_helper", 443 ] 444 deps = [ 445 ":libunwind", 446 ] 447 } 448 449 if (custom_libcxx_is_static) { 450 libcxx_target_type = "source_set" 451 } else { 452 libcxx_target_type = "shared_library" 453 } 454 455 target(libcxx_target_type, "libc++") { 456 sources = [ 457 "libcxx/src/algorithm.cpp", 458 "libcxx/src/any.cpp", 459 "libcxx/src/bind.cpp", 460 "libcxx/src/chrono.cpp", 461 "libcxx/src/condition_variable.cpp", 462 "libcxx/src/debug.cpp", 463 "libcxx/src/exception.cpp", 464 "libcxx/src/functional.cpp", 465 "libcxx/src/future.cpp", 466 "libcxx/src/hash.cpp", 467 "libcxx/src/ios.cpp", 468 "libcxx/src/iostream.cpp", 469 "libcxx/src/locale.cpp", 470 "libcxx/src/memory.cpp", 471 "libcxx/src/mutex.cpp", 472 "libcxx/src/new.cpp", 473 "libcxx/src/optional.cpp", 474 "libcxx/src/random.cpp", 475 "libcxx/src/regex.cpp", 476 "libcxx/src/shared_mutex.cpp", 477 "libcxx/src/stdexcept.cpp", 478 "libcxx/src/string.cpp", 479 "libcxx/src/strstream.cpp", 480 "libcxx/src/system_error.cpp", 481 "libcxx/src/thread.cpp", 482 "libcxx/src/typeinfo.cpp", 483 "libcxx/src/utility.cpp", 484 "libcxx/src/valarray.cpp", 485 "libcxx/src/variant.cpp", 486 "libcxx/src/vector.cpp", 487 ] 488 configs -= [ 489 "//gn/standalone:extra_warnings", 490 "//gn/standalone:no_exceptions", 491 "//gn/standalone:no_rtti", 492 "//gn/standalone:visibility_hidden", 493 ] 494 configs += [ 495 ":libc++config", 496 "//gn/standalone/sanitizers:sanitizer_options_link_helper", 497 ] 498 defines = [ "_LIBCPP_BUILDING_LIBRARY" ] 499 deps = [ 500 ":libc++abi", 501 ] 502 } 503} # if (use_custom_libcxx) 504 505config("benchmark_config") { 506 include_dirs = [ "benchmark/include" ] 507 configs = [ ":test_warning_suppressions" ] 508} 509 510source_set("benchmark") { 511 testonly = true 512 sources = [ 513 "benchmark/include/benchmark/benchmark.h", 514 "benchmark/include/benchmark/benchmark_api.h", 515 "benchmark/include/benchmark/reporter.h", 516 "benchmark/src/arraysize.h", 517 "benchmark/src/benchmark.cc", 518 "benchmark/src/benchmark_api_internal.h", 519 "benchmark/src/benchmark_register.cc", 520 "benchmark/src/check.h", 521 "benchmark/src/colorprint.cc", 522 "benchmark/src/colorprint.h", 523 "benchmark/src/commandlineflags.cc", 524 "benchmark/src/commandlineflags.h", 525 "benchmark/src/complexity.cc", 526 "benchmark/src/complexity.h", 527 "benchmark/src/console_reporter.cc", 528 "benchmark/src/counter.cc", 529 "benchmark/src/counter.h", 530 "benchmark/src/csv_reporter.cc", 531 "benchmark/src/cycleclock.h", 532 "benchmark/src/internal_macros.h", 533 "benchmark/src/json_reporter.cc", 534 "benchmark/src/log.h", 535 "benchmark/src/mutex.h", 536 "benchmark/src/re.h", 537 "benchmark/src/reporter.cc", 538 "benchmark/src/sleep.cc", 539 "benchmark/src/sleep.h", 540 "benchmark/src/statistics.cc", 541 "benchmark/src/statistics.h", 542 "benchmark/src/string_util.cc", 543 "benchmark/src/string_util.h", 544 "benchmark/src/sysinfo.cc", 545 "benchmark/src/sysinfo.h", 546 "benchmark/src/timers.cc", 547 "benchmark/src/timers.h", 548 ] 549 defines = [ "HAVE_POSIX_REGEX" ] 550 public_configs = [ ":benchmark_config" ] 551 all_dependent_configs = [ ":benchmark_config" ] 552 configs -= [ "//gn/standalone:extra_warnings" ] 553} 554 555# On Linux/Android use libbacktrace in debug builds for better stacktraces. 556if (is_linux || is_android) { 557 config("libbacktrace_config") { 558 include_dirs = [ 559 "libbacktrace_config", 560 "libbacktrace", 561 ] 562 cflags = [ 563 # We force include this config file because "config.h" is too generic as a 564 # file name and on some platforms #include "config.h" ends up colliding 565 # importing some other project's config.h. 566 "-include", 567 rebase_path("libbacktrace_config/config.h", root_build_dir), 568 ] 569 } 570 571 source_set("libbacktrace") { 572 sources = [ 573 "libbacktrace/dwarf.c", 574 "libbacktrace/elf.c", 575 "libbacktrace/fileline.c", 576 "libbacktrace/mmap.c", 577 "libbacktrace/mmapio.c", 578 "libbacktrace/posix.c", 579 "libbacktrace/sort.c", 580 "libbacktrace/state.c", 581 ] 582 configs -= [ "//gn/standalone:extra_warnings" ] 583 public_configs = [ ":libbacktrace_config" ] 584 } 585} 586 587config("sqlite_config") { 588 include_dirs = [ "sqlite" ] 589 cflags = [ 590 "-DSQLITE_THREADSAFE=0", 591 "-DQLITE_DEFAULT_MEMSTATUS=0", 592 "-DSQLITE_LIKE_DOESNT_MATCH_BLOBS", 593 "-DSQLITE_OMIT_DEPRECATED", 594 "-DSQLITE_OMIT_SHARED_CACHE", 595 "-DHAVE_USLEEP", 596 "-DHAVE_UTIME", 597 "-DSQLITE_BYTEORDER=1234", 598 "-DSQLITE_DEFAULT_AUTOVACUUM=0", 599 "-DSQLITE_DEFAULT_MMAP_SIZE=0", 600 "-DSQLITE_CORE", 601 "-DSQLITE_TEMP_STORE=3", 602 "-DSQLITE_OMIT_LOAD_EXTENSION", 603 "-DSQLITE_OMIT_RANDOMNESS", 604 ] 605} 606 607source_set("sqlite") { 608 sources = [ 609 "sqlite/sqlite3.c", 610 "sqlite/sqlite3.h", 611 "sqlite/sqlite3ext.h", 612 "sqlite_src/ext/misc/percentile.c", 613 ] 614 configs -= [ "//gn/standalone:extra_warnings" ] 615 public_configs = [ ":sqlite_config" ] 616} 617 618source_set("sqlite_shell") { 619 testonly = true 620 sources = [ 621 "sqlite/shell.c", 622 ] 623 configs -= [ "//gn/standalone:extra_warnings" ] 624 deps = [ 625 ":sqlite", 626 ] 627} 628 629source_set("lzma") { 630 defines = [ "_7ZIP_ST" ] 631 sources = [ 632 "lzma/C/7zAlloc.c", 633 "lzma/C/7zArcIn.c", 634 "lzma/C/7zBuf.c", 635 "lzma/C/7zBuf2.c", 636 "lzma/C/7zCrc.c", 637 "lzma/C/7zCrcOpt.c", 638 "lzma/C/7zDec.c", 639 "lzma/C/7zFile.c", 640 "lzma/C/7zStream.c", 641 "lzma/C/Aes.c", 642 "lzma/C/AesOpt.c", 643 "lzma/C/Alloc.c", 644 "lzma/C/Bcj2.c", 645 "lzma/C/Bra.c", 646 "lzma/C/Bra86.c", 647 "lzma/C/BraIA64.c", 648 "lzma/C/CpuArch.c", 649 "lzma/C/Delta.c", 650 "lzma/C/LzFind.c", 651 "lzma/C/Lzma2Dec.c", 652 "lzma/C/Lzma2Enc.c", 653 "lzma/C/Lzma86Dec.c", 654 "lzma/C/Lzma86Enc.c", 655 "lzma/C/LzmaDec.c", 656 "lzma/C/LzmaEnc.c", 657 "lzma/C/LzmaLib.c", 658 "lzma/C/Ppmd7.c", 659 "lzma/C/Ppmd7Dec.c", 660 "lzma/C/Ppmd7Enc.c", 661 "lzma/C/Sha256.c", 662 "lzma/C/Sort.c", 663 "lzma/C/Xz.c", 664 "lzma/C/XzCrc64.c", 665 "lzma/C/XzCrc64Opt.c", 666 "lzma/C/XzDec.c", 667 "lzma/C/XzEnc.c", 668 "lzma/C/XzIn.c", 669 ] 670 configs -= [ "//gn/standalone:extra_warnings" ] 671 cflags = [ 672 "-Wno-empty-body", 673 "-Wno-enum-conversion", 674 ] 675} 676 677source_set("zlib") { 678 sources = [ 679 "zlib/src/adler32.c", 680 "zlib/src/compress.c", 681 "zlib/src/crc32.c", 682 "zlib/src/deflate.c", 683 "zlib/src/gzclose.c", 684 "zlib/src/gzlib.c", 685 "zlib/src/gzread.c", 686 "zlib/src/gzwrite.c", 687 "zlib/src/infback.c", 688 "zlib/src/inffast.c", 689 "zlib/src/inflate.c", 690 "zlib/src/inftrees.c", 691 "zlib/src/trees.c", 692 "zlib/src/uncompr.c", 693 "zlib/src/zutil.c", 694 ] 695 configs -= [ "//gn/standalone:extra_warnings" ] 696 cflags = [] 697 public_configs = [ ":zlib_config" ] 698} 699 700config("zlib_config") { 701 defines = [ 702 "ZLIB_CONST", 703 "USE_MMAP", 704 "HAVE_HIDDEN", 705 ] 706 cflags = [ 707 # Using -isystem instead of include_dirs (-I), so we don't need to suppress 708 # warnings coming from third-party headers. Doing so would mask warnings in 709 # our own code. 710 "-isystem", 711 rebase_path("zlib/src", root_build_dir), 712 ] 713} 714 715source_set("libunwindstack") { 716 include_dirs = [ 717 "android-core/libunwindstack/include", 718 "android-core/libunwindstack", 719 "android-core/base/include", 720 "android-core/liblog/include", 721 "android-core/libprocinfo/include", 722 "android-core/include", 723 "lzma/C", 724 ] 725 deps = [ 726 ":lzma", 727 ] 728 sources = [ 729 "android-core/base/file.cpp", 730 "android-core/base/logging.cpp", 731 "android-core/base/stringprintf.cpp", 732 "android-core/base/strings.cpp", 733 "android-core/base/threads.cpp", 734 "android-core/demangle/Demangler.cpp", 735 "android-core/libunwindstack/ArmExidx.cpp", 736 "android-core/libunwindstack/DwarfCfa.cpp", 737 "android-core/libunwindstack/DwarfEhFrameWithHdr.cpp", 738 "android-core/libunwindstack/DwarfMemory.cpp", 739 "android-core/libunwindstack/DwarfOp.cpp", 740 "android-core/libunwindstack/DwarfSection.cpp", 741 "android-core/libunwindstack/Elf.cpp", 742 "android-core/libunwindstack/ElfInterface.cpp", 743 "android-core/libunwindstack/ElfInterfaceArm.cpp", 744 "android-core/libunwindstack/Global.cpp", 745 "android-core/libunwindstack/JitDebug.cpp", 746 "android-core/libunwindstack/LocalUnwinder.cpp", 747 "android-core/libunwindstack/Log.cpp", 748 "android-core/libunwindstack/MapInfo.cpp", 749 "android-core/libunwindstack/Maps.cpp", 750 "android-core/libunwindstack/Memory.cpp", 751 "android-core/libunwindstack/Regs.cpp", 752 "android-core/libunwindstack/RegsArm.cpp", 753 "android-core/libunwindstack/RegsArm64.cpp", 754 "android-core/libunwindstack/RegsMips.cpp", 755 "android-core/libunwindstack/RegsMips64.cpp", 756 "android-core/libunwindstack/RegsX86.cpp", 757 "android-core/libunwindstack/RegsX86_64.cpp", 758 "android-core/libunwindstack/Symbols.cpp", 759 "android-core/libunwindstack/Unwinder.cpp", 760 "android-core/libunwindstack/tests/LogFake.cpp", 761 ] 762 if (current_cpu == "x86") { 763 sources += [ "android-core/libunwindstack/AsmGetRegsX86.S" ] 764 } else if (current_cpu == "x64") { 765 sources += [ "android-core/libunwindstack/AsmGetRegsX86_64.S" ] 766 } 767 configs -= [ 768 "//gn/standalone:extra_warnings", 769 "//gn/standalone:c++11", 770 "//gn/standalone:visibility_hidden", 771 ] 772 configs += [ "//gn/standalone:c++17" ] 773 public_configs = [ ":libunwindstack_config" ] 774} 775 776config("jsoncpp_config") { 777 cflags = [ 778 "-DJSON_USE_EXCEPTION=0", 779 780 # Using -isystem instead of include_dirs (-I), so we don't need to suppress 781 # warnings coming from third-party headers. Doing so would mask warnings in 782 # our own code. 783 "-isystem", 784 rebase_path("jsoncpp/include", root_build_dir), 785 ] 786} 787 788source_set("jsoncpp") { 789 sources = [ 790 "jsoncpp/src/lib_json/json_reader.cpp", 791 "jsoncpp/src/lib_json/json_value.cpp", 792 "jsoncpp/src/lib_json/json_writer.cpp", 793 ] 794 configs -= [ "//gn/standalone:extra_warnings" ] 795 public_configs = [ ":jsoncpp_config" ] 796} 797 798config("linenoise_config") { 799 cflags = [ 800 # Using -isystem instead of include_dirs (-I), so we don't need to suppress 801 # warnings coming from third-party headers. Doing so would mask warnings in 802 # our own code. 803 "-isystem", 804 rebase_path("linenoise", root_build_dir), 805 ] 806} 807 808source_set("linenoise") { 809 sources = [ 810 "linenoise/linenoise.c", 811 "linenoise/linenoise.h", 812 ] 813 configs -= [ "//gn/standalone:extra_warnings" ] 814 public_configs = [ ":linenoise_config" ] 815} 816 817if (use_libfuzzer) { 818 source_set("libfuzzer") { 819 configs -= [ 820 "//gn/standalone:extra_warnings", 821 "//gn/standalone/sanitizers:sanitizers_cflags", 822 ] 823 sources = [ 824 "libfuzzer/FuzzerCrossOver.cpp", 825 "libfuzzer/FuzzerDataFlowTrace.cpp", 826 "libfuzzer/FuzzerDriver.cpp", 827 "libfuzzer/FuzzerExtFunctionsDlsym.cpp", 828 "libfuzzer/FuzzerExtFunctionsWeak.cpp", 829 "libfuzzer/FuzzerExtFunctionsWeakAlias.cpp", 830 "libfuzzer/FuzzerExtraCounters.cpp", 831 "libfuzzer/FuzzerIO.cpp", 832 "libfuzzer/FuzzerIOPosix.cpp", 833 "libfuzzer/FuzzerIOWindows.cpp", 834 "libfuzzer/FuzzerLoop.cpp", 835 "libfuzzer/FuzzerMain.cpp", 836 "libfuzzer/FuzzerMerge.cpp", 837 "libfuzzer/FuzzerMutate.cpp", 838 "libfuzzer/FuzzerSHA1.cpp", 839 "libfuzzer/FuzzerShmemPosix.cpp", 840 "libfuzzer/FuzzerTracePC.cpp", 841 "libfuzzer/FuzzerUtil.cpp", 842 "libfuzzer/FuzzerUtilDarwin.cpp", 843 "libfuzzer/FuzzerUtilFuchsia.cpp", 844 "libfuzzer/FuzzerUtilLinux.cpp", 845 "libfuzzer/FuzzerUtilPosix.cpp", 846 "libfuzzer/FuzzerUtilWindows.cpp", 847 ] 848 } 849} 850