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