From 48d868493fa74025e7768afacdbbbd3ea9c82468 Mon Sep 17 00:00:00 2001 From: Mircea Trofin Date: Tue, 14 Dec 2021 08:07:29 -0800 Subject: [PATCH] [benchmark] Delete BUILD files Bazel support is through utils/bazel, and the BUILD files in `benchmark` just complicate downstream integrates for bazel based builds. Differential Revision: https://reviews.llvm.org/D115733 --- third-party/benchmark/BUILD.bazel | 52 ------------- third-party/benchmark/bindings/python/BUILD | 3 - .../bindings/python/google_benchmark/BUILD | 38 ---------- third-party/benchmark/test/BUILD | 75 ------------------- third-party/benchmark/tools/BUILD.bazel | 19 ----- third-party/update_benchmark.sh | 2 + 6 files changed, 2 insertions(+), 187 deletions(-) delete mode 100644 third-party/benchmark/BUILD.bazel delete mode 100644 third-party/benchmark/bindings/python/BUILD delete mode 100644 third-party/benchmark/bindings/python/google_benchmark/BUILD delete mode 100644 third-party/benchmark/test/BUILD delete mode 100644 third-party/benchmark/tools/BUILD.bazel diff --git a/third-party/benchmark/BUILD.bazel b/third-party/benchmark/BUILD.bazel deleted file mode 100644 index 904c691d643e..000000000000 --- a/third-party/benchmark/BUILD.bazel +++ /dev/null @@ -1,52 +0,0 @@ -licenses(["notice"]) - -config_setting( - name = "qnx", - constraint_values = ["@platforms//os:qnx"], - values = { - "cpu": "x64_qnx", - }, - visibility = [":__subpackages__"], -) - -config_setting( - name = "windows", - constraint_values = ["@platforms//os:windows"], - values = { - "cpu": "x64_windows", - }, - visibility = [":__subpackages__"], -) - -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"], - "//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__"], -) diff --git a/third-party/benchmark/bindings/python/BUILD b/third-party/benchmark/bindings/python/BUILD deleted file mode 100644 index 9559a76b30a9..000000000000 --- a/third-party/benchmark/bindings/python/BUILD +++ /dev/null @@ -1,3 +0,0 @@ -exports_files(glob(["*.BUILD"])) -exports_files(["build_defs.bzl"]) - diff --git a/third-party/benchmark/bindings/python/google_benchmark/BUILD b/third-party/benchmark/bindings/python/google_benchmark/BUILD deleted file mode 100644 index 3c1561f48eee..000000000000 --- a/third-party/benchmark/bindings/python/google_benchmark/BUILD +++ /dev/null @@ -1,38 +0,0 @@ -load("//bindings/python:build_defs.bzl", "py_extension") - -py_library( - name = "google_benchmark", - srcs = ["__init__.py"], - visibility = ["//visibility:public"], - deps = [ - ":_benchmark", - # pip; absl:app - ], -) - -py_extension( - name = "_benchmark", - srcs = ["benchmark.cc"], - copts = [ - "-fexceptions", - "-fno-strict-aliasing", - ], - features = ["-use_header_modules"], - deps = [ - "//:benchmark", - "@pybind11", - "@python_headers", - ], -) - -py_test( - name = "example", - srcs = ["example.py"], - python_version = "PY3", - srcs_version = "PY3", - visibility = ["//visibility:public"], - deps = [ - ":google_benchmark", - ], -) - diff --git a/third-party/benchmark/test/BUILD b/third-party/benchmark/test/BUILD deleted file mode 100644 index df700a7a8100..000000000000 --- a/third-party/benchmark/test/BUILD +++ /dev/null @@ -1,75 +0,0 @@ -TEST_COPTS = [ - "-pedantic", - "-pedantic-errors", - "-std=c++11", - "-Wall", - "-Wextra", - "-Wshadow", - # "-Wshorten-64-to-32", - "-Wfloat-equal", - "-fstrict-aliasing", -] - -PER_SRC_COPTS = ({ - "cxx03_test.cc": ["-std=c++03"], - # Some of the issues with DoNotOptimize only occur when optimization is enabled - "donotoptimize_test.cc": ["-O3"], -}) - -TEST_ARGS = ["--benchmark_min_time=0.01"] - -PER_SRC_TEST_ARGS = ({ - "user_counters_tabular_test.cc": ["--benchmark_counters_tabular=true"], - "repetitions_test.cc": [" --benchmark_repetitions=3"], - "spec_arg_test.cc" : ["--benchmark_filter=BM_NotChosen"], -}) - -load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test") - -cc_library( - name = "output_test_helper", - testonly = 1, - srcs = ["output_test_helper.cc"], - hdrs = ["output_test.h"], - copts = TEST_COPTS, - deps = [ - "//:benchmark", - "//:benchmark_internal_headers", - ], -) - -[ - cc_test( - name = test_src[:-len(".cc")], - size = "small", - srcs = [test_src], - args = TEST_ARGS + PER_SRC_TEST_ARGS.get(test_src, []), - copts = TEST_COPTS + PER_SRC_COPTS.get(test_src, []), - deps = [ - ":output_test_helper", - "//:benchmark", - "//:benchmark_internal_headers", - "@com_google_googletest//:gtest", - ] + ( - ["@com_google_googletest//:gtest_main"] if (test_src[-len("gtest.cc"):] == "gtest.cc") else [] - ), - # FIXME: Add support for assembly tests to bazel. - # See Issue #556 - # https://github.com/google/benchmark/issues/556 - ) - for test_src in glob( - ["*test.cc"], - exclude = [ - "*_assembly_test.cc", - "link_main_test.cc", - ], - ) -] - -cc_test( - name = "link_main_test", - size = "small", - srcs = ["link_main_test.cc"], - copts = TEST_COPTS, - deps = ["//:benchmark_main"], -) diff --git a/third-party/benchmark/tools/BUILD.bazel b/third-party/benchmark/tools/BUILD.bazel deleted file mode 100644 index 5895883a2eb3..000000000000 --- a/third-party/benchmark/tools/BUILD.bazel +++ /dev/null @@ -1,19 +0,0 @@ -load("@py_deps//:requirements.bzl", "requirement") - -py_library( - name = "gbench", - srcs = glob(["gbench/*.py"]), - deps = [ - requirement("numpy"), - requirement("scipy"), - ], -) - -py_binary( - name = "compare", - srcs = ["compare.py"], - python_version = "PY2", - deps = [ - ":gbench", - ], -) diff --git a/third-party/update_benchmark.sh b/third-party/update_benchmark.sh index 6d131d77ebf1..cda0bcfb1a7a 100755 --- a/third-party/update_benchmark.sh +++ b/third-party/update_benchmark.sh @@ -11,4 +11,6 @@ read -p "Press a key to continue, or Ctrl+C to cancel" rm -rf benchmark git clone https://github.com/google/benchmark.git rm -rf benchmark/.git* +find benchmark/ -name BUILD -delete +find benchmark/ -name BUILD.bazel -delete