chromium/third_party/google_benchmark/BUILD.gn

# Copyright 2019 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

config("benchmark_config") {
  include_dirs = [ "src/include" ]

  if (!is_component_build) {
    defines = [ "BENCHMARK_STATIC_DEFINE" ]
  }
}

component("google_benchmark") {
  testonly = true

  public = [
    "src/include/benchmark/benchmark.h",
    "src/include/benchmark/export.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.cc",
    "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/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" ]

  configs -= [ "//build/config/compiler:chromium_code" ]
  configs += [ "//build/config/compiler:no_chromium_code" ]

  if (is_win) {
    configs -= [ "//build/config/win:nominmax" ]
  }

  defines = [
    "benchmark_EXPORTS=1",

    # Tell gtest to always use standard regular expressions.
    "HAVE_STD_REGEX=1",

    # google_benchmark expects a BENCHMARK_VERSION definition
    "BENCHMARK_VERSION=\"1.8.3\"",
  ]
}

component("benchmark_main") {
  testonly = true
  sources = [ "src/src/benchmark_main.cc" ]
  defines = [ "benchmark_EXPORTS=1" ]
  deps = [ ":google_benchmark" ]
}