2018-03-08 12:48:46 +00:00
|
|
|
licenses(["notice"])
|
|
|
|
|
2022-02-22 13:53:29 +00:00
|
|
|
load("//:config/generate_export_header.bzl", "generate_export_header")
|
2022-02-14 10:48:53 +00:00
|
|
|
|
|
|
|
posix_copts = [
|
|
|
|
"-fvisibility=hidden",
|
|
|
|
"-fvisibility-inlines-hidden",
|
|
|
|
]
|
|
|
|
|
|
|
|
# Generate header to provide ABI export symbols
|
|
|
|
generate_export_header(
|
|
|
|
out = "include/benchmark/export.h",
|
|
|
|
lib = "benchmark",
|
|
|
|
static_define = "BENCHMARK_STATIC_DEFINE",
|
|
|
|
)
|
|
|
|
|
2021-06-28 12:46:08 +00:00
|
|
|
config_setting(
|
|
|
|
name = "qnx",
|
|
|
|
constraint_values = ["@platforms//os:qnx"],
|
|
|
|
values = {
|
|
|
|
"cpu": "x64_qnx",
|
|
|
|
},
|
|
|
|
visibility = [":__subpackages__"],
|
|
|
|
)
|
|
|
|
|
2018-05-01 14:24:38 +00:00
|
|
|
config_setting(
|
|
|
|
name = "windows",
|
2021-06-28 12:46:08 +00:00
|
|
|
constraint_values = ["@platforms//os:windows"],
|
2020-09-03 09:59:15 +00:00
|
|
|
values = {
|
|
|
|
"cpu": "x64_windows",
|
|
|
|
},
|
2018-05-01 14:24:38 +00:00
|
|
|
visibility = [":__subpackages__"],
|
|
|
|
)
|
|
|
|
|
2021-01-05 09:54:04 +00:00
|
|
|
cc_library(
|
|
|
|
name = "benchmark",
|
2018-05-25 10:18:58 +00:00
|
|
|
srcs = glob(
|
|
|
|
[
|
|
|
|
"src/*.cc",
|
|
|
|
"src/*.h",
|
|
|
|
],
|
|
|
|
exclude = ["src/benchmark_main.cc"],
|
|
|
|
),
|
2022-02-14 10:48:53 +00:00
|
|
|
hdrs = [
|
|
|
|
"include/benchmark/benchmark.h",
|
|
|
|
"include/benchmark/export.h", # From generate_export_header
|
|
|
|
],
|
2018-05-01 14:24:38 +00:00
|
|
|
linkopts = select({
|
2018-05-02 10:23:18 +00:00
|
|
|
":windows": ["-DEFAULTLIB:shlwapi.lib"],
|
2018-05-01 14:24:38 +00:00
|
|
|
"//conditions:default": ["-pthread"],
|
|
|
|
}),
|
2018-03-08 12:48:46 +00:00
|
|
|
strip_include_prefix = "include",
|
|
|
|
visibility = ["//visibility:public"],
|
2022-02-14 10:48:53 +00:00
|
|
|
copts = select({
|
|
|
|
":windows": [],
|
|
|
|
"//conditions:default": posix_copts,
|
|
|
|
}),
|
2022-02-24 14:42:59 +00:00
|
|
|
local_defines = select({
|
|
|
|
":windows": ["benchmark_EXPORTS"],
|
|
|
|
"//conditions:default": [],
|
|
|
|
}),
|
2018-03-08 12:48:46 +00:00
|
|
|
)
|
|
|
|
|
2018-05-25 10:18:58 +00:00
|
|
|
cc_library(
|
|
|
|
name = "benchmark_main",
|
|
|
|
srcs = ["src/benchmark_main.cc"],
|
|
|
|
hdrs = ["include/benchmark/benchmark.h"],
|
|
|
|
strip_include_prefix = "include",
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [":benchmark"],
|
2022-02-14 10:48:53 +00:00
|
|
|
copts = select({
|
|
|
|
":windows": [],
|
|
|
|
"//conditions:default": posix_copts,
|
|
|
|
}),
|
2018-05-25 10:18:58 +00:00
|
|
|
)
|
|
|
|
|
2018-03-08 12:48:46 +00:00
|
|
|
cc_library(
|
|
|
|
name = "benchmark_internal_headers",
|
|
|
|
hdrs = glob(["src/*.h"]),
|
|
|
|
visibility = ["//test:__pkg__"],
|
|
|
|
)
|