1# 2# Copyright 2017 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"]) # Apache 2.0 28 29cc_library( 30 name = "any", 31 hdrs = ["any.h"], 32 copts = ABSL_DEFAULT_COPTS, 33 linkopts = ABSL_DEFAULT_LINKOPTS, 34 deps = [ 35 ":bad_any_cast", 36 "//absl/base:config", 37 "//absl/base:core_headers", 38 "//absl/meta:type_traits", 39 "//absl/utility", 40 ], 41) 42 43cc_library( 44 name = "bad_any_cast", 45 hdrs = ["bad_any_cast.h"], 46 copts = ABSL_DEFAULT_COPTS, 47 linkopts = ABSL_DEFAULT_LINKOPTS, 48 deps = [ 49 ":bad_any_cast_impl", 50 "//absl/base:config", 51 ], 52) 53 54cc_library( 55 name = "bad_any_cast_impl", 56 srcs = [ 57 "bad_any_cast.cc", 58 "bad_any_cast.h", 59 ], 60 copts = ABSL_DEFAULT_COPTS, 61 linkopts = ABSL_DEFAULT_LINKOPTS, 62 visibility = ["//visibility:private"], 63 deps = [ 64 "//absl/base:config", 65 "//absl/base:raw_logging_internal", 66 ], 67) 68 69cc_test( 70 name = "any_test", 71 size = "small", 72 srcs = [ 73 "any_test.cc", 74 ], 75 copts = ABSL_TEST_COPTS, 76 linkopts = ABSL_DEFAULT_LINKOPTS, 77 deps = [ 78 ":any", 79 "//absl/base:config", 80 "//absl/base:exception_testing", 81 "//absl/base:raw_logging_internal", 82 "//absl/container:test_instance_tracker", 83 "@com_google_googletest//:gtest_main", 84 ], 85) 86 87cc_test( 88 name = "any_exception_safety_test", 89 srcs = ["any_exception_safety_test.cc"], 90 copts = ABSL_TEST_COPTS, 91 linkopts = ABSL_DEFAULT_LINKOPTS, 92 deps = [ 93 ":any", 94 "//absl/base:config", 95 "//absl/base:exception_safety_testing", 96 "@com_google_googletest//:gtest_main", 97 ], 98) 99 100cc_library( 101 name = "span", 102 srcs = [ 103 "internal/span.h", 104 ], 105 hdrs = [ 106 "span.h", 107 ], 108 copts = ABSL_DEFAULT_COPTS, 109 linkopts = ABSL_DEFAULT_LINKOPTS, 110 deps = [ 111 "//absl/algorithm", 112 "//absl/base:core_headers", 113 "//absl/base:throw_delegate", 114 "//absl/meta:type_traits", 115 ], 116) 117 118cc_test( 119 name = "span_test", 120 size = "small", 121 srcs = ["span_test.cc"], 122 copts = ABSL_TEST_COPTS, 123 linkopts = ABSL_DEFAULT_LINKOPTS, 124 deps = [ 125 ":span", 126 "//absl/base:config", 127 "//absl/base:core_headers", 128 "//absl/base:exception_testing", 129 "//absl/container:fixed_array", 130 "//absl/container:inlined_vector", 131 "//absl/hash:hash_testing", 132 "//absl/strings", 133 "@com_google_googletest//:gtest_main", 134 ], 135) 136 137cc_library( 138 name = "optional", 139 srcs = ["internal/optional.h"], 140 hdrs = ["optional.h"], 141 copts = ABSL_DEFAULT_COPTS, 142 linkopts = ABSL_DEFAULT_LINKOPTS, 143 deps = [ 144 ":bad_optional_access", 145 "//absl/base:base_internal", 146 "//absl/base:config", 147 "//absl/base:core_headers", 148 "//absl/memory", 149 "//absl/meta:type_traits", 150 "//absl/utility", 151 ], 152) 153 154cc_library( 155 name = "bad_optional_access", 156 srcs = ["bad_optional_access.cc"], 157 hdrs = ["bad_optional_access.h"], 158 copts = ABSL_DEFAULT_COPTS, 159 linkopts = ABSL_DEFAULT_LINKOPTS, 160 deps = [ 161 "//absl/base:config", 162 "//absl/base:raw_logging_internal", 163 ], 164) 165 166cc_library( 167 name = "bad_variant_access", 168 srcs = ["bad_variant_access.cc"], 169 hdrs = ["bad_variant_access.h"], 170 copts = ABSL_DEFAULT_COPTS, 171 linkopts = ABSL_DEFAULT_LINKOPTS, 172 deps = [ 173 "//absl/base:config", 174 "//absl/base:raw_logging_internal", 175 ], 176) 177 178cc_test( 179 name = "optional_test", 180 size = "small", 181 srcs = [ 182 "optional_test.cc", 183 ], 184 copts = ABSL_TEST_COPTS, 185 linkopts = ABSL_DEFAULT_LINKOPTS, 186 deps = [ 187 ":optional", 188 "//absl/base:config", 189 "//absl/base:raw_logging_internal", 190 "//absl/meta:type_traits", 191 "//absl/strings", 192 "@com_google_googletest//:gtest_main", 193 ], 194) 195 196cc_test( 197 name = "optional_exception_safety_test", 198 srcs = [ 199 "optional_exception_safety_test.cc", 200 ], 201 copts = ABSL_TEST_COPTS, 202 linkopts = ABSL_DEFAULT_LINKOPTS, 203 deps = [ 204 ":optional", 205 "//absl/base:config", 206 "//absl/base:exception_safety_testing", 207 "@com_google_googletest//:gtest_main", 208 ], 209) 210 211cc_library( 212 name = "conformance_testing", 213 testonly = 1, 214 hdrs = [ 215 "internal/conformance_aliases.h", 216 "internal/conformance_archetype.h", 217 "internal/conformance_profile.h", 218 ], 219 copts = ABSL_TEST_COPTS, 220 linkopts = ABSL_DEFAULT_LINKOPTS, 221 deps = [ 222 "//absl/debugging:demangle_internal", 223 "//absl/meta:type_traits", 224 "//absl/strings", 225 "//absl/utility", 226 "@com_google_googletest//:gtest", 227 ], 228) 229 230cc_test( 231 name = "conformance_testing_test", 232 size = "small", 233 srcs = [ 234 "internal/conformance_testing_test.cc", 235 ], 236 copts = ABSL_TEST_COPTS, 237 linkopts = ABSL_DEFAULT_LINKOPTS, 238 deps = [ 239 ":conformance_testing", 240 "//absl/meta:type_traits", 241 "@com_google_googletest//:gtest_main", 242 ], 243) 244 245cc_library( 246 name = "variant", 247 srcs = ["internal/variant.h"], 248 hdrs = ["variant.h"], 249 copts = ABSL_DEFAULT_COPTS, 250 linkopts = ABSL_DEFAULT_LINKOPTS, 251 deps = [ 252 ":bad_variant_access", 253 "//absl/base:base_internal", 254 "//absl/base:config", 255 "//absl/base:core_headers", 256 "//absl/meta:type_traits", 257 "//absl/utility", 258 ], 259) 260 261cc_test( 262 name = "variant_test", 263 size = "small", 264 srcs = ["variant_test.cc"], 265 copts = ABSL_TEST_COPTS, 266 linkopts = ABSL_DEFAULT_LINKOPTS, 267 deps = [ 268 ":variant", 269 "//absl/base:config", 270 "//absl/base:core_headers", 271 "//absl/memory", 272 "//absl/meta:type_traits", 273 "//absl/strings", 274 "@com_google_googletest//:gtest_main", 275 ], 276) 277 278cc_test( 279 name = "variant_benchmark", 280 srcs = [ 281 "variant_benchmark.cc", 282 ], 283 copts = ABSL_TEST_COPTS, 284 linkopts = ABSL_DEFAULT_LINKOPTS, 285 tags = ["benchmark"], 286 deps = [ 287 ":variant", 288 "//absl/utility", 289 "@com_github_google_benchmark//:benchmark_main", 290 ], 291) 292 293cc_test( 294 name = "variant_exception_safety_test", 295 size = "small", 296 srcs = [ 297 "variant_exception_safety_test.cc", 298 ], 299 copts = ABSL_TEST_COPTS, 300 linkopts = ABSL_DEFAULT_LINKOPTS, 301 deps = [ 302 ":variant", 303 "//absl/base:config", 304 "//absl/base:exception_safety_testing", 305 "//absl/memory", 306 "@com_google_googletest//:gtest_main", 307 ], 308) 309 310cc_library( 311 name = "compare", 312 hdrs = ["compare.h"], 313 copts = ABSL_DEFAULT_COPTS, 314 deps = [ 315 "//absl/base:core_headers", 316 "//absl/meta:type_traits", 317 ], 318) 319 320cc_test( 321 name = "compare_test", 322 size = "small", 323 srcs = [ 324 "compare_test.cc", 325 ], 326 copts = ABSL_TEST_COPTS, 327 deps = [ 328 ":compare", 329 "//absl/base", 330 "@com_google_googletest//:gtest_main", 331 ], 332) 333