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 <machenbach@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81907}
This commit is contained in:
Michael Lippautz 2022-07-22 23:04:28 +02:00 committed by V8 LUCI CQ
parent 655e76b4f6
commit df4cbb4dff
3 changed files with 11 additions and 40 deletions

2
DEPS
View File

@ -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',

View File

@ -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.

View File

@ -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