summaryrefslogtreecommitdiff
path: root/chromium/third_party/abseil-cpp/BUILD.gn
blob: b96d354205f4e0958ccb23559393320dac406885 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# Copyright (c) 2018 The Chromium Authors. All rights reserved.
# 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/toolchain/toolchain.gni")
import("//testing/test.gni")

config("absl_component_build") {
  defines = [ "ABSL_CONSUME_DLL" ]
}

# TODO(mbonadei): WebRTC tests and binaries use absl flags but they are
# marked testonly because we don't want them to be usable in Chromium.
# Add an absl_flags component which depends on the main absl component.
component("absl") {
  if (is_component_build) {
    public_configs = [ ":absl_component_build" ]

    if (is_win) {
      if (target_cpu == "x64") {
        if (is_debug) {
          sources = [ "symbols_x64_dbg.def" ]
        } else {
          sources = [ "symbols_x64_rel.def" ]
        }
      }
      if (target_cpu == "x86") {
        if (is_debug) {
          sources = [ "symbols_x86_dbg.def" ]
        } else {
          sources = [ "symbols_x86_rel.def" ]
        }
      }
      if (target_cpu == "arm64") {
        if (is_debug) {
          sources = [ "symbols_arm64_dbg.def" ]
        } else {
          sources = [ "symbols_arm64_rel.def" ]
        }
      }
    }
  }

  public_deps = [
    "//third_party/abseil-cpp/absl/algorithm:container",
    "//third_party/abseil-cpp/absl/base:config",
    "//third_party/abseil-cpp/absl/base:core_headers",
    "//third_party/abseil-cpp/absl/container:inlined_vector",

    # Disabled because of static initializers:
    # "//third_party/abseil-cpp/absl/debugging:failure_signal_handler",
    # "//third_party/abseil-cpp/absl/debugging:symbolize",

    "//third_party/abseil-cpp/absl/hash",
    "//third_party/abseil-cpp/absl/memory",
    "//third_party/abseil-cpp/absl/meta:type_traits",
    "//third_party/abseil-cpp/absl/strings",
    "//third_party/abseil-cpp/absl/types:optional",
    "//third_party/abseil-cpp/absl/types:variant",
  ]
}

group("default") {
  deps = [
    "absl/types:any",
    "absl/types:bad_any_cast",
    "absl/types:bad_optional_access",
    "absl/types:optional",
    "absl/types:span",
  ]
}

config("absl_include_config") {
  include_dirs = [ "." ]
}

config("absl_define_config") {
  defines = [ "ABSL_ALLOCATOR_NOTHROW=1" ]
}

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",
      "-Wno-sign-conversion",
      "-Wstring-conversion",
    ]
    if (!is_nacl && !use_xcode_clang) {
      cflags_cc += [ "-Wbitfield-enum-conversion" ]
    }
  }
  if (is_win) {
    cflags_cc += [
      "/wd4005",  # macro-redefinition
      "/wd4018",  # sign-compare
      "/wd4068",  # unknown pragma
      "/wd4702",  # unreachable code
    ]
  }
}

config("absl_test_cflags_cc") {
  cflags_cc = []
  if (is_clang || !is_win) {
    cflags_cc += [
      "-Wno-conversion-null",
      "-Wno-missing-declarations",
      "-Wno-sign-compare",
      "-Wno-unused-function",
      "-Wno-unused-parameter",
      "-Wno-unused-private-field",
    ]
  }
  if (is_win) {
    cflags_cc += [
      "/wd4018",  # signed/unsigned mismatch
      "/wd4101",  # unreferenced local variable
    ]
  }
}

if (!is_component_build) {
  test("absl_tests") {
    testonly = true
    deps = [
      "absl/algorithm:algorithm_test",
      "absl/algorithm:container_test",
      "absl/base:config_test",
      "absl/container:inlined_vector_test",
      "absl/memory:memory_test",
      "absl/meta:type_traits_test",
      "absl/strings:ascii_test",
      "absl/strings:match_test",
      "absl/strings:str_replace_test",
      "absl/strings:string_view_test",

      # TODO(mbonadei): On iOS, gtest doesn't support death tests. Fix upstream
      # Abseil to use EXPECT_DEATH_IF_SUPPORTED instead of EXPECT_DEATH.
      # "absl/types:optional_test",
      # "absl/types:variant_test",

      "//third_party/googletest:gtest_main",
    ]
  }
}