| # Copyright 2018 The Chromium Authors |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| # Flags specified here must not impact ABI. Code compiled with and without these |
| # opts will be linked together, and in some cases headers compiled with and |
| # without these options will be part of the same program. |
| |
| import("//build/config/c++/c++.gni") |
| import("//build/config/sanitizers/sanitizers.gni") |
| import("//build/toolchain/toolchain.gni") |
| import("//build_overrides/build.gni") |
| import("//flutter/third_party/abseil-cpp/absl.gni") |
| |
| config("absl_component_build") { |
| defines = [ "ABSL_CONSUME_DLL" ] |
| } |
| |
| assert(!is_nacl || is_nacl_saigo, |
| "base must not be built in most nacl toolchains") |
| |
| component("absl") { |
| public_deps = [ ":absl_component_deps" ] |
| if (is_component_build) { |
| public_configs = [ ":absl_component_build" ] |
| |
| if (is_win && is_clang) { |
| if (current_cpu == "x64") { |
| if (is_debug) { |
| sources = [ "symbols_x64_dbg.def" ] |
| } else { |
| if (is_asan) { |
| sources = [ "symbols_x64_rel_asan.def" ] |
| } else { |
| sources = [ "symbols_x64_rel.def" ] |
| } |
| } |
| } |
| if (current_cpu == "x86") { |
| if (is_debug) { |
| sources = [ "symbols_x86_dbg.def" ] |
| } else { |
| sources = [ "symbols_x86_rel.def" ] |
| } |
| } |
| if (current_cpu == "arm64") { |
| if (is_debug) { |
| sources = [ "symbols_arm64_dbg.def" ] |
| } else { |
| sources = [ "symbols_arm64_rel.def" ] |
| } |
| } |
| } |
| } |
| } |
| |
| group("absl_component_deps") { |
| public_deps = [ |
| "//flutter/third_party/abseil-cpp/absl/algorithm:container", |
| "//flutter/third_party/abseil-cpp/absl/base", |
| "//flutter/third_party/abseil-cpp/absl/base:config", |
| "//flutter/third_party/abseil-cpp/absl/base:core_headers", |
| "//flutter/third_party/abseil-cpp/absl/base:no_destructor", |
| "//flutter/third_party/abseil-cpp/absl/base:nullability", |
| "//flutter/third_party/abseil-cpp/absl/base:prefetch", |
| "//flutter/third_party/abseil-cpp/absl/cleanup", |
| "//flutter/third_party/abseil-cpp/absl/container:btree", |
| "//flutter/third_party/abseil-cpp/absl/container:fixed_array", |
| "//flutter/third_party/abseil-cpp/absl/container:flat_hash_map", |
| "//flutter/third_party/abseil-cpp/absl/container:flat_hash_set", |
| "//flutter/third_party/abseil-cpp/absl/container:inlined_vector", |
| "//flutter/third_party/abseil-cpp/absl/container:node_hash_map", |
| "//flutter/third_party/abseil-cpp/absl/container:node_hash_set", |
| "//flutter/third_party/abseil-cpp/absl/debugging:failure_signal_handler", |
| "//flutter/third_party/abseil-cpp/absl/debugging:stacktrace", |
| "//flutter/third_party/abseil-cpp/absl/debugging:symbolize", |
| "//flutter/third_party/abseil-cpp/absl/functional:any_invocable", |
| "//flutter/third_party/abseil-cpp/absl/functional:bind_front", |
| "//flutter/third_party/abseil-cpp/absl/functional:function_ref", |
| "//flutter/third_party/abseil-cpp/absl/functional:overload", |
| "//flutter/third_party/abseil-cpp/absl/hash", |
| "//flutter/third_party/abseil-cpp/absl/log:absl_check", |
| "//flutter/third_party/abseil-cpp/absl/log:absl_log", |
| "//flutter/third_party/abseil-cpp/absl/log:die_if_null", |
| "//flutter/third_party/abseil-cpp/absl/memory", |
| "//flutter/third_party/abseil-cpp/absl/meta:type_traits", |
| "//flutter/third_party/abseil-cpp/absl/numeric:bits", |
| "//flutter/third_party/abseil-cpp/absl/numeric:int128", |
| "//flutter/third_party/abseil-cpp/absl/random", |
| "//flutter/third_party/abseil-cpp/absl/random:distributions", |
| "//flutter/third_party/abseil-cpp/absl/status", |
| "//flutter/third_party/abseil-cpp/absl/status:statusor", |
| "//flutter/third_party/abseil-cpp/absl/strings", |
| "//flutter/third_party/abseil-cpp/absl/strings:cord", |
| "//flutter/third_party/abseil-cpp/absl/strings:has_ostream_operator", |
| "//flutter/third_party/abseil-cpp/absl/strings:str_format", |
| "//flutter/third_party/abseil-cpp/absl/strings:string_view", |
| "//flutter/third_party/abseil-cpp/absl/synchronization", |
| "//flutter/third_party/abseil-cpp/absl/time", |
| "//flutter/third_party/abseil-cpp/absl/types:optional", |
| "//flutter/third_party/abseil-cpp/absl/types:span", |
| "//flutter/third_party/abseil-cpp/absl/types:variant", |
| "//flutter/third_party/abseil-cpp/absl/utility", |
| ] |
| |
| # The following dependencies currently don't build with NaCl. |
| # TODO(https://crbug.com/1114625): Fix build errors and remove this section. |
| if (is_nacl) { |
| public_deps -= |
| [ "//flutter/third_party/abseil-cpp/absl/debugging:failure_signal_handler" ] |
| } |
| |
| visibility = [ ":absl" ] |
| } |
| |
| config("absl_include_config") { |
| include_dirs = [ "." ] |
| cflags_cc = [ |
| "-Wno-unknown-warning-option", |
| "-Wno-deprecated-builtins", |
| ] |
| cflags_objcc = [ |
| "-Wno-unknown-warning-option", |
| "-Wno-deprecated-builtins", |
| ] |
| } |
| |
| config("absl_define_config") { |
| defines = [ "ABSL_ALLOCATOR_NOTHROW=1" ] |
| |
| if (is_win && !use_custom_libcxx) { |
| defines += [ |
| # See crbug.com/1101367: Acknowledge extended alignment when using |
| # MSVC's standard library. |
| "_ENABLE_EXTENDED_ALIGNED_STORAGE", |
| ] |
| } |
| } |
| |
| config("absl_default_cflags_cc") { |
| cflags_cc = [] |
| if (is_clang) { |
| cflags_cc += [ |
| # TODO(crbug.com/588506): Explicitly enable conversion warnings. |
| "-Wbool-conversion", |
| "-Wconstant-conversion", |
| "-Wenum-conversion", |
| "-Wint-conversion", |
| "-Wliteral-conversion", |
| "-Wnon-literal-null-conversion", |
| "-Wnull-conversion", |
| "-Wobjc-literal-conversion", |
| "-Wstring-conversion", |
| ] |
| if (!is_nacl) { |
| cflags_cc += [ "-Wbitfield-enum-conversion" ] |
| } |
| } |
| } |
| |
| config("absl_test_cflags_cc") { |
| cflags_cc = [] |
| if (is_clang || !is_win) { |
| cflags_cc += [ |
| "-Wno-conversion-null", |
| "-Wno-missing-declarations", |
| "-Wno-unused-function", |
| "-Wno-unused-parameter", |
| "-Wno-unused-private-field", |
| ] |
| } |
| if (is_win) { |
| cflags_cc += [ |
| "/wd4101", # unreferenced local variable |
| ] |
| } |
| } |
| |
| config("absl_test_config") { |
| cflags_cc = [] |
| if (is_win && !is_clang) { |
| cflags_cc += [ "/wd4996" ] |
| } |
| if (is_clang) { |
| cflags_cc += [ |
| "-Wno-deprecated-declarations", |
| "-Wno-implicit-const-int-float-conversion", |
| "-Wno-unused-private-field", |
| "-Wno-unused-function", |
| ] |
| } |
| } |
| |
| if (build_with_chromium) { |
| import("//testing/test.gni") |
| |
| if (!is_component_build) { |
| test("absl_tests") { |
| testonly = true |
| deps = [ |
| "absl/algorithm:algorithm_test", |
| "absl/algorithm:container_test", |
| "absl/base:config_test", |
| "absl/base:no_destructor_test", |
| "absl/base:nullability_test", |
| "absl/base:prefetch_test", |
| "absl/cleanup:cleanup_test", |
| |
| # TODO(mbonadei): Fix issue with EXPECT_DEATH and uncomment. |
| # "absl/container:btree_test", |
| "absl/container:common_policy_traits_test", |
| "absl/container:fixed_array_test", |
| "absl/container:flat_hash_map_test", |
| "absl/container:flat_hash_set_test", |
| "absl/container:hash_function_defaults_test", |
| "absl/container:inlined_vector_test", |
| "absl/container:node_slot_policy_test", |
| "absl/container:raw_hash_set_allocator_test", |
| "absl/container:raw_hash_set_test", |
| "absl/container:sample_element_size_test", |
| "absl/crc:crc32c_test", |
| "absl/crc:crc_cord_state_test", |
| "absl/crc:crc_memcpy_test", |
| "absl/crc:non_temporal_memcpy_test", |
| "absl/debugging:stacktrace_test", |
| "absl/flags:flag_test", |
| "absl/functional:any_invocable_test", |
| "absl/functional:function_ref_test", |
| "absl/functional:overload_test", |
| "absl/hash:hash_instantiated_test", |
| "absl/hash:hash_test", |
| "absl/hash:low_level_hash_test", |
| "absl/log:absl_check_test", |
| "absl/log:absl_log_basic_test", |
| "absl/log:die_if_null_test", |
| "absl/log:flags_test", |
| "absl/log:globals_test", |
| "absl/log:log_entry_test", |
| "absl/log:log_format_test", |
| "absl/log:log_macro_hygiene_test", |
| "absl/log:log_modifier_methods_test", |
| "absl/log:log_sink_test", |
| "absl/log:log_streamer_test", |
| "absl/log:scoped_mock_log_test", |
| "absl/log:stripping_test", |
| "absl/log:vlog_is_on_test", |
| "absl/log/internal:fnmatch_test", |
| "absl/log/internal:stderr_log_sink_test", |
| "absl/memory:memory_test", |
| "absl/meta:type_traits_test", |
| "absl/numeric:int128_test", |
| "absl/profiling:exponential_biased_test", |
| "absl/profiling:periodic_sampler_test", |
| "absl/status:status_test", |
| "absl/status:statusor_test", |
| "absl/strings:ascii_test", |
| "absl/strings:char_formatting_test", |
| "absl/strings:charset_test", |
| "absl/strings:cord_buffer_test", |
| "absl/strings:cord_data_edge_test", |
| "absl/strings:cord_rep_btree_navigator_test", |
| "absl/strings:cord_rep_btree_reader_test", |
| "absl/strings:cord_rep_btree_test", |
| "absl/strings:cord_rep_crc_test", |
| "absl/strings:cordz_functions_test", |
| "absl/strings:cordz_info_statistics_test", |
| "absl/strings:cordz_info_test", |
| "absl/strings:cordz_test", |
| "absl/strings:cordz_update_scope_test", |
| "absl/strings:cordz_update_tracker_test", |
| "absl/strings:damerau_levenshtein_distance_test", |
| "absl/strings:has_absl_stringify_test", |
| "absl/strings:has_ostream_operator_test", |
| "absl/strings:match_test", |
| "absl/strings:str_format_arg_test", |
| "absl/strings:str_format_bind_test", |
| "absl/strings:str_format_checker_test", |
| "absl/strings:str_format_convert_test", |
| "absl/strings:str_format_extension_test", |
| "absl/strings:str_format_output_test", |
| "absl/strings:str_format_parser_test", |
| "absl/strings:str_format_test", |
| "absl/strings:str_replace_test", |
| "absl/strings:string_view_test", |
| "absl/synchronization:kernel_timeout_internal_test", |
| "absl/synchronization:waiter_test", |
| "absl/time:time_test", |
| "absl/types:optional_test", |
| "absl/types:variant_test", |
| "absl/utility:if_constexpr_test", |
| "//third_party/googletest:gtest_main", |
| ] |
| } |
| } |
| |
| test("absl_hardening_tests") { |
| testonly = true |
| sources = [ "absl_hardening_test.cc" ] |
| deps = [ |
| ":absl", |
| "//base/test:run_all_unittests", |
| "//third_party/googletest:gtest", |
| ] |
| } |
| } |