• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1licenses(["notice"])
2
3config_setting(
4    name = "qnx",
5    constraint_values = ["@platforms//os:qnx"],
6    values = {
7        "cpu": "x64_qnx",
8    },
9    visibility = [":__subpackages__"],
10)
11
12config_setting(
13    name = "windows",
14    constraint_values = ["@platforms//os:windows"],
15    values = {
16        "cpu": "x64_windows",
17    },
18    visibility = [":__subpackages__"],
19)
20
21config_setting(
22    name = "macos",
23    constraint_values = ["@platforms//os:macos"],
24    visibility = ["//visibility:public"],
25)
26
27config_setting(
28    name = "perfcounters",
29    define_values = {
30        "pfm": "1",
31    },
32    visibility = [":__subpackages__"],
33)
34
35cc_library(
36    name = "benchmark",
37    srcs = glob(
38        [
39            "src/*.cc",
40            "src/*.h",
41        ],
42        exclude = ["src/benchmark_main.cc"],
43    ),
44    hdrs = [
45        "include/benchmark/benchmark.h",
46        "include/benchmark/export.h",
47    ],
48    linkopts = select({
49        ":windows": ["-DEFAULTLIB:shlwapi.lib"],
50        "//conditions:default": ["-pthread"],
51    }),
52    strip_include_prefix = "include",
53    visibility = ["//visibility:public"],
54    # Only static linking is allowed; no .so will be produced.
55    # Using `defines` (i.e. not `local_defines`) means that no
56    # dependent rules need to bother about defining the macro.
57    linkstatic = True,
58    defines = [
59        "BENCHMARK_STATIC_DEFINE",
60    ] + select({
61        ":perfcounters": ["HAVE_LIBPFM"],
62        "//conditions:default": [],
63    }),
64    deps = select({
65        ":perfcounters": ["@libpfm//:libpfm"],
66        "//conditions:default": [],
67    }),
68)
69
70cc_library(
71    name = "benchmark_main",
72    srcs = ["src/benchmark_main.cc"],
73    hdrs = ["include/benchmark/benchmark.h", "include/benchmark/export.h"],
74    strip_include_prefix = "include",
75    visibility = ["//visibility:public"],
76    deps = [":benchmark"],
77)
78
79cc_library(
80    name = "benchmark_internal_headers",
81    hdrs = glob(["src/*.h"]),
82    visibility = ["//test:__pkg__"],
83)
84