mirror of
https://github.com/google/benchmark.git
synced 2024-12-26 12:30:14 +08:00
Adds -lm linker flag for FreeBSD/OpenBSD and uses github.com/bazelbuil… (#1032)
* Adds -lm linker flag for (Free|Open)BSD and uses github.com/bazelbuild/platforms for platform detection. * Prefer selects.with_or to select the linkopts. * @platforms appears to be implicitly available. @bazel_skylib would require updating every dependent repository. * Re-enable platforms package.
This commit is contained in:
parent
01c0ab7cbb
commit
4475ff6b8a
33
BUILD.bazel
33
BUILD.bazel
@ -1,14 +1,35 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
config_setting(
|
||||
name = "windows",
|
||||
values = {
|
||||
"cpu": "x64_windows",
|
||||
},
|
||||
name = "freebsd",
|
||||
constraint_values = [
|
||||
"@platforms//os:freebsd",
|
||||
],
|
||||
visibility = [":__subpackages__"],
|
||||
)
|
||||
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
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",
|
||||
@ -22,6 +43,8 @@ cc_library(
|
||||
hdrs = ["include/benchmark/benchmark.h"],
|
||||
linkopts = select({
|
||||
":windows": ["-DEFAULTLIB:shlwapi.lib"],
|
||||
":freebsd": BSD_LINKOPTS,
|
||||
":openbsd": BSD_LINKOPTS,
|
||||
"//conditions:default": ["-pthread"],
|
||||
}),
|
||||
strip_include_prefix = "include",
|
||||
|
Loading…
Reference in New Issue
Block a user