blob: c25618e91e42f393e9b660f7c6a925b2becca5f0 [file] [log] [blame]
# Copyright 2018 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/pkg_config.gni")
import("//common-mk/xml2cpp.gni")
group("all") {
deps = [
":cromo",
":libcromo",
]
if (use.test) {
deps += [
":cromo_server_test",
":dummy_modem",
":sms_cache_test",
":sms_message_test",
":utilities_test",
]
}
}
genxml2cpp("cromo-adaptors") {
xml2cpp_type = "adaptor"
xml2cpp_in_dir = "local-xml"
xml2cpp_out_dir = "include/cromo/dbus_adaptors"
sources = [
"${xml2cpp_in_dir}/org.freedesktop.DBus.Properties.xml",
]
}
pkg_config("default_config") {
pkg_deps = [
"dbus-c++-1",
"gthread-2.0",
"gobject-2.0",
"libbrillo-${libbase_ver}",
"libchrome-${libbase_ver}",
"libmetrics-${libbase_ver}",
"libminijail",
]
libs = [ "dl" ]
}
static_library("libcromo") {
deps = [
":cromo-adaptors",
"//common-mk/external_dependencies:modemmanager-dbus-adaptors",
]
sources = [
"cromo_server.cc",
"hooktable.cc",
"modem_handler.cc",
"sms_cache.cc",
"sms_message.cc",
"syslog_helper.cc",
"utilities.cc",
]
configs += [
":default_config",
"//common-mk:nouse_thin_archive",
]
configs -= [
# cromo uses try/catch to interact with dbus-c++.
"//common-mk:no_exceptions",
"//common-mk:use_thin_archive",
]
}
# cromo needs to export symbols, as specified in cromo.ver, to its
# plugins. gn currently does not link a static library with
# --whole-archive, which causes some unused symbols in libcromo.a get
# removed. As a workaround, the 'cromo' target explicitly takes the
# dependencies and sources from the 'libcromo' target, instead of
# depending on 'libcromo'.
config("default_visibility") {
cflags = [ "-fvisibility=default" ]
}
executable("cromo") {
configs += [
":default_config",
":default_visibility",
]
configs -= [ "//common-mk:no_exceptions" ]
deps = [
":cromo-adaptors",
"//common-mk/external_dependencies:modemmanager-dbus-adaptors",
]
defines = [ "PLUGINDIR=\"$libdir/cromo/plugins\"" ]
ldflags = [ "-Wl,--dynamic-list-cpp-typeinfo,--dynamic-list=${platform2_root}/cromo/cromo.ver" ]
libs = [ "pthread" ]
sources = [
"carrier.cc",
"cromo_server.cc",
"hooktable.cc",
"main.cc",
"modem_handler.cc",
"plugin_manager.cc",
"sandbox.cc",
"sms_cache.cc",
"sms_message.cc",
"syslog_helper.cc",
"utilities.cc",
]
}
if (use.test) {
shared_library("dummy_modem") {
configs += [ ":default_config" ]
configs -= [ "//common-mk:no_exceptions" ]
deps = [
"//common-mk/external_dependencies:modemmanager-dbus-adaptors",
]
sources = [
"dummy_modem.cc",
"dummy_modem_handler.cc",
]
}
executable("cromo_server_test") {
configs += [
"//common-mk:test",
":default_config",
]
configs -= [ "//common-mk:no_exceptions" ]
deps = [
":libcromo",
"//common-mk/testrunner",
]
sources = [
"carrier.cc",
"cromo_server_test.cc",
]
}
executable("utilities_test") {
configs += [
"//common-mk:test",
":default_config",
]
configs -= [ "//common-mk:no_exceptions" ]
deps = [
":libcromo",
"//common-mk/testrunner",
]
sources = [
"utilities_test.cc",
]
}
executable("sms_message_test") {
configs += [
"//common-mk:test",
":default_config",
]
configs -= [ "//common-mk:no_exceptions" ]
deps = [
":libcromo",
"//common-mk/testrunner",
]
sources = [
"sms_message_test.cc",
]
}
executable("sms_cache_test") {
configs += [
"//common-mk:test",
":default_config",
]
configs -= [ "//common-mk:no_exceptions" ]
deps = [
":libcromo",
"//common-mk/testrunner",
]
sources = [
"sms_cache_test.cc",
]
}
}