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