BUILD.bazel 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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. load(
  17. "//absl:copts/configure_copts.bzl",
  18. "ABSL_DEFAULT_COPTS",
  19. "ABSL_DEFAULT_LINKOPTS",
  20. "ABSL_TEST_COPTS",
  21. )
  22. package(default_visibility = ["//visibility:public"])
  23. licenses(["notice"])
  24. cc_library(
  25. name = "hash",
  26. srcs = [
  27. "internal/hash.cc",
  28. "internal/hash.h",
  29. ],
  30. hdrs = ["hash.h"],
  31. copts = ABSL_DEFAULT_COPTS,
  32. linkopts = ABSL_DEFAULT_LINKOPTS,
  33. deps = [
  34. ":city",
  35. ":low_level_hash",
  36. "//absl/base:config",
  37. "//absl/base:core_headers",
  38. "//absl/base:endian",
  39. "//absl/container:fixed_array",
  40. "//absl/meta:type_traits",
  41. "//absl/numeric:int128",
  42. "//absl/strings",
  43. "//absl/types:optional",
  44. "//absl/types:variant",
  45. "//absl/utility",
  46. ],
  47. )
  48. cc_library(
  49. name = "hash_testing",
  50. testonly = 1,
  51. hdrs = ["hash_testing.h"],
  52. linkopts = ABSL_DEFAULT_LINKOPTS,
  53. deps = [
  54. ":spy_hash_state",
  55. "//absl/meta:type_traits",
  56. "//absl/strings",
  57. "//absl/types:variant",
  58. "@com_google_googletest//:gtest",
  59. ],
  60. )
  61. cc_test(
  62. name = "hash_test",
  63. srcs = ["hash_test.cc"],
  64. copts = ABSL_TEST_COPTS,
  65. linkopts = ABSL_DEFAULT_LINKOPTS,
  66. deps = [
  67. ":hash",
  68. ":hash_testing",
  69. ":spy_hash_state",
  70. "//absl/base:core_headers",
  71. "//absl/container:flat_hash_set",
  72. "//absl/meta:type_traits",
  73. "//absl/numeric:int128",
  74. "//absl/strings:cord_test_helpers",
  75. "@com_google_googletest//:gtest_main",
  76. ],
  77. )
  78. cc_binary(
  79. name = "hash_benchmark",
  80. testonly = 1,
  81. srcs = ["hash_benchmark.cc"],
  82. copts = ABSL_TEST_COPTS,
  83. linkopts = ABSL_DEFAULT_LINKOPTS,
  84. tags = ["benchmark"],
  85. visibility = ["//visibility:private"],
  86. deps = [
  87. ":hash",
  88. "//absl/base:core_headers",
  89. "//absl/random",
  90. "//absl/strings",
  91. "//absl/strings:cord",
  92. "//absl/strings:cord_test_helpers",
  93. "@com_github_google_benchmark//:benchmark_main",
  94. ],
  95. )
  96. cc_library(
  97. name = "spy_hash_state",
  98. testonly = 1,
  99. hdrs = ["internal/spy_hash_state.h"],
  100. copts = ABSL_DEFAULT_COPTS,
  101. linkopts = ABSL_DEFAULT_LINKOPTS,
  102. visibility = ["//visibility:private"],
  103. deps = [
  104. ":hash",
  105. "//absl/strings",
  106. "//absl/strings:str_format",
  107. ],
  108. )
  109. cc_library(
  110. name = "city",
  111. srcs = ["internal/city.cc"],
  112. hdrs = [
  113. "internal/city.h",
  114. ],
  115. copts = ABSL_DEFAULT_COPTS,
  116. linkopts = ABSL_DEFAULT_LINKOPTS,
  117. deps = [
  118. "//absl/base:config",
  119. "//absl/base:core_headers",
  120. "//absl/base:endian",
  121. ],
  122. )
  123. cc_test(
  124. name = "city_test",
  125. srcs = ["internal/city_test.cc"],
  126. copts = ABSL_TEST_COPTS,
  127. linkopts = ABSL_DEFAULT_LINKOPTS,
  128. deps = [
  129. ":city",
  130. "@com_google_googletest//:gtest_main",
  131. ],
  132. )
  133. cc_library(
  134. name = "low_level_hash",
  135. srcs = ["internal/low_level_hash.cc"],
  136. hdrs = ["internal/low_level_hash.h"],
  137. copts = ABSL_DEFAULT_COPTS,
  138. linkopts = ABSL_DEFAULT_LINKOPTS,
  139. visibility = ["//visibility:private"],
  140. deps = [
  141. "//absl/base:config",
  142. "//absl/base:endian",
  143. "//absl/numeric:bits",
  144. "//absl/numeric:int128",
  145. ],
  146. )
  147. cc_test(
  148. name = "low_level_hash_test",
  149. srcs = ["internal/low_level_hash_test.cc"],
  150. copts = ABSL_TEST_COPTS,
  151. linkopts = ABSL_DEFAULT_LINKOPTS,
  152. visibility = ["//visibility:private"],
  153. deps = [
  154. ":low_level_hash",
  155. "//absl/strings",
  156. "@com_google_googletest//:gtest_main",
  157. ],
  158. )