Build benchmarks with Bazel

Change-Id: I559cc1aa17d5be01dcff931e05b22e0dd9e248b6
This commit is contained in:
Keir Mierle
2018-02-25 15:18:08 -08:00
parent a3b1e19c2c
commit 22fa21c6f8
2 changed files with 38 additions and 0 deletions
+12
View File
@@ -199,3 +199,15 @@ TEST_DEPS = [
) for test_filename in glob([
"internal/ceres/generated_bundle_adjustment_tests/*_test.cc",
])]
# Build the benchmarks.
[cc_binary(
name = benchmark_name,
srcs = ["internal/ceres/" + benchmark_name + ".cc"],
copts = TEST_COPTS,
deps = TEST_DEPS + ["@com_github_google_benchmark//:benchmark"],
) for benchmark_name in [
"autodiff_cost_function_benchmark",
"small_blas_gemm_benchmark",
"small_blas_gemv_benchmark",
]]
+26
View File
@@ -63,3 +63,29 @@ new_http_archive(
"http://bitbucket.org/eigen/eigen/get/3.3.4.tar.bz2",
],
)
# External dependency: Google Benchmark; has no Bazel build.
new_http_archive(
name = "com_github_google_benchmark",
urls = ["https://github.com/google/benchmark/archive/56f52ee228783547f544d9ac4a533574b9010e3f.zip"],
sha256 = "8c1c6e90cd320b07504fabb86400f390faff2e599183ebd9396908817968ae79",
strip_prefix = "benchmark-56f52ee228783547f544d9ac4a533574b9010e3f",
build_file_content =
"""
cc_library(
name = "benchmark",
srcs = glob([
"src/*.h",
"src/*.cc",
]),
hdrs = glob(["include/benchmark/*.h"]),
copts = [
"-DHAVE_STD_REGEX",
],
includes = [
"include",
],
visibility = ["//visibility:public"],
)
"""
)