benchmark/BUILD.bazel

68 lines
1.4 KiB
Python
Raw Normal View History

load("@rules_cc//cc:defs.bzl", "cc_library")
licenses(["notice"])
config_setting(
name = "freebsd",
constraint_values = [
"@platforms//os:freebsd",
],
visibility = [":__subpackages__"],
)
config_setting(
name = "openbsd",
constraint_values = [
"@platforms//os:openbsd",
],
visibility = [":__subpackages__"],
)
config_setting(
name = "windows",
constraint_values = [
"@platforms//os:windows",
],
visibility = [":__subpackages__"],
)
BSD_LINKOPTS = [
"-pthread",
"-lm",
]
cc_library(
name = "benchmark",
srcs = glob(
[
"src/*.cc",
"src/*.h",
],
exclude = ["src/benchmark_main.cc"],
),
hdrs = ["include/benchmark/benchmark.h"],
linkopts = select({
":windows": ["-DEFAULTLIB:shlwapi.lib"],
":freebsd": BSD_LINKOPTS,
":openbsd": BSD_LINKOPTS,
"//conditions:default": ["-pthread"],
}),
strip_include_prefix = "include",
visibility = ["//visibility:public"],
)
cc_library(
name = "benchmark_main",
srcs = ["src/benchmark_main.cc"],
hdrs = ["include/benchmark/benchmark.h"],
strip_include_prefix = "include",
visibility = ["//visibility:public"],
deps = [":benchmark"],
)
cc_library(
name = "benchmark_internal_headers",
hdrs = glob(["src/*.h"]),
visibility = ["//test:__pkg__"],
)