xref: /aosp_15_r20/external/webrtc/third_party/abseil-cpp/absl/hash/BUILD.bazel (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1#
2# Copyright 2019 The Abseil Authors.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      https://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17load(
18    "//absl:copts/configure_copts.bzl",
19    "ABSL_DEFAULT_COPTS",
20    "ABSL_DEFAULT_LINKOPTS",
21    "ABSL_TEST_COPTS",
22)
23
24package(default_visibility = ["//visibility:public"])
25
26licenses(["notice"])
27
28cc_library(
29    name = "hash",
30    srcs = [
31        "internal/hash.cc",
32        "internal/hash.h",
33    ],
34    hdrs = ["hash.h"],
35    copts = ABSL_DEFAULT_COPTS,
36    linkopts = ABSL_DEFAULT_LINKOPTS,
37    deps = [
38        ":city",
39        ":low_level_hash",
40        "//absl/base:config",
41        "//absl/base:core_headers",
42        "//absl/base:endian",
43        "//absl/container:fixed_array",
44        "//absl/functional:function_ref",
45        "//absl/meta:type_traits",
46        "//absl/numeric:int128",
47        "//absl/strings",
48        "//absl/types:optional",
49        "//absl/types:variant",
50        "//absl/utility",
51    ],
52)
53
54cc_library(
55    name = "hash_testing",
56    testonly = 1,
57    hdrs = ["hash_testing.h"],
58    linkopts = ABSL_DEFAULT_LINKOPTS,
59    deps = [
60        ":spy_hash_state",
61        "//absl/meta:type_traits",
62        "//absl/strings",
63        "//absl/types:variant",
64        "@com_google_googletest//:gtest",
65    ],
66)
67
68cc_test(
69    name = "hash_test",
70    srcs = ["hash_test.cc"],
71    copts = ABSL_TEST_COPTS,
72    linkopts = ABSL_DEFAULT_LINKOPTS,
73    deps = [
74        ":hash",
75        ":hash_testing",
76        ":spy_hash_state",
77        "//absl/base:core_headers",
78        "//absl/container:btree",
79        "//absl/container:flat_hash_map",
80        "//absl/container:flat_hash_set",
81        "//absl/container:node_hash_map",
82        "//absl/container:node_hash_set",
83        "//absl/meta:type_traits",
84        "//absl/numeric:int128",
85        "//absl/strings:cord_test_helpers",
86        "@com_google_googletest//:gtest_main",
87    ],
88)
89
90cc_binary(
91    name = "hash_benchmark",
92    testonly = 1,
93    srcs = ["hash_benchmark.cc"],
94    copts = ABSL_TEST_COPTS,
95    linkopts = ABSL_DEFAULT_LINKOPTS,
96    tags = ["benchmark"],
97    visibility = ["//visibility:private"],
98    deps = [
99        ":hash",
100        "//absl/base:core_headers",
101        "//absl/container:flat_hash_set",
102        "//absl/random",
103        "//absl/strings",
104        "//absl/strings:cord",
105        "//absl/strings:cord_test_helpers",
106        "@com_github_google_benchmark//:benchmark_main",
107    ],
108)
109
110cc_library(
111    name = "spy_hash_state",
112    testonly = 1,
113    hdrs = ["internal/spy_hash_state.h"],
114    copts = ABSL_DEFAULT_COPTS,
115    linkopts = ABSL_DEFAULT_LINKOPTS,
116    visibility = ["//visibility:private"],
117    deps = [
118        ":hash",
119        "//absl/strings",
120        "//absl/strings:str_format",
121    ],
122)
123
124cc_library(
125    name = "city",
126    srcs = ["internal/city.cc"],
127    hdrs = [
128        "internal/city.h",
129    ],
130    copts = ABSL_DEFAULT_COPTS,
131    linkopts = ABSL_DEFAULT_LINKOPTS,
132    deps = [
133        "//absl/base:config",
134        "//absl/base:core_headers",
135        "//absl/base:endian",
136    ],
137)
138
139cc_test(
140    name = "city_test",
141    srcs = ["internal/city_test.cc"],
142    copts = ABSL_TEST_COPTS,
143    linkopts = ABSL_DEFAULT_LINKOPTS,
144    deps = [
145        ":city",
146        "@com_google_googletest//:gtest_main",
147    ],
148)
149
150cc_library(
151    name = "low_level_hash",
152    srcs = ["internal/low_level_hash.cc"],
153    hdrs = ["internal/low_level_hash.h"],
154    copts = ABSL_DEFAULT_COPTS,
155    linkopts = ABSL_DEFAULT_LINKOPTS,
156    visibility = ["//visibility:private"],
157    deps = [
158        "//absl/base:config",
159        "//absl/base:endian",
160        "//absl/numeric:bits",
161        "//absl/numeric:int128",
162    ],
163)
164
165cc_test(
166    name = "low_level_hash_test",
167    srcs = ["internal/low_level_hash_test.cc"],
168    copts = ABSL_TEST_COPTS,
169    linkopts = ABSL_DEFAULT_LINKOPTS,
170    visibility = ["//visibility:private"],
171    deps = [
172        ":low_level_hash",
173        "//absl/strings",
174        "@com_google_googletest//:gtest_main",
175    ],
176)
177