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("@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"])
28
29cc_library(
30    name = "bind_front",
31    srcs = ["internal/front_binder.h"],
32    hdrs = ["bind_front.h"],
33    copts = ABSL_DEFAULT_COPTS,
34    linkopts = ABSL_DEFAULT_LINKOPTS,
35    deps = [
36        "//absl/base:base_internal",
37        "//absl/container:compressed_tuple",
38        "//absl/meta:type_traits",
39        "//absl/utility",
40    ],
41)
42
43cc_test(
44    name = "bind_front_test",
45    srcs = ["bind_front_test.cc"],
46    copts = ABSL_TEST_COPTS,
47    linkopts = ABSL_DEFAULT_LINKOPTS,
48    deps = [
49        ":bind_front",
50        "//absl/memory",
51        "@com_google_googletest//:gtest_main",
52    ],
53)
54
55cc_library(
56    name = "function_ref",
57    srcs = ["internal/function_ref.h"],
58    hdrs = ["function_ref.h"],
59    copts = ABSL_DEFAULT_COPTS,
60    linkopts = ABSL_DEFAULT_LINKOPTS,
61    deps = [
62        "//absl/base:base_internal",
63        "//absl/meta:type_traits",
64    ],
65)
66
67cc_test(
68    name = "function_ref_test",
69    size = "small",
70    srcs = ["function_ref_test.cc"],
71    copts = ABSL_TEST_COPTS,
72    deps = [
73        ":function_ref",
74        "//absl/container:test_instance_tracker",
75        "//absl/memory",
76        "@com_google_googletest//:gtest_main",
77    ],
78)
79
80cc_test(
81    name = "function_ref_benchmark",
82    srcs = [
83        "function_ref_benchmark.cc",
84    ],
85    copts = ABSL_TEST_COPTS,
86    tags = ["benchmark"],
87    visibility = ["//visibility:private"],
88    deps = [
89        ":function_ref",
90        "//absl/base:core_headers",
91        "@com_github_google_benchmark//:benchmark_main",
92    ],
93)
94