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 = ["hash_test.cc"], 72 copts = ABSL_TEST_COPTS, 73 linkopts = ABSL_DEFAULT_LINKOPTS, 74 deps = [ 75 ":hash", 76 ":hash_testing", 77 ":spy_hash_state", 78 "//absl/base:core_headers", 79 "//absl/container:btree", 80 "//absl/container:flat_hash_map", 81 "//absl/container:flat_hash_set", 82 "//absl/container:node_hash_map", 83 "//absl/container:node_hash_set", 84 "//absl/meta:type_traits", 85 "//absl/numeric:int128", 86 "//absl/strings:cord_test_helpers", 87 "@com_google_googletest//:gtest_main", 88 ], 89) 90 91cc_binary( 92 name = "hash_benchmark", 93 testonly = 1, 94 srcs = ["hash_benchmark.cc"], 95 copts = ABSL_TEST_COPTS, 96 linkopts = ABSL_DEFAULT_LINKOPTS, 97 tags = ["benchmark"], 98 visibility = ["//visibility:private"], 99 deps = [ 100 ":hash", 101 "//absl/base:core_headers", 102 "//absl/container:flat_hash_set", 103 "//absl/random", 104 "//absl/strings", 105 "//absl/strings:cord", 106 "//absl/strings:cord_test_helpers", 107 "@com_github_google_benchmark//:benchmark_main", 108 ], 109) 110 111cc_library( 112 name = "spy_hash_state", 113 testonly = 1, 114 hdrs = ["internal/spy_hash_state.h"], 115 copts = ABSL_DEFAULT_COPTS, 116 linkopts = ABSL_DEFAULT_LINKOPTS, 117 visibility = ["//visibility:private"], 118 deps = [ 119 ":hash", 120 "//absl/strings", 121 "//absl/strings:str_format", 122 ], 123) 124 125cc_library( 126 name = "city", 127 srcs = ["internal/city.cc"], 128 hdrs = [ 129 "internal/city.h", 130 ], 131 copts = ABSL_DEFAULT_COPTS, 132 linkopts = ABSL_DEFAULT_LINKOPTS, 133 deps = [ 134 "//absl/base:config", 135 "//absl/base:core_headers", 136 "//absl/base:endian", 137 ], 138) 139 140cc_test( 141 name = "city_test", 142 srcs = ["internal/city_test.cc"], 143 copts = ABSL_TEST_COPTS, 144 linkopts = ABSL_DEFAULT_LINKOPTS, 145 deps = [ 146 ":city", 147 "@com_google_googletest//:gtest_main", 148 ], 149) 150 151cc_library( 152 name = "low_level_hash", 153 srcs = ["internal/low_level_hash.cc"], 154 hdrs = ["internal/low_level_hash.h"], 155 copts = ABSL_DEFAULT_COPTS, 156 linkopts = ABSL_DEFAULT_LINKOPTS, 157 visibility = ["//visibility:private"], 158 deps = [ 159 "//absl/base:config", 160 "//absl/base:endian", 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