blob: 4d4a6ffb4d3f76b9a8f6535239a303e1c4d456a2 [file] [log] [blame]
James Kuszmaul38169b92023-01-13 21:17:05 -08001diff --git a/BUILD.bazel b/BUILD.bazel
2index 64f86ee..a588046 100644
3--- a/BUILD.bazel
4+++ b/BUILD.bazel
5@@ -39,22 +39,25 @@ cc_library(
6 "include/benchmark/benchmark.h",
7 "include/benchmark/export.h",
8 ],
9+ copts = [
10+ "-Wno-format-nonliteral",
11+ ],
12+ defines = [
13+ "BENCHMARK_STATIC_DEFINE",
14+ ] + select({
15+ ":perfcounters": ["HAVE_LIBPFM"],
16+ "//conditions:default": [],
17+ }),
18 linkopts = select({
19 ":windows": ["-DEFAULTLIB:shlwapi.lib"],
20 "//conditions:default": ["-pthread"],
21 }),
22- strip_include_prefix = "include",
23- visibility = ["//visibility:public"],
24 # Only static linking is allowed; no .so will be produced.
25 # Using `defines` (i.e. not `local_defines`) means that no
26 # dependent rules need to bother about defining the macro.
27 linkstatic = True,
28- defines = [
29- "BENCHMARK_STATIC_DEFINE",
30- ] + select({
31- ":perfcounters": ["HAVE_LIBPFM"],
32- "//conditions:default": [],
33- }),
34+ strip_include_prefix = "include",
35+ visibility = ["//visibility:public"],
36 deps = select({
37 ":perfcounters": ["@libpfm//:libpfm"],
38 "//conditions:default": [],
39@@ -64,7 +67,10 @@ cc_library(
40 cc_library(
41 name = "benchmark_main",
42 srcs = ["src/benchmark_main.cc"],
43- hdrs = ["include/benchmark/benchmark.h", "include/benchmark/export.h"],
44+ hdrs = [
45+ "include/benchmark/benchmark.h",
46+ "include/benchmark/export.h",
47+ ],
48 strip_include_prefix = "include",
49 visibility = ["//visibility:public"],
50 deps = [":benchmark"],
51diff --git a/bindings/python/BUILD b/bindings/python/BUILD
52deleted file mode 100644
53index 9559a76..0000000
54--- a/bindings/python/BUILD
55+++ /dev/null
56@@ -1,3 +0,0 @@
57-exports_files(glob(["*.BUILD"]))
58-exports_files(["build_defs.bzl"])
59-
60diff --git a/bindings/python/google_benchmark/BUILD b/bindings/python/google_benchmark/BUILD
61deleted file mode 100644
62index 3c1561f..0000000
63--- a/bindings/python/google_benchmark/BUILD
64+++ /dev/null
65@@ -1,38 +0,0 @@
66-load("//bindings/python:build_defs.bzl", "py_extension")
67-
68-py_library(
69- name = "google_benchmark",
70- srcs = ["__init__.py"],
71- visibility = ["//visibility:public"],
72- deps = [
73- ":_benchmark",
74- # pip; absl:app
75- ],
76-)
77-
78-py_extension(
79- name = "_benchmark",
80- srcs = ["benchmark.cc"],
81- copts = [
82- "-fexceptions",
83- "-fno-strict-aliasing",
84- ],
85- features = ["-use_header_modules"],
86- deps = [
87- "//:benchmark",
88- "@pybind11",
89- "@python_headers",
90- ],
91-)
92-
93-py_test(
94- name = "example",
95- srcs = ["example.py"],
96- python_version = "PY3",
97- srcs_version = "PY3",
98- visibility = ["//visibility:public"],
99- deps = [
100- ":google_benchmark",
101- ],
102-)
103-
104diff --git a/test/BUILD b/test/BUILD
105index 0a66bf3..4d62699 100644
106--- a/test/BUILD
107+++ b/test/BUILD
108@@ -18,6 +18,10 @@ TEST_COPTS = [
109 # "-Wshorten-64-to-32",
110 "-Wfloat-equal",
111 "-fstrict-aliasing",
112+ "-Wno-unused-but-set-variable",
113+ "-Wno-unused-variable",
114+ "-Wno-unused-function",
115+ "-Wno-unused-parameter",
116 ]
117
118 # Some of the issues with DoNotOptimize only occur when optimization is enabled
119@@ -27,12 +31,12 @@ PER_SRC_COPTS = {
120
121 TEST_ARGS = ["--benchmark_min_time=0.01"]
122
123-PER_SRC_TEST_ARGS = ({
124+PER_SRC_TEST_ARGS = {
125 "user_counters_tabular_test.cc": ["--benchmark_counters_tabular=true"],
126 "repetitions_test.cc": [" --benchmark_repetitions=3"],
127- "spec_arg_test.cc" : ["--benchmark_filter=BM_NotChosen"],
128- "spec_arg_verbosity_test.cc" : ["--v=42"],
129-})
130+ "spec_arg_test.cc": ["--benchmark_filter=BM_NotChosen"],
131+ "spec_arg_verbosity_test.cc": ["--v=42"],
132+}
133
134 cc_library(
135 name = "output_test_helper",
136@@ -58,14 +62,14 @@ cc_library(
137 copts = select({
138 "//:windows": [],
139 "//conditions:default": TEST_COPTS,
140- }) + PER_SRC_COPTS.get(test_src, []) ,
141+ }) + PER_SRC_COPTS.get(test_src, []),
142 deps = [
143 ":output_test_helper",
144 "//:benchmark",
145 "//:benchmark_internal_headers",
146 "@com_google_googletest//:gtest",
147 "@com_google_googletest//:gtest_main",
148- ]
149+ ],
150 # FIXME: Add support for assembly tests to bazel.
151 # See Issue #556
152 # https://github.com/google/benchmark/issues/556
153@@ -85,6 +89,10 @@ cc_test(
154 size = "small",
155 srcs = ["cxx03_test.cc"],
156 copts = TEST_COPTS + ["-std=c++03"],
157+ target_compatible_with = select({
158+ "//:windows": ["@platforms//:incompatible"],
159+ "//conditions:default": [],
160+ }),
161 deps = [
162 ":output_test_helper",
163 "//:benchmark",
164@@ -92,10 +100,6 @@ cc_test(
165 "@com_google_googletest//:gtest",
166 "@com_google_googletest//:gtest_main",
167 ],
168- target_compatible_with = select({
169- "//:windows": ["@platforms//:incompatible"],
170- "//conditions:default": [],
171- })
172 )
173
174 cc_test(
175diff --git a/tools/BUILD.bazel b/tools/BUILD.bazel
176deleted file mode 100644
177index 5895883..0000000
178--- a/tools/BUILD.bazel
179+++ /dev/null
180@@ -1,19 +0,0 @@
181-load("@py_deps//:requirements.bzl", "requirement")
182-
183-py_library(
184- name = "gbench",
185- srcs = glob(["gbench/*.py"]),
186- deps = [
187- requirement("numpy"),
188- requirement("scipy"),
189- ],
190-)
191-
192-py_binary(
193- name = "compare",
194- srcs = ["compare.py"],
195- python_version = "PY2",
196- deps = [
197- ":gbench",
198- ],
199-)