BUILD.bazel (5516B)
1 # Copyright 2022 The Abseil Authors 2 # 3 # Licensed under the Apache License, Version 2.0 (the "License"); 4 # you may not use this file except in compliance with the License. 5 # You may obtain a copy of the License at 6 # 7 # https://www.apache.org/licenses/LICENSE-2.0 8 # 9 # Unless required by applicable law or agreed to in writing, software 10 # distributed under the License is distributed on an "AS IS" BASIS, 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 # See the License for the specific language governing permissions and 13 # limitations under the License. 14 15 load( 16 "//absl:copts/configure_copts.bzl", 17 "ABSL_DEFAULT_COPTS", 18 "ABSL_DEFAULT_LINKOPTS", 19 "ABSL_TEST_COPTS", 20 ) 21 22 package( 23 default_visibility = ["//visibility:private"], 24 features = [ 25 "header_modules", 26 "layering_check", 27 "parse_headers", 28 ], 29 ) 30 31 licenses(["notice"]) 32 33 cc_library( 34 name = "cpu_detect", 35 srcs = [ 36 "internal/cpu_detect.cc", 37 ], 38 hdrs = ["internal/cpu_detect.h"], 39 copts = ABSL_DEFAULT_COPTS, 40 linkopts = ABSL_DEFAULT_LINKOPTS, 41 visibility = ["//visibility:private"], 42 deps = [ 43 "//absl/base", 44 "//absl/base:config", 45 "//absl/types:optional", 46 ], 47 ) 48 49 cc_library( 50 name = "crc_internal", 51 srcs = [ 52 "internal/crc.cc", 53 "internal/crc_internal.h", 54 "internal/crc_x86_arm_combined.cc", 55 ], 56 hdrs = [ 57 "internal/crc.h", 58 "internal/crc32_x86_arm_combined_simd.h", 59 ], 60 copts = ABSL_DEFAULT_COPTS, 61 linkopts = ABSL_DEFAULT_LINKOPTS, 62 visibility = ["//visibility:private"], 63 deps = [ 64 ":cpu_detect", 65 "//absl/base:config", 66 "//absl/base:core_headers", 67 "//absl/base:endian", 68 "//absl/base:prefetch", 69 "//absl/base:raw_logging_internal", 70 "//absl/memory", 71 "//absl/numeric:bits", 72 ], 73 ) 74 75 cc_library( 76 name = "crc32c", 77 srcs = [ 78 "crc32c.cc", 79 "internal/crc32c_inline.h", 80 "internal/crc_memcpy_fallback.cc", 81 "internal/crc_memcpy_x86_arm_combined.cc", 82 "internal/crc_non_temporal_memcpy.cc", 83 ], 84 hdrs = [ 85 "crc32c.h", 86 "internal/crc32c.h", 87 "internal/crc_memcpy.h", 88 ], 89 copts = ABSL_DEFAULT_COPTS, 90 linkopts = ABSL_DEFAULT_LINKOPTS, 91 visibility = ["//visibility:public"], 92 deps = [ 93 ":cpu_detect", 94 ":crc_internal", 95 ":non_temporal_memcpy", 96 "//absl/base:config", 97 "//absl/base:core_headers", 98 "//absl/base:endian", 99 "//absl/base:prefetch", 100 "//absl/strings", 101 "//absl/strings:str_format", 102 ], 103 ) 104 105 cc_test( 106 name = "crc32c_test", 107 srcs = ["crc32c_test.cc"], 108 copts = ABSL_TEST_COPTS, 109 linkopts = ABSL_DEFAULT_LINKOPTS, 110 visibility = ["//visibility:private"], 111 deps = [ 112 ":crc32c", 113 "//absl/strings", 114 "//absl/strings:str_format", 115 "@googletest//:gtest", 116 "@googletest//:gtest_main", 117 ], 118 ) 119 120 cc_library( 121 name = "non_temporal_arm_intrinsics", 122 hdrs = ["internal/non_temporal_arm_intrinsics.h"], 123 copts = ABSL_DEFAULT_COPTS, 124 linkopts = ABSL_DEFAULT_LINKOPTS, 125 visibility = [ 126 ":__pkg__", 127 ], 128 deps = [ 129 "//absl/base:config", 130 ], 131 ) 132 133 cc_library( 134 name = "non_temporal_memcpy", 135 hdrs = ["internal/non_temporal_memcpy.h"], 136 copts = ABSL_DEFAULT_COPTS, 137 linkopts = ABSL_DEFAULT_LINKOPTS, 138 visibility = [ 139 ":__pkg__", 140 ], 141 deps = [ 142 ":non_temporal_arm_intrinsics", 143 "//absl/base:config", 144 "//absl/base:core_headers", 145 ], 146 ) 147 148 cc_test( 149 name = "crc_memcpy_test", 150 size = "large", 151 srcs = ["internal/crc_memcpy_test.cc"], 152 copts = ABSL_TEST_COPTS, 153 linkopts = ABSL_DEFAULT_LINKOPTS, 154 shard_count = 3, 155 visibility = ["//visibility:private"], 156 deps = [ 157 ":crc32c", 158 "//absl/memory", 159 "//absl/random", 160 "//absl/random:distributions", 161 "//absl/strings", 162 "@googletest//:gtest", 163 "@googletest//:gtest_main", 164 ], 165 ) 166 167 cc_test( 168 name = "non_temporal_memcpy_test", 169 srcs = ["internal/non_temporal_memcpy_test.cc"], 170 copts = ABSL_TEST_COPTS, 171 linkopts = ABSL_DEFAULT_LINKOPTS, 172 visibility = ["//visibility:private"], 173 deps = [ 174 ":non_temporal_memcpy", 175 "@googletest//:gtest", 176 "@googletest//:gtest_main", 177 ], 178 ) 179 180 cc_library( 181 name = "crc_cord_state", 182 srcs = ["internal/crc_cord_state.cc"], 183 hdrs = ["internal/crc_cord_state.h"], 184 copts = ABSL_DEFAULT_COPTS, 185 linkopts = ABSL_DEFAULT_LINKOPTS, 186 visibility = ["//absl/strings:__pkg__"], 187 deps = [ 188 ":crc32c", 189 "//absl/base:config", 190 "//absl/base:no_destructor", 191 "//absl/numeric:bits", 192 ], 193 ) 194 195 cc_test( 196 name = "crc_cord_state_test", 197 srcs = ["internal/crc_cord_state_test.cc"], 198 copts = ABSL_TEST_COPTS, 199 linkopts = ABSL_DEFAULT_LINKOPTS, 200 visibility = ["//visibility:private"], 201 deps = [ 202 ":crc32c", 203 ":crc_cord_state", 204 "@googletest//:gtest", 205 "@googletest//:gtest_main", 206 ], 207 ) 208 209 cc_binary( 210 name = "crc32c_benchmark", 211 testonly = True, 212 srcs = ["crc32c_benchmark.cc"], 213 copts = ABSL_TEST_COPTS, 214 linkopts = ABSL_DEFAULT_LINKOPTS, 215 tags = [ 216 "benchmark", 217 ], 218 visibility = ["//visibility:private"], 219 deps = [ 220 ":crc32c", 221 "//absl/memory", 222 "//absl/strings", 223 "@google_benchmark//:benchmark_main", 224 ], 225 )