blob: ce1436df19b8aced36d9af9448d68ceba919805e [file] [log] [blame]
# Copyright 2019 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/generate-dbus-adaptors.gni")
import("//common-mk/generate-dbus-proxies.gni")
import("//common-mk/pkg_config.gni")
import("//common-mk/proto_library.gni")
group("all") {
deps = [
":install_dbus_config",
":install_init_config",
":modemfwd",
]
if (use.test) {
deps += [ ":modemfw_test" ]
}
if (use.fuzzer) {
deps += [ ":firmware_manifest_v2_fuzzer" ]
}
}
pkg_config("target_defaults") {
# NOSORT
pkg_deps = [
"libchrome",
"libbrillo",
"libcros_config",
"libdlcservice-client",
"libmetrics",
"libshill-client",
"liblzma",
"ModemManager",
# system_api depends on protobuf. It must appear before protobuf
# here or the linker flags won't be in the right order.
"system_api",
"protobuf",
]
}
generate_dbus_proxies("modemmanager_proxies") {
modemmanager_in_dir = "${sysroot}/usr/share/dbus-1/interfaces/"
proxy_output_file = "include/modemmanager/dbus-proxies.h"
sources = [
"${modemmanager_in_dir}/org.freedesktop.ModemManager1.Modem.xml",
"${modemmanager_in_dir}/org.freedesktop.ModemManager1.xml",
]
}
generate_dbus_adaptors("modemfwd_adaptors") {
dbus_service_config = "dbus_bindings/dbus-service-config.json"
dbus_adaptors_out_dir = "include/modemfwd/dbus_adaptors"
sources = [ "dbus_bindings/org.chromium.Modemfwd.xml" ]
}
static_library("libmodemfw") {
sources = [
"dlc_manager.cc",
"error.cc",
"file_decompressor.cc",
"firmware_directory.cc",
"firmware_file.cc",
"firmware_manifest_v2.cc",
"journal.cc",
"logging.cc",
"metrics.cc",
"modem.cc",
"modem_flasher.cc",
"modem_helper.cc",
"modem_helper_directory.cc",
"modem_tracker.cc",
"notification_manager.cc",
"scoped_temp_file.cc",
]
configs += [ ":target_defaults" ]
deps = [
":modemmanager_proxies",
"//modemfwd//proto:modemfw-protos",
]
}
executable("modemfwd") {
sources = [
"daemon.cc",
"main.cc",
]
configs += [ ":target_defaults" ]
install_path = "bin"
deps = [
":libmodemfw",
":modemfwd_adaptors",
]
}
install_config("install_init_config") {
sources = [ "modemfwd.conf" ]
install_path = "/etc/init"
}
install_config("install_dbus_config") {
sources = [ "dbus/org.chromium.Modemfwd.conf" ]
install_path = "/etc/dbus-1/system.d"
}
if (use.test) {
executable("modemfw_test") {
sources = [
"dlc_manager_test.cc",
"error_test.cc",
"file_decompressor_test.cc",
"firmware_directory_stub.cc",
"firmware_directory_test.cc",
"firmware_file_test.cc",
"journal_test.cc",
"metrics_test.cc",
"modem_flasher_test.cc",
]
configs += [
":target_defaults",
"//common-mk:test",
]
run_test = true
pkg_deps = [
"libchrome-test",
"libdlcservice-client-test",
]
deps = [
":libmodemfw",
"//common-mk/testrunner:testrunner",
]
}
}
if (use.fuzzer) {
executable("firmware_manifest_v2_fuzzer") {
sources = [ "firmware_manifest_v2_fuzzer.cc" ]
configs += [
"//common-mk/common_fuzzer",
":target_defaults",
]
pkg_deps = [ "libprotobuf-mutator" ]
deps = [ ":libmodemfw" ]
}
}