From df4cbb4dff0266b926242f2386f5f0cb93884322 Mon Sep 17 00:00:00 2001 From: Michael Lippautz Date: Fri, 22 Jul 2022 23:04:28 +0200 Subject: [PATCH] google_benchmark: Manually roll and fix build Manually roll forward `google_benchmark` and rely on the shipped export header file. Adjust the build rules to always imply a static build though as that's how the library is used in v8. Bug: chromium:1346538 Change-Id: Ia94ad976f533a1c1d8099f1bc931b491d6fb17dd Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3782798 Reviewed-by: Michael Achenbach Commit-Queue: Michael Lippautz Cr-Commit-Position: refs/heads/main@{#81907} --- DEPS | 2 +- third_party/google_benchmark/BUILD.gn | 18 ++++++----- .../precompiled_headers/benchmark/export.h | 31 ------------------- 3 files changed, 11 insertions(+), 40 deletions(-) delete mode 100644 third_party/google_benchmark/precompiled_headers/benchmark/export.h diff --git a/DEPS b/DEPS index 7b56dd5378..1da719dbbb 100644 --- a/DEPS +++ b/DEPS @@ -235,7 +235,7 @@ deps = { 'dep_type': 'cipd', }, 'third_party/google_benchmark/src': { - 'url': Var('chromium_url') + '/external/github.com/google/benchmark.git' + '@' + 'd4bc509bcd54266e80bef26d5829ea43ead2908e', + 'url': Var('chromium_url') + '/external/github.com/google/benchmark.git' + '@' + 'ef7f75fb182fc23d03b4a3ecd09cc325ac125dfd', }, 'third_party/googletest/src': Var('chromium_url') + '/external/github.com/google/googletest.git' + '@' + 'af29db7ec28d6df1c7f0f745186884091e602e07', diff --git a/third_party/google_benchmark/BUILD.gn b/third_party/google_benchmark/BUILD.gn index e2fe35a329..706065640b 100644 --- a/third_party/google_benchmark/BUILD.gn +++ b/third_party/google_benchmark/BUILD.gn @@ -7,22 +7,26 @@ import("../../gni/v8.gni") if (v8_enable_google_benchmark) { config("benchmark_config") { - include_dirs = [ - "src/include", - "precompiled_headers", + include_dirs = [ "src/include" ] + defines = [ + # We always build google_benchmark statically. + "BENCHMARK_STATIC_DEFINE=1", ] } # TODO(crbug.com/1344570): Remove once third_party/google_benchmark no longer # uses std::wstring_convert. config("benchmark_suppress_warnings") { - cflags = ["-Wno-deprecated-declarations"] + cflags = [ "-Wno-deprecated-declarations" ] } source_set("google_benchmark") { testonly = true - public = [ "src/include/benchmark/benchmark.h" ] + public = [ + "src/include/benchmark/benchmark.h", + "src/include/benchmark/export.h", + ] sources = [ "src/src/arraysize.h", @@ -70,9 +74,7 @@ if (v8_enable_google_benchmark) { all_dependent_configs = [ ":benchmark_config" ] - configs += [ - ":benchmark_suppress_warnings", - ] + configs += [ ":benchmark_suppress_warnings" ] defines = [ # Tell google_benchmark to always use standard regular expressions. diff --git a/third_party/google_benchmark/precompiled_headers/benchmark/export.h b/third_party/google_benchmark/precompiled_headers/benchmark/export.h deleted file mode 100644 index a69f5a6ddc..0000000000 --- a/third_party/google_benchmark/precompiled_headers/benchmark/export.h +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2022 The V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef THIRD_PARTY_GOOGLE_BENCHMARK_PRECOMPILED_HEADERS_BENCHMARK_EXPORT_H -#define THIRD_PARTY_GOOGLE_BENCHMARK_PRECOMPILED_HEADERS_BENCHMARK_EXPORT_H - -// This is a precompiled header as export.h is usually generated by the -// libraries build system. - -#ifndef BENCHMARK_EXPORT -#define BENCHMARK_EXPORT -#endif - -#ifndef BENCHMARK_NO_EXPORT -#define BENCHMARK_NO_EXPORT -#endif - -#ifndef BENCHMARK_DEPRECATED -#define BENCHMARK_DEPRECATED __attribute__((__deprecated__)) -#endif - -#ifndef BENCHMARK_DEPRECATED_EXPORT -#define BENCHMARK_DEPRECATED_EXPORT BENCHMARK_EXPORT BENCHMARK_DEPRECATED -#endif - -#ifndef BENCHMARK_DEPRECATED_NO_EXPORT -#define BENCHMARK_DEPRECATED_NO_EXPORT BENCHMARK_NO_EXPORT BENCHMARK_DEPRECATED -#endif - -#endif // THIRD_PARTY_GOOGLE_BENCHMARK_PRECOMPILED_HEADERS_BENCHMARK_EXPORT_H