aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAidan Wolter <aidanwolter3@users.noreply.github.com>2020-12-22 01:54:33 -0800
committerGitHub <noreply@github.com>2020-12-22 09:54:33 +0000
commitd8254bb9eb5f6deeddee639d0b27347e186e0a84 (patch)
treeb2b91cf0616606d913f4e73912ffeaa2bbc38c78
parent378ed8ff25c01fe55c35cad6ed1eeab02c15d49a (diff)
downloadgoogle-benchmark-d8254bb9eb5f6deeddee639d0b27347e186e0a84.tar.gz
Add bazel target for benchmark_release (#1078)
Fixes google#1077 Bazel clients currently cannot build the benchmark library in Release mode. This commit adds a new target ":benchmark_release" to enable this.
-rw-r--r--BUILD.bazel22
1 files changed, 20 insertions, 2 deletions
diff --git a/BUILD.bazel b/BUILD.bazel
index eb35b62..2d87177 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -10,8 +10,8 @@ config_setting(
visibility = [":__subpackages__"],
)
-cc_library(
- name = "benchmark",
+filegroup(
+ name = "benchmark_srcs",
srcs = glob(
[
"src/*.cc",
@@ -19,7 +19,25 @@ cc_library(
],
exclude = ["src/benchmark_main.cc"],
),
+)
+
+cc_library(
+ name = "benchmark",
+ srcs = [":benchmark_srcs"],
+ hdrs = ["include/benchmark/benchmark.h"],
+ linkopts = select({
+ ":windows": ["-DEFAULTLIB:shlwapi.lib"],
+ "//conditions:default": ["-pthread"],
+ }),
+ strip_include_prefix = "include",
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "benchmark_release",
+ srcs = [":benchmark_srcs"],
hdrs = ["include/benchmark/benchmark.h"],
+ defines = ["NDEBUG"],
linkopts = select({
":windows": ["-DEFAULTLIB:shlwapi.lib"],
"//conditions:default": ["-pthread"],