# Copyright 2021 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
static_library("power_metrics") {
sources = [
"energy_metrics_provider.cc",
"energy_metrics_provider.h",
]
deps = [
"//base",
"//third_party/abseil-cpp:absl",
]
if (is_mac) {
sources += [
"energy_impact_mac.h",
"energy_impact_mac.mm",
"m1_sensors_internal_types_mac.h",
"m1_sensors_mac.h",
"m1_sensors_mac.mm",
"mach_time_mac.h",
"mach_time_mac.mm",
"resource_coalition_internal_types_mac.h",
"resource_coalition_mac.h",
"resource_coalition_mac.mm",
"smc_internal_types_mac.h",
"smc_mac.h",
"smc_mac.mm",
]
}
if (is_win) {
sources += [
"energy_metrics_provider_win.cc",
"energy_metrics_provider_win.h",
]
libs = [ "Setupapi.lib" ]
ldflags = [ "/DELAYLOAD:setupapi.dll" ]
}
if (is_linux || is_chromeos) {
sources += [
"energy_metrics_provider_linux.cc",
"energy_metrics_provider_linux.h",
]
}
if (is_win || is_linux || is_chromeos) {
sources += [
"system_power_monitor.cc",
"system_power_monitor.h",
]
}
}
source_set("unit_tests") {
testonly = true
sources = [ "energy_metrics_provider_unittest.cc" ]
deps = [
":power_metrics",
"//base",
"//testing/gtest",
]
if (is_mac) {
sources += [
"energy_impact_mac_unittest.mm",
"resource_coalition_mac_unittest.mm",
]
data = [ "test/data/" ]
}
if (is_win || is_linux || is_chromeos) {
sources += [ "system_power_monitor_unittest.cc" ]
deps += [ "//base/test:test_support" ]
}
}