BUILD.bazel (3860B)
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 17 load( 18 "//absl:copts/configure_copts.bzl", 19 "ABSL_DEFAULT_COPTS", 20 "ABSL_DEFAULT_LINKOPTS", 21 "ABSL_TEST_COPTS", 22 ) 23 24 package( 25 default_visibility = ["//visibility:public"], 26 features = [ 27 "header_modules", 28 "layering_check", 29 "parse_headers", 30 ], 31 ) 32 33 licenses(["notice"]) 34 35 cc_library( 36 name = "any_invocable", 37 srcs = ["internal/any_invocable.h"], 38 hdrs = ["any_invocable.h"], 39 copts = ABSL_DEFAULT_COPTS, 40 linkopts = ABSL_DEFAULT_LINKOPTS, 41 deps = [ 42 "//absl/base:config", 43 "//absl/base:core_headers", 44 "//absl/meta:type_traits", 45 "//absl/utility", 46 ], 47 ) 48 49 cc_test( 50 name = "any_invocable_test", 51 srcs = [ 52 "any_invocable_test.cc", 53 "internal/any_invocable.h", 54 ], 55 copts = ABSL_TEST_COPTS, 56 linkopts = ABSL_DEFAULT_LINKOPTS, 57 deps = [ 58 ":any_invocable", 59 "//absl/base:config", 60 "//absl/base:core_headers", 61 "//absl/meta:type_traits", 62 "//absl/utility", 63 "@googletest//:gtest", 64 "@googletest//:gtest_main", 65 ], 66 ) 67 68 cc_library( 69 name = "bind_front", 70 srcs = ["internal/front_binder.h"], 71 hdrs = ["bind_front.h"], 72 copts = ABSL_DEFAULT_COPTS, 73 linkopts = ABSL_DEFAULT_LINKOPTS, 74 deps = [ 75 "//absl/container:compressed_tuple", 76 "//absl/meta:type_traits", 77 "//absl/utility", 78 ], 79 ) 80 81 cc_test( 82 name = "bind_front_test", 83 srcs = ["bind_front_test.cc"], 84 copts = ABSL_TEST_COPTS, 85 linkopts = ABSL_DEFAULT_LINKOPTS, 86 deps = [ 87 ":bind_front", 88 "//absl/memory", 89 "@googletest//:gtest", 90 "@googletest//:gtest_main", 91 ], 92 ) 93 94 cc_library( 95 name = "function_ref", 96 srcs = ["internal/function_ref.h"], 97 hdrs = ["function_ref.h"], 98 copts = ABSL_DEFAULT_COPTS, 99 linkopts = ABSL_DEFAULT_LINKOPTS, 100 deps = [ 101 ":any_invocable", 102 "//absl/base:core_headers", 103 "//absl/meta:type_traits", 104 ], 105 ) 106 107 cc_test( 108 name = "function_ref_test", 109 size = "small", 110 srcs = ["function_ref_test.cc"], 111 copts = ABSL_TEST_COPTS, 112 deps = [ 113 ":any_invocable", 114 ":function_ref", 115 "//absl/container:test_instance_tracker", 116 "//absl/memory", 117 "@googletest//:gtest", 118 "@googletest//:gtest_main", 119 ], 120 ) 121 122 cc_library( 123 name = "overload", 124 hdrs = ["overload.h"], 125 copts = ABSL_DEFAULT_COPTS, 126 linkopts = ABSL_DEFAULT_LINKOPTS, 127 deps = [ 128 "//absl/base:config", 129 "//absl/meta:type_traits", 130 ], 131 ) 132 133 cc_test( 134 name = "overload_test", 135 size = "small", 136 srcs = ["overload_test.cc"], 137 copts = ABSL_TEST_COPTS, 138 deps = [ 139 ":overload", 140 "//absl/base:config", 141 "//absl/strings", 142 "//absl/strings:string_view", 143 "//absl/types:variant", 144 "@googletest//:gtest", 145 "@googletest//:gtest_main", 146 ], 147 ) 148 149 cc_binary( 150 name = "function_type_benchmark", 151 testonly = True, 152 srcs = [ 153 "function_type_benchmark.cc", 154 ], 155 copts = ABSL_TEST_COPTS, 156 tags = ["benchmark"], 157 visibility = ["//visibility:private"], 158 deps = [ 159 ":any_invocable", 160 ":function_ref", 161 "//absl/base:core_headers", 162 "@google_benchmark//:benchmark_main", 163 ], 164 )