• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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:bits",
47        "//absl/numeric:int128",
48        "//absl/strings",
49        "//absl/types:optional",
50        "//absl/types:variant",
51        "//absl/utility",
52    ],
53)
54
55cc_library(
56    name = "hash_testing",
57    testonly = 1,
58    hdrs = ["hash_testing.h"],
59    linkopts = ABSL_DEFAULT_LINKOPTS,
60    deps = [
61        ":spy_hash_state",
62        "//absl/meta:type_traits",
63        "//absl/strings",
64        "//absl/types:variant",
65        "@com_google_googletest//:gtest",
66    ],
67)
68
69cc_test(
70    name = "hash_test",
71    srcs = [
72        "hash_test.cc",
73        "internal/hash_test.h",
74    ],
75    copts = ABSL_TEST_COPTS,
76    linkopts = ABSL_DEFAULT_LINKOPTS,
77    deps = [
78        ":hash",
79        ":hash_testing",
80        ":spy_hash_state",
81        "//absl/base:config",
82        "//absl/base:core_headers",
83        "//absl/container:btree",
84        "//absl/container:flat_hash_map",
85        "//absl/container:flat_hash_set",
86        "//absl/container:node_hash_map",
87        "//absl/container:node_hash_set",
88        "//absl/meta:type_traits",
89        "//absl/numeric:int128",
90        "//absl/strings:cord_test_helpers",
91        "@com_google_googletest//:gtest_main",
92    ],
93)
94
95cc_test(
96    name = "hash_instantiated_test",
97    srcs = [
98        "hash_instantiated_test.cc",
99        "internal/hash_test.h",
100    ],
101    copts = ABSL_TEST_COPTS,
102    linkopts = ABSL_DEFAULT_LINKOPTS,
103    deps = [
104        ":hash",
105        ":hash_testing",
106        "//absl/base:config",
107        "//absl/container:btree",
108        "//absl/container:flat_hash_map",
109        "//absl/container:flat_hash_set",
110        "//absl/container:node_hash_map",
111        "//absl/container:node_hash_set",
112        "@com_google_googletest//:gtest_main",
113    ],
114)
115
116cc_binary(
117    name = "hash_benchmark",
118    testonly = 1,
119    srcs = ["hash_benchmark.cc"],
120    copts = ABSL_TEST_COPTS,
121    linkopts = ABSL_DEFAULT_LINKOPTS,
122    tags = ["benchmark"],
123    visibility = ["//visibility:private"],
124    deps = [
125        ":hash",
126        "//absl/base:core_headers",
127        "//absl/container:flat_hash_set",
128        "//absl/random",
129        "//absl/strings",
130        "//absl/strings:cord",
131        "//absl/strings:cord_test_helpers",
132        "@com_github_google_benchmark//:benchmark_main",
133    ],
134)
135
136cc_library(
137    name = "spy_hash_state",
138    testonly = 1,
139    hdrs = ["internal/spy_hash_state.h"],
140    copts = ABSL_DEFAULT_COPTS,
141    linkopts = ABSL_DEFAULT_LINKOPTS,
142    visibility = ["//visibility:private"],
143    deps = [
144        ":hash",
145        "//absl/strings",
146        "//absl/strings:str_format",
147    ],
148)
149
150cc_library(
151    name = "city",
152    srcs = ["internal/city.cc"],
153    hdrs = [
154        "internal/city.h",
155    ],
156    copts = ABSL_DEFAULT_COPTS,
157    linkopts = ABSL_DEFAULT_LINKOPTS,
158    deps = [
159        "//absl/base:config",
160        "//absl/base:core_headers",
161        "//absl/base:endian",
162    ],
163)
164
165cc_test(
166    name = "city_test",
167    srcs = ["internal/city_test.cc"],
168    copts = ABSL_TEST_COPTS,
169    linkopts = ABSL_DEFAULT_LINKOPTS,
170    deps = [
171        ":city",
172        "@com_google_googletest//:gtest_main",
173    ],
174)
175
176cc_library(
177    name = "low_level_hash",
178    srcs = ["internal/low_level_hash.cc"],
179    hdrs = ["internal/low_level_hash.h"],
180    copts = ABSL_DEFAULT_COPTS,
181    linkopts = ABSL_DEFAULT_LINKOPTS,
182    visibility = ["//visibility:private"],
183    deps = [
184        "//absl/base:config",
185        "//absl/base:endian",
186        "//absl/base:prefetch",
187        "//absl/numeric:int128",
188    ],
189)
190
191cc_test(
192    name = "low_level_hash_test",
193    srcs = ["internal/low_level_hash_test.cc"],
194    copts = ABSL_TEST_COPTS,
195    linkopts = ABSL_DEFAULT_LINKOPTS,
196    visibility = ["//visibility:private"],
197    deps = [
198        ":low_level_hash",
199        "//absl/strings",
200        "@com_google_googletest//:gtest_main",
201    ],
202)
203