• 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("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
18load(
19    "//absl:copts/configure_copts.bzl",
20    "ABSL_DEFAULT_COPTS",
21    "ABSL_DEFAULT_LINKOPTS",
22    "ABSL_TEST_COPTS",
23)
24
25package(default_visibility = ["//visibility:public"])
26
27licenses(["notice"])
28
29cc_library(
30    name = "hash",
31    srcs = [
32        "internal/hash.cc",
33        "internal/hash.h",
34    ],
35    hdrs = ["hash.h"],
36    copts = ABSL_DEFAULT_COPTS,
37    linkopts = ABSL_DEFAULT_LINKOPTS,
38    deps = [
39        ":city",
40        "//absl/base:core_headers",
41        "//absl/base:endian",
42        "//absl/container:fixed_array",
43        "//absl/meta:type_traits",
44        "//absl/numeric:int128",
45        "//absl/strings",
46        "//absl/types:optional",
47        "//absl/types:variant",
48        "//absl/utility",
49    ],
50)
51
52cc_library(
53    name = "hash_testing",
54    testonly = 1,
55    hdrs = ["hash_testing.h"],
56    linkopts = ABSL_DEFAULT_LINKOPTS,
57    deps = [
58        ":spy_hash_state",
59        "//absl/meta:type_traits",
60        "//absl/strings",
61        "//absl/types:variant",
62        "@com_google_googletest//:gtest",
63    ],
64)
65
66cc_test(
67    name = "hash_test",
68    srcs = ["hash_test.cc"],
69    copts = ABSL_TEST_COPTS,
70    linkopts = ABSL_DEFAULT_LINKOPTS,
71    deps = [
72        ":hash",
73        ":hash_testing",
74        ":spy_hash_state",
75        "//absl/base:core_headers",
76        "//absl/container:flat_hash_set",
77        "//absl/meta:type_traits",
78        "//absl/numeric:int128",
79        "//absl/strings:cord_test_helpers",
80        "@com_google_googletest//:gtest_main",
81    ],
82)
83
84cc_library(
85    name = "spy_hash_state",
86    testonly = 1,
87    hdrs = ["internal/spy_hash_state.h"],
88    copts = ABSL_DEFAULT_COPTS,
89    linkopts = ABSL_DEFAULT_LINKOPTS,
90    visibility = ["//visibility:private"],
91    deps = [
92        ":hash",
93        "//absl/strings",
94        "//absl/strings:str_format",
95    ],
96)
97
98cc_library(
99    name = "city",
100    srcs = ["internal/city.cc"],
101    hdrs = [
102        "internal/city.h",
103    ],
104    copts = ABSL_DEFAULT_COPTS,
105    linkopts = ABSL_DEFAULT_LINKOPTS,
106    deps = [
107        "//absl/base:config",
108        "//absl/base:core_headers",
109        "//absl/base:endian",
110    ],
111)
112
113cc_test(
114    name = "city_test",
115    srcs = ["internal/city_test.cc"],
116    copts = ABSL_TEST_COPTS,
117    linkopts = ABSL_DEFAULT_LINKOPTS,
118    deps = [
119        ":city",
120        "@com_google_googletest//:gtest_main",
121    ],
122)
123