Always check out google_benchmark, part 1.
We can't yet remove the checkout_google_benchmark variable, because
webrtc sets it, and that can't be removed until we land this CL.
Bug: 1404759
Change-Id: I3067b46cc27bf622065593cdbaa01ea6e5b3322d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4322306
Reviewed-by: Austin Sullivan <asully@chromium.org>
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1115000}
NOKEYCHECK=True
GitOrigin-RevId: 21e5fcc2ac7ced5e13749338981345593da48334
diff --git a/BUILD.gn b/BUILD.gn
index 20a84ae..09e0be4 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -2,86 +2,82 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-import("buildconfig.gni")
+config("benchmark_config") {
+ include_dirs = [ "src/include" ]
+}
-if (enable_google_benchmarks) {
- config("benchmark_config") {
- include_dirs = [ "src/include" ]
- }
+# TODO(crbug.com/1344570): Remove once third_party/google_benchmark no longer
+# uses std::wstring_convert.
+config("benchmark_suppress_warnings") {
+ cflags = [ "-Wno-deprecated-declarations" ]
+}
- # TODO(crbug.com/1344570): Remove once third_party/google_benchmark no longer
- # uses std::wstring_convert.
- config("benchmark_suppress_warnings") {
- cflags = ["-Wno-deprecated-declarations"]
- }
+source_set("google_benchmark") {
+ testonly = true
- source_set("google_benchmark") {
- testonly = true
+ public = [ "src/include/benchmark/benchmark.h" ]
- public = [ "src/include/benchmark/benchmark.h" ]
+ sources = [
+ "src/src/arraysize.h",
+ "src/src/benchmark.cc",
+ "src/src/benchmark_api_internal.cc",
+ "src/src/benchmark_api_internal.h",
+ "src/src/benchmark_name.cc",
+ "src/src/benchmark_register.cc",
+ "src/src/benchmark_register.h",
+ "src/src/benchmark_runner.cc",
+ "src/src/benchmark_runner.h",
+ "src/src/check.h",
+ "src/src/colorprint.cc",
+ "src/src/colorprint.h",
+ "src/src/commandlineflags.cc",
+ "src/src/commandlineflags.h",
+ "src/src/complexity.cc",
+ "src/src/complexity.h",
+ "src/src/console_reporter.cc",
+ "src/src/counter.cc",
+ "src/src/counter.h",
+ "src/src/csv_reporter.cc",
+ "src/src/cycleclock.h",
+ "src/src/internal_macros.h",
+ "src/src/json_reporter.cc",
+ "src/src/log.h",
+ "src/src/mutex.h",
+ "src/src/perf_counters.cc",
+ "src/src/perf_counters.h",
+ "src/src/re.h",
+ "src/src/reporter.cc",
+ "src/src/sleep.cc",
+ "src/src/sleep.h",
+ "src/src/statistics.cc",
+ "src/src/statistics.h",
+ "src/src/string_util.cc",
+ "src/src/string_util.h",
+ "src/src/sysinfo.cc",
+ "src/src/thread_manager.h",
+ "src/src/thread_timer.h",
+ "src/src/timers.cc",
+ "src/src/timers.h",
+ ]
- sources = [
- "src/src/arraysize.h",
- "src/src/benchmark.cc",
- "src/src/benchmark_api_internal.cc",
- "src/src/benchmark_api_internal.h",
- "src/src/benchmark_name.cc",
- "src/src/benchmark_register.cc",
- "src/src/benchmark_register.h",
- "src/src/benchmark_runner.cc",
- "src/src/benchmark_runner.h",
- "src/src/check.h",
- "src/src/colorprint.cc",
- "src/src/colorprint.h",
- "src/src/commandlineflags.cc",
- "src/src/commandlineflags.h",
- "src/src/complexity.cc",
- "src/src/complexity.h",
- "src/src/console_reporter.cc",
- "src/src/counter.cc",
- "src/src/counter.h",
- "src/src/csv_reporter.cc",
- "src/src/cycleclock.h",
- "src/src/internal_macros.h",
- "src/src/json_reporter.cc",
- "src/src/log.h",
- "src/src/mutex.h",
- "src/src/perf_counters.cc",
- "src/src/perf_counters.h",
- "src/src/re.h",
- "src/src/reporter.cc",
- "src/src/sleep.cc",
- "src/src/sleep.h",
- "src/src/statistics.cc",
- "src/src/statistics.h",
- "src/src/string_util.cc",
- "src/src/string_util.h",
- "src/src/sysinfo.cc",
- "src/src/thread_manager.h",
- "src/src/thread_timer.h",
- "src/src/timers.cc",
- "src/src/timers.h",
- ]
+ all_dependent_configs = [ ":benchmark_config" ]
- all_dependent_configs = [ ":benchmark_config" ]
+ configs -= [ "//build/config/compiler:chromium_code" ]
+ configs += [
+ "//build/config/compiler:no_chromium_code",
+ ":benchmark_suppress_warnings",
+ ]
- configs -= [ "//build/config/compiler:chromium_code" ]
- configs += [
- "//build/config/compiler:no_chromium_code",
- ":benchmark_suppress_warnings",
- ]
+ defines = [
+ # Tell gtest to always use standard regular expressions.
+ "HAVE_GNU_POSIX_REGEX=0",
+ "HAVE_POSIX_REGEX=0",
+ "HAVE_STD_REGEX=1",
+ ]
+}
- defines = [
- # Tell gtest to always use standard regular expressions.
- "HAVE_GNU_POSIX_REGEX=0",
- "HAVE_POSIX_REGEX=0",
- "HAVE_STD_REGEX=1",
- ]
- }
-
- source_set("benchmark_main") {
- testonly = true
- sources = [ "src/src/benchmark_main.cc" ]
- deps = [ ":google_benchmark" ]
- }
+source_set("benchmark_main") {
+ testonly = true
+ sources = [ "src/src/benchmark_main.cc" ]
+ deps = [ ":google_benchmark" ]
}
diff --git a/README.chromium b/README.chromium
index fdf4f54..e0a77c9 100644
--- a/README.chromium
+++ b/README.chromium
@@ -9,17 +9,5 @@
Description:
A microbenchmark support library.
-Google Benchmark is NOT supported for writing benchmarks in Chromium. It is
-included to run benchmarks in third-party code that have already been written
-against Google Benchmarks.
-
-To include this library in the Chromium checkout, add the following clause to
-your .gclient configuration.
-
- "custom_vars": {
- "checkout_google_benchmark": True,
- }
-
-
Local Additions:
* gn file for building in chromium