blob: 647bc00658f004ed91f821e9cec45a2db1ed2eee [file] [log] [blame]
# Copyright 2020 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//common-mk/deps.gni")
import("//common-mk/pkg_config.gni")
group("all") {
deps = [
":install_fingerprint_headers",
":install_libec_headers",
":libec",
":libec_pc",
":libec_static",
]
if (use.test) {
deps += [ ":libec_tests" ]
}
}
default_pkg_deps = [
"libbrillo",
"libchrome",
]
pkg_config("target_defaults_pkg_deps") {
pkg_deps = default_pkg_deps
}
libec_sources = [
"device_event_command.cc",
"display_soc_command.cc",
"ec_command_factory.cc",
"fingerprint/fp_context_command.cc",
"fingerprint/fp_context_command_factory.cc",
"fingerprint/fp_flashprotect_command.cc",
"fingerprint/fp_frame_command.cc",
"fingerprint/fp_info_command.cc",
"fingerprint/fp_mode.cc",
"fingerprint/fp_mode_command.cc",
"fingerprint/fp_read_match_secret_command.cc",
"fingerprint/fp_seed_command.cc",
"fingerprint/fp_template_command.cc",
"get_protocol_info_command.cc",
"get_version_command.cc",
"mkbp_wake_mask_command.cc",
"smart_discharge_command.cc",
"versions_command.cc",
]
static_library("libec_static") {
sources = libec_sources
configs += [ ":target_defaults_pkg_deps" ]
install_path = "lib"
}
shared_library("libec") {
sources = libec_sources
configs += [ ":target_defaults_pkg_deps" ]
install_path = "lib"
}
install_config("install_libec_headers") {
sources = [
"charge_control_set_command.h",
"device_event_command.h",
"display_soc_command.h",
"ec_command.h",
"ec_command_async.h",
"ec_command_factory.h",
"get_protocol_info_command.h",
"get_version_command.h",
"mkbp_wake_mask_command.h",
"mock_ec_command_factory.h",
"pd_chip_info_command.h",
"reboot_command.h",
"rgb_keyboard_command.h",
"rwsig_action_command.h",
"smart_discharge_command.h",
"versions_command.h",
]
install_path = "/usr/include/libec"
}
install_config("install_fingerprint_headers") {
sources = [
"fingerprint/fp_context_command.h",
"fingerprint/fp_context_command_factory.h",
"fingerprint/fp_flashprotect_command.h",
"fingerprint/fp_frame_command.h",
"fingerprint/fp_info_command.h",
"fingerprint/fp_mode.h",
"fingerprint/fp_mode_command.h",
"fingerprint/fp_read_match_secret_command.h",
"fingerprint/fp_seed_command.h",
"fingerprint/fp_sensor_errors.h",
"fingerprint/fp_template_command.h",
"fingerprint/sensor_id.h",
"fingerprint/sensor_image.h",
"fingerprint/template_info.h",
]
install_path = "/usr/include/libec/fingerprint"
}
if (use.test) {
executable("libec_tests") {
sources = [
"charge_control_set_command_test.cc",
"device_event_command_test.cc",
"display_soc_command_test.cc",
"ec_command_async_test.cc",
"ec_command_test.cc",
"fingerprint/fp_context_command_factory_test.cc",
"fingerprint/fp_context_command_test.cc",
"fingerprint/fp_flashprotect_command_test.cc",
"fingerprint/fp_frame_command_test.cc",
"fingerprint/fp_info_command_test.cc",
"fingerprint/fp_mode_command_test.cc",
"fingerprint/fp_mode_test.cc",
"fingerprint/fp_read_match_secret_command_test.cc",
"fingerprint/fp_seed_command_test.cc",
"fingerprint/fp_template_command_test.cc",
"fingerprint/fp_template_params_test.cc",
"get_protocol_info_command_test.cc",
"get_version_command_test.cc",
"mkbp_wake_mask_command_test.cc",
"pd_chip_info_command_test.cc",
"reboot_command_test.cc",
"rgb_keyboard_command_test.cc",
"rwsig_action_command_test.cc",
"smart_discharge_command_test.cc",
"versions_command_test.cc",
]
configs += [
"//common-mk:test",
":target_defaults_pkg_deps",
]
run_test = true
deps = [
":libec_static",
"//common-mk/testrunner",
]
pkg_deps = [ "libchrome-test" ]
}
}
generate_pkg_config("libec_pc") {
name = "libec"
output_name = "libec"
description = "Chromium OS Embedded Controller Library"
version = "0.1"
# ec_command.h uses base/logging.h (and is a header-only class), so we need
# a direct dependency on libchrome.
requires = [ "libchrome" ]
requires_private = default_pkg_deps
libs = [ "-lec" ]
install = true
}