xref: /aosp_15_r20/external/cronet/third_party/google_benchmark/BUILD.gn (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1# Copyright 2019 The Chromium Authors
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5config("benchmark_config") {
6  include_dirs = [ "src/include" ]
7
8  if (!is_component_build) {
9    defines = [ "BENCHMARK_STATIC_DEFINE" ]
10  }
11}
12
13component("google_benchmark") {
14  testonly = true
15
16  public = [
17    "src/include/benchmark/benchmark.h",
18    "src/include/benchmark/export.h",
19  ]
20
21  sources = [
22    "src/src/arraysize.h",
23    "src/src/benchmark.cc",
24    "src/src/benchmark_api_internal.cc",
25    "src/src/benchmark_api_internal.h",
26    "src/src/benchmark_name.cc",
27    "src/src/benchmark_register.cc",
28    "src/src/benchmark_register.h",
29    "src/src/benchmark_runner.cc",
30    "src/src/benchmark_runner.h",
31    "src/src/check.cc",
32    "src/src/check.h",
33    "src/src/colorprint.cc",
34    "src/src/colorprint.h",
35    "src/src/commandlineflags.cc",
36    "src/src/commandlineflags.h",
37    "src/src/complexity.cc",
38    "src/src/complexity.h",
39    "src/src/console_reporter.cc",
40    "src/src/counter.cc",
41    "src/src/counter.h",
42    "src/src/csv_reporter.cc",
43    "src/src/cycleclock.h",
44    "src/src/internal_macros.h",
45    "src/src/json_reporter.cc",
46    "src/src/log.h",
47    "src/src/mutex.h",
48    "src/src/perf_counters.cc",
49    "src/src/perf_counters.h",
50    "src/src/re.h",
51    "src/src/reporter.cc",
52    "src/src/statistics.cc",
53    "src/src/statistics.h",
54    "src/src/string_util.cc",
55    "src/src/string_util.h",
56    "src/src/sysinfo.cc",
57    "src/src/thread_manager.h",
58    "src/src/thread_timer.h",
59    "src/src/timers.cc",
60    "src/src/timers.h",
61  ]
62
63  all_dependent_configs = [ ":benchmark_config" ]
64
65  configs -= [ "//build/config/compiler:chromium_code" ]
66  configs += [ "//build/config/compiler:no_chromium_code" ]
67
68  if (is_win) {
69    configs -= [ "//build/config/win:nominmax" ]
70  }
71
72  defines = [
73    "benchmark_EXPORTS=1",
74
75    # Tell gtest to always use standard regular expressions.
76    "HAVE_STD_REGEX=1",
77
78    # google_benchmark expects a BENCHMARK_VERSION definition
79    "BENCHMARK_VERSION=\"1.8.3\"",
80  ]
81}
82
83component("benchmark_main") {
84  testonly = true
85  sources = [ "src/src/benchmark_main.cc" ]
86  defines = [ "benchmark_EXPORTS=1" ]
87  deps = [ ":google_benchmark" ]
88}
89