blob: 2d0902d266d1b57a9a07030ad1e3c6753b21381b [file] [log] [blame]
# Copyright 2022 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/pkg_config.gni")
import("//common-mk/proto_library.gni")
group("all") {
deps = [
":install_init",
":install_policy",
":install_systemd",
":vtpmd",
]
if (use.test) {
deps += [ ":vtpm_test" ]
}
}
pkg_config("target_defaults") {
pkg_deps = [
# This is a list of pkg-config dependencies
"libbrillo",
"libchrome",
"protobuf",
]
}
proto_library("interface_proto") {
proto_in_dir = "."
proto_out_dir = "include/vtpm"
sources = [ "${proto_in_dir}/vtpm_interface.proto" ]
}
proto_library("database_proto") {
proto_in_dir = "./backends"
proto_out_dir = "include/vtpm/backends"
sources = [ "${proto_in_dir}/database.proto" ]
}
generate_dbus_adaptors("vtpm-adaptors") {
sources = [ "dbus_bindings/org.chromium.Vtpm.xml" ]
dbus_adaptors_out_dir = "include/vtpm/dbus_adaptors"
dbus_service_config = "dbus_bindings/dbus-service-config.json"
}
source_set("vtpm_server_library") {
sources = [
"backends/cacheable_blob.cc",
"backends/disk_cache_blob.cc",
"backends/real_tpm_handle_manager.cc",
"backends/vsrk.cc",
"commands/get_capability_command.cc",
"commands/null_command.cc",
"commands/unsupported_command.cc",
"commands/virtualizer.cc",
"vtpm_service.cc",
]
configs += [ ":target_defaults" ]
deps = [
":database_proto",
":interface_proto",
":vtpm-adaptors",
]
}
config("vtpmd_config") {
libs = [ "trunks" ]
}
executable("vtpmd") {
sources = [ "main.cc" ]
configs += [
":target_defaults",
":vtpmd_config",
]
install_path = "sbin"
deps = [
":vtpm-adaptors",
":vtpm_server_library",
]
}
install_config("install_init") {
sources = [ "vtpmd.conf" ]
install_path = "/etc/init"
}
install_config("install_policy") {
_arch = getenv("ARCH")
sources = [ "vtpmd-seccomp-${_arch}.policy" ]
install_path = "/usr/share/policy"
outputs = [ "vtpmd-seccomp.policy" ]
}
install_config("install_systemd") {
sources = [ "org.chromium.Vtpm.conf" ]
install_path = "/etc/dbus-1/system.d"
}
if (use.test) {
config("vtpm_test_config") {
libs = [
"trunks",
"trunks_test",
]
}
executable("vtpm_test") {
sources = [
"backends/cacheable_blob_test.cc",
"backends/disk_cache_blob_test.cc",
"backends/real_tpm_handle_manager_test.cc",
"backends/vsrk_test.cc",
"commands/get_capability_command_test.cc",
"commands/unsupported_command_test.cc",
"commands/virtualizer_test.cc",
"vtpm_service_test.cc",
]
configs += [
"//common-mk:test",
":target_defaults",
":vtpm_test_config",
]
deps = [
":vtpm_server_library",
"//common-mk/testrunner:testrunner",
]
run_test = true
}
}