blob: 06bf96e1f37a8d953d93590a412124cd1fb5deff [file] [log] [blame]
# Copyright 2021 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/generate-dbus-adaptors.gni")
import("//common-mk/pkg_config.gni")
import("//common-mk/proto_library.gni")
group("all") {
deps = [
":featured",
":libc_fake_feature_library",
":libfake_platform_features",
":libfeatures",
":libfeatures_c",
":libstore_impl",
]
if (use.test) {
deps += [
":c_fake_feature_check_example",
":c_feature_check_example",
":cpp_feature_check_example",
":feature_library_test",
":service_test",
":store_impl_test",
]
}
if (use.fuzzer) {
deps += [ ":featured_json_feature_parser_fuzzer" ]
}
}
pkg_config("target_defaults") {
# NOSORT
pkg_deps = [
"dbus-1",
"libbrillo",
"libchrome",
"libsession_manager-client",
"openssl",
# system_api depends on protobuf (or protobuf-lite). It must appear
# before protobuf here or the linker flags won't be in the right
# order.
"system_api",
"protobuf",
]
}
generate_dbus_adaptors("featured-adaptors") {
dbus_service_config = "dbus_bindings/dbus-service-config.json"
dbus_adaptors_out_dir = "include/featured/dbus_adaptors"
sources = [ "dbus_bindings/org.chromium.featured.xml" ]
}
static_library("libfeatured") {
sources = [ "service.cc" ]
configs += [ ":target_defaults" ]
deps = [
":featured-adaptors",
":libfeatures",
":libstore_impl",
":libtmp_storage_impl",
]
}
executable("featured") {
sources = [ "main.cc" ]
configs += [ ":target_defaults" ]
deps = [
":featured-adaptors",
":libfeatured",
]
}
shared_library("libfeatures") {
sources = [ "feature_library.cc" ]
configs += [ ":target_defaults" ]
}
shared_library("libfeatures_c") {
sources = [ "c_feature_library.cc" ]
configs += [ ":target_defaults" ]
deps = [ ":libfeatures" ]
}
# TODO(b/242920490): Only build fake libraries if use.test is set.
shared_library("libfake_platform_features") {
sources = [ "fake_platform_features.cc" ]
configs += [ ":target_defaults" ]
}
shared_library("libc_fake_feature_library") {
sources = [ "c_fake_feature_library.cc" ]
configs += [ ":target_defaults" ]
deps = [ ":libfake_platform_features" ]
}
static_library("libstore_impl") {
sources = [ "store_impl.cc" ]
configs += [ ":target_defaults" ]
libs = [ "hwsec-foundation" ]
}
static_library("libtmp_storage_impl") {
sources = [ "tmp_storage_impl.cc" ]
configs += [ ":target_defaults" ]
}
if (use.test) {
pkg_config("test_helper_config") {
# NOSORT
pkg_deps = [
"libbrillo",
"libbrillo-test",
"libchrome",
"libchrome-test",
# system_api depends on protobuf (or protobuf-lite). It must appear
# before protobuf here or the linker flags won't be in the right
# order.
"system_api",
"protobuf",
]
}
executable("feature_library_test") {
sources = [ "feature_library_test.cc" ]
configs += [
"//common-mk:test",
":test_helper_config",
]
deps = [
":libfeatured",
":libfeatures",
"//common-mk/testrunner:testrunner",
]
}
executable("service_test") {
sources = [ "service_test.cc" ]
configs += [
"//common-mk:test",
":test_helper_config",
":target_defaults",
]
deps = [
":libfeatured",
"//common-mk/testrunner:testrunner",
]
}
executable("store_impl_test") {
sources = [ "store_impl_test.cc" ]
configs += [
"//common-mk:test",
":test_helper_config",
":target_defaults",
]
libs = [ "hwsec-foundation" ]
deps = [
":libstore_impl",
"//common-mk/testrunner:testrunner",
]
}
executable("c_feature_check_example") {
sources = [ "c_feature_check_example.c" ]
deps = [ ":libfeatures_c" ]
}
executable("c_fake_feature_check_example") {
sources = [ "c_fake_feature_check_example.c" ]
deps = [
":libc_fake_feature_library",
":libfeatures_c",
]
}
executable("cpp_feature_check_example") {
sources = [ "cpp_feature_check_example.cc" ]
configs += [ ":test_helper_config" ]
deps = [ ":libfeatures" ]
}
}
if (use.fuzzer) {
executable("featured_json_feature_parser_fuzzer") {
sources = [ "json_feature_parser_fuzzer.cc" ]
configs += [
"//common-mk/common_fuzzer",
":target_defaults",
]
deps = [ ":libfeatured" ]
}
}