| # Copyright 2020 The ChromiumOS Authors |
| # 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", |
| ":install_pwm_headers", |
| ":install_thermal_headers", |
| ":libec", |
| ":libec_pc", |
| ":libec_static", |
| ] |
| if (use.test) { |
| deps += [ ":libec_tests" ] |
| } |
| if (use.fuzzer) { |
| deps += [ ":libec_ec_panicinfo_fuzzer" ] |
| } |
| } |
| |
| default_pkg_deps = [ |
| "absl", |
| "libbrillo", |
| "libchrome", |
| "libpower_manager-client", |
| "libusb-1.0", |
| ] |
| pkg_config("target_defaults_pkg_deps") { |
| pkg_deps = default_pkg_deps |
| } |
| |
| source_set("libec_common") { |
| sources = [ |
| "add_entropy_command.cc", |
| "charge_current_limit_set_command.cc", |
| "device_event_command.cc", |
| "display_soc_command.cc", |
| "ec_command_factory.cc", |
| "ec_panicinfo.cc", |
| "ec_usb_device_monitor.cc", |
| "ec_usb_endpoint.cc", |
| "fingerprint/fp_context_command.cc", |
| "fingerprint/fp_context_command_factory.cc", |
| "fingerprint/fp_encryption_status_command.cc", |
| "fingerprint/fp_frame_command.cc", |
| "fingerprint/fp_get_nonce_command.cc", |
| "fingerprint/fp_info_command.cc", |
| "fingerprint/fp_mode.cc", |
| "fingerprint/fp_mode_command.cc", |
| "fingerprint/fp_pairing_key_keygen_command.cc", |
| "fingerprint/fp_pairing_key_wrap_command.cc", |
| "fingerprint/fp_preload_template_command.cc", |
| "fingerprint/fp_read_match_secret_command.cc", |
| "fingerprint/fp_read_match_secret_with_pubkey_command.cc", |
| "fingerprint/fp_seed_command.cc", |
| "fingerprint/fp_stats_command.cc", |
| "fingerprint/fp_template_command.cc", |
| "flash_info_command.cc", |
| "flash_info_params.cc", |
| "flash_protect_command.cc", |
| "flash_protect_command_factory.cc", |
| "flash_spi_info_command.cc", |
| "get_chip_info_command.cc", |
| "get_comms_status_command.cc", |
| "get_features_command.cc", |
| "get_mkbp_wake_mask_command.cc", |
| "get_protocol_info_command.cc", |
| "get_version_command.cc", |
| "hello_command.cc", |
| "i2c_passthru_command.cc", |
| "i2c_read_command.cc", |
| "led_control_command.cc", |
| "mkbp_event.cc", |
| "motion_sense_command_lid_angle.cc", |
| "rand_num_command.cc", |
| "reboot_ec_command.cc", |
| "rollback_info_command.cc", |
| "set_force_lid_open_command.cc", |
| "set_mkbp_wake_mask_command.cc", |
| "smart_discharge_command.cc", |
| "versions_command.cc", |
| ] |
| configs += [ |
| ":target_defaults_pkg_deps", |
| "//common-mk:pic", |
| ] |
| } |
| |
| static_library("libec_static") { |
| deps = [ ":libec_common" ] |
| install_path = "lib" |
| } |
| |
| shared_library("libec") { |
| deps = [ ":libec_common" ] |
| install_path = "lib" |
| } |
| |
| install_config("install_libec_headers") { |
| sources = [ |
| "add_entropy_command.h", |
| "charge_control_set_command.h", |
| "charge_current_limit_set_command.h", |
| "device_event_command.h", |
| "display_soc_command.h", |
| "ec_command.h", |
| "ec_command_async.h", |
| "ec_command_factory.h", |
| "ec_panicinfo.h", |
| "ec_usb_device_monitor.h", |
| "ec_usb_endpoint.h", |
| "flash_info_command.h", |
| "flash_info_params.h", |
| "flash_protect_command.h", |
| "flash_protect_command_factory.h", |
| "flash_spi_info_command.h", |
| "get_chip_info_command.h", |
| "get_comms_status_command.h", |
| "get_features_command.h", |
| "get_mkbp_wake_mask_command.h", |
| "get_protocol_info_command.h", |
| "get_version_command.h", |
| "hello_command.h", |
| "i2c_passthru_command.h", |
| "i2c_passthru_params.h", |
| "i2c_read_command.h", |
| "led_control_command.h", |
| "libusb_wrapper.h", |
| "mkbp_event.h", |
| "mock_ec_command_factory.h", |
| "motion_sense_command.h", |
| "motion_sense_command_lid_angle.h", |
| "pd_chip_info_command.h", |
| "rand_num_command.h", |
| "rand_num_params.h", |
| "read_memmap_command.h", |
| "reboot_command.h", |
| "reboot_ec_command.h", |
| "rgb_keyboard_command.h", |
| "rollback_info_command.h", |
| "rwsig_action_command.h", |
| "set_force_lid_open_command.h", |
| "set_mkbp_wake_mask_command.h", |
| "smart_discharge_command.h", |
| "versions_command.h", |
| ] |
| install_path = "/usr/include/libec" |
| } |
| |
| install_config("install_fingerprint_headers") { |
| sources = [ |
| "fingerprint/cros_fp_device_interface.h", |
| "fingerprint/fp_context_command.h", |
| "fingerprint/fp_context_command_factory.h", |
| "fingerprint/fp_encryption_status_command.h", |
| "fingerprint/fp_frame_command.h", |
| "fingerprint/fp_get_nonce_command.h", |
| "fingerprint/fp_info_command.h", |
| "fingerprint/fp_mode.h", |
| "fingerprint/fp_mode_command.h", |
| "fingerprint/fp_pairing_key_keygen_command.h", |
| "fingerprint/fp_pairing_key_load_command.h", |
| "fingerprint/fp_pairing_key_wrap_command.h", |
| "fingerprint/fp_preload_template_command.h", |
| "fingerprint/fp_preload_template_params.h", |
| "fingerprint/fp_read_match_secret_command.h", |
| "fingerprint/fp_read_match_secret_with_pubkey_command.h", |
| "fingerprint/fp_seed_command.h", |
| "fingerprint/fp_sensor_errors.h", |
| "fingerprint/fp_set_nonce_context_command.h", |
| "fingerprint/fp_stats_command.h", |
| "fingerprint/fp_template_command.h", |
| "fingerprint/fp_template_params.h", |
| "fingerprint/sensor_id.h", |
| "fingerprint/sensor_image.h", |
| "fingerprint/template_info.h", |
| ] |
| install_path = "/usr/include/libec/fingerprint" |
| } |
| |
| install_config("install_pwm_headers") { |
| sources = [ |
| "pwm/pwm_get_fan_target_rpm_command.h", |
| "pwm/pwm_keyboard_command.h", |
| "pwm/pwm_set_fan_target_rpm_command.h", |
| ] |
| install_path = "/usr/include/libec/pwm" |
| } |
| |
| install_config("install_thermal_headers") { |
| sources = [ |
| "thermal/get_memmap_temp_b_command.h", |
| "thermal/get_memmap_temp_command.h", |
| "thermal/get_memmap_thermal_version_command.h", |
| "thermal/temp_sensor_get_info_command.h", |
| "thermal/thermal_auto_fan_ctrl_command.h", |
| ] |
| install_path = "/usr/include/libec/thermal" |
| } |
| |
| if (use.test) { |
| config("libec_lib_test_all_dependent_configs") { |
| libs = [ "system_api-power_manager-protos" ] |
| } |
| |
| executable("libec_tests") { |
| sources = [ |
| "add_entropy_command_test.cc", |
| "charge_control_set_command_test.cc", |
| "charge_current_limit_set_command_test.cc", |
| "device_event_command_test.cc", |
| "display_soc_command_test.cc", |
| "ec_command_async_test.cc", |
| "ec_command_test.cc", |
| "ec_panicinfo_test.cc", |
| "ec_usb_device_monitor_test.cc", |
| "ec_usb_endpoint_test.cc", |
| "fingerprint/fp_context_command_factory_test.cc", |
| "fingerprint/fp_context_command_test.cc", |
| "fingerprint/fp_encryption_status_command_test.cc", |
| "fingerprint/fp_frame_command_test.cc", |
| "fingerprint/fp_get_nonce_command_test.cc", |
| "fingerprint/fp_info_command_test.cc", |
| "fingerprint/fp_mode_command_test.cc", |
| "fingerprint/fp_mode_test.cc", |
| "fingerprint/fp_pairing_key_keygen_command_test.cc", |
| "fingerprint/fp_pairing_key_load_command_test.cc", |
| "fingerprint/fp_pairing_key_wrap_command_test.cc", |
| "fingerprint/fp_preload_template_command_test.cc", |
| "fingerprint/fp_preload_template_params_test.cc", |
| "fingerprint/fp_read_match_secret_command_test.cc", |
| "fingerprint/fp_read_match_secret_with_pubkey_command_test.cc", |
| "fingerprint/fp_seed_command_test.cc", |
| "fingerprint/fp_set_nonce_context_command_test.cc", |
| "fingerprint/fp_stats_command_test.cc", |
| "fingerprint/fp_template_command_test.cc", |
| "fingerprint/fp_template_params_test.cc", |
| "flash_info_command_test.cc", |
| "flash_info_params_test.cc", |
| "flash_protect_command_factory_test.cc", |
| "flash_protect_command_test.cc", |
| "flash_spi_info_command_test.cc", |
| "get_chip_info_command_test.cc", |
| "get_comms_status_command_test.cc", |
| "get_features_command_test.cc", |
| "get_mkbp_wake_mask_command_test.cc", |
| "get_protocol_info_command_test.cc", |
| "get_version_command_test.cc", |
| "hello_command_test.cc", |
| "i2c_passthru_command_test.cc", |
| "i2c_passthru_params_test.cc", |
| "i2c_read_command_test.cc", |
| "led_control_command_test.cc", |
| "motion_sense_command_lid_angle_test.cc", |
| "pd_chip_info_command_test.cc", |
| "pwm/pwm_get_fan_target_rpm_command_test.cc", |
| "pwm/pwm_keyboard_command_test.cc", |
| "pwm/pwm_set_fan_target_rpm_command_test.cc", |
| "rand_num_command_test.cc", |
| "rand_num_params_test.cc", |
| "read_memmap_command_test.cc", |
| "reboot_command_test.cc", |
| "reboot_ec_command_test.cc", |
| "rgb_keyboard_command_test.cc", |
| "rollback_info_command_test.cc", |
| "rwsig_action_command_test.cc", |
| "set_force_lid_open_command_test.cc", |
| "set_mkbp_wake_mask_command_test.cc", |
| "smart_discharge_command_test.cc", |
| "thermal/get_memmap_temp_b_command_test.cc", |
| "thermal/get_memmap_temp_command_test.cc", |
| "thermal/get_memmap_thermal_version_command_test.cc", |
| "thermal/temp_sensor_get_info_command_test.cc", |
| "thermal/thermal_auto_fan_ctrl_command_test.cc", |
| "versions_command_test.cc", |
| ] |
| configs += [ |
| "//common-mk:test", |
| ":target_defaults_pkg_deps", |
| ] |
| all_dependent_configs = [ ":libec_lib_test_all_dependent_configs" ] |
| run_test = true |
| deps = [ |
| ":libec_static", |
| "//common-mk/testrunner", |
| ] |
| pkg_deps = [ |
| "libchrome-test", |
| "protobuf-lite", |
| ] |
| } |
| } |
| |
| if (use.fuzzer) { |
| executable("libec_ec_panicinfo_fuzzer") { |
| sources = [ "ec_panicinfo_fuzzer.cc" ] |
| configs += [ |
| "//common-mk/common_fuzzer", |
| ":target_defaults_pkg_deps", |
| ] |
| deps = [ ":libec_static" ] |
| } |
| } |
| |
| 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", |
| "libusb-1.0", |
| ] |
| requires_private = default_pkg_deps |
| libs = [ "-lec" ] |
| install = true |
| } |