aboutsummaryrefslogtreecommitdiff
path: root/BUILD.bazel
diff options
context:
space:
mode:
Diffstat (limited to 'BUILD.bazel')
-rw-r--r--BUILD.bazel53
1 files changed, 40 insertions, 13 deletions
diff --git a/BUILD.bazel b/BUILD.bazel
index 60d31d2..15d8369 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -1,5 +1,22 @@
licenses(["notice"])
+COPTS = [
+ "-pedantic",
+ "-pedantic-errors",
+ "-std=c++11",
+ "-Wall",
+ "-Wconversion",
+ "-Wextra",
+ "-Wshadow",
+ # "-Wshorten-64-to-32",
+ "-Wfloat-equal",
+ "-fstrict-aliasing",
+ ## assert() are used a lot in tests upstream, which may be optimised out leading to
+ ## unused-variable warning.
+ "-Wno-unused-variable",
+ "-Werror=old-style-cast",
+]
+
config_setting(
name = "qnx",
constraint_values = ["@platforms//os:qnx"],
@@ -45,28 +62,35 @@ cc_library(
"include/benchmark/benchmark.h",
"include/benchmark/export.h",
],
- linkopts = select({
- ":windows": ["-DEFAULTLIB:shlwapi.lib"],
- "//conditions:default": ["-pthread"],
- }),
copts = select({
":windows": [],
- "//conditions:default": ["-Werror=old-style-cast"],
+ "//conditions:default": COPTS,
}),
- strip_include_prefix = "include",
- visibility = ["//visibility:public"],
- # Only static linking is allowed; no .so will be produced.
- # Using `defines` (i.e. not `local_defines`) means that no
- # dependent rules need to bother about defining the macro.
- linkstatic = True,
defines = [
"BENCHMARK_STATIC_DEFINE",
+ "BENCHMARK_VERSION=\\\"" + (module_version() if module_version() != None else "") + "\\\"",
] + select({
":perfcounters": ["HAVE_LIBPFM"],
"//conditions:default": [],
}),
+ linkopts = select({
+ ":windows": ["-DEFAULTLIB:shlwapi.lib"],
+ "//conditions:default": ["-pthread"],
+ }),
+ # Only static linking is allowed; no .so will be produced.
+ # Using `defines` (i.e. not `local_defines`) means that no
+ # dependent rules need to bother about defining the macro.
+ linkstatic = True,
+ local_defines = [
+ # Turn on Large-file Support
+ "_FILE_OFFSET_BITS=64",
+ "_LARGEFILE64_SOURCE",
+ "_LARGEFILE_SOURCE",
+ ],
+ strip_include_prefix = "include",
+ visibility = ["//visibility:public"],
deps = select({
- ":perfcounters": ["@libpfm//:libpfm"],
+ ":perfcounters": ["@libpfm"],
"//conditions:default": [],
}),
)
@@ -74,7 +98,10 @@ cc_library(
cc_library(
name = "benchmark_main",
srcs = ["src/benchmark_main.cc"],
- hdrs = ["include/benchmark/benchmark.h", "include/benchmark/export.h"],
+ hdrs = [
+ "include/benchmark/benchmark.h",
+ "include/benchmark/export.h",
+ ],
strip_include_prefix = "include",
visibility = ["//visibility:public"],
deps = [":benchmark"],