blob: 883a3676ba96f7c1a21868c72551b2b7f8088899 [file] [log] [blame]
# Copyright 2024 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/generate-dbus-proxies.gni")
import("//common-mk/pkg_config.gni")
generate_dbus_adaptors("dbus-adaptors") {
dbus_service_config = "../dbus_bindings/cicerone-dbus-service-config.json"
dbus_adaptors_out_dir = "include/vm_tools/cicerone/dbus_adaptors"
sources = [ "../dbus_bindings/org.chromium.VmCicerone.xml" ]
}
generate_dbus_proxies("cicerone-proxies") {
dbus_service_config = "../dbus_bindings/cicerone-dbus-service-config.json"
proxy_output_file = "include/vm_tools/cicerone/dbus-proxies.h"
mock_output_file = "include/vm_tools/cicerone/dbus-proxy-mocks.h"
proxy_path_in_mocks = "vm_tools/cicerone/dbus-proxies.h"
sources = [ "../dbus_bindings/org.chromium.VmCicerone.xml" ]
}
generate_pkg_config("libcicerone-client.pc") {
name = "libcicerone-client"
version = getenv("PV")
description = "Cicerone client interface library"
cflags = [ "-I/usr/include/vm_tools/cicerone-client" ]
install = true
}
generate_pkg_config("libcicerone-client-test.pc") {
name = "libcicerone-client-test"
version = getenv("PV")
description = "Cicerone client interface mock library"
cflags = [ "-I/usr/include/vm_tools/cicerone-client-test" ]
install = true
}
static_library("libcicerone") {
sources = [
"container.cc",
"container_listener_impl.cc",
"crash_listener_impl.cc",
"grpc_util.cc",
"guest_metrics.cc",
"service.cc",
"shadercached_helper.cc",
"shill_client.cc",
"tremplin_listener_impl.cc",
"virtual_machine.cc",
]
configs += [ "//vm_tools/host:host_target_defaults" ]
libs = [ "grpc" ]
all_dependent_pkg_deps = [
"grpc++",
"libmetrics",
"libshill-client",
"protobuf",
"re2",
"system_api",
"vm_protos",
]
deps = [
":cicerone-proxies",
":dbus-adaptors",
":libcicerone-client-test.pc",
":libcicerone-client.pc",
]
}
executable("vm_cicerone") {
sources = [ "main.cc" ]
configs += [ "//vm_tools/host:host_target_defaults" ]
deps = [ ":libcicerone" ]
}
executable("cicerone_client") {
sources = [ "client.cc" ]
configs += [ "//vm_tools/host:host_target_defaults" ]
pkg_deps = [
"protobuf",
"system_api",
]
}
if (use.test || use.fuzzer) {
static_library("service_testing_helper_lib") {
sources = [
"dbus_message_testing_helper.cc",
"dbus_message_testing_helper.h",
"mock_tremplin_stub.h",
"service_testing_helper.cc",
"service_testing_helper.h",
]
configs += [ "//vm_tools/host:host_target_defaults" ]
all_dependent_pkg_deps = [ "libchrome-test" ]
deps = [ ":libcicerone" ]
}
}
if (use.test) {
executable("cicerone_test") {
sources = [
"container_listener_impl_test.cc",
"crash_listener_impl_test.cc",
"tremplin_listener_impl_test.cc",
"virtual_machine_test.cc",
]
configs += [
"//common-mk:test",
"//vm_tools/host:host_target_defaults",
]
deps = [
":libcicerone",
":service_testing_helper_lib",
"//common-mk/testrunner:testrunner",
]
}
}
if (use.fuzzer) {
executable("cicerone_container_listener_fuzzer") {
sources = [ "container_listener_impl_fuzzer.cc" ]
# //common-mk:test should be on the top.
# TODO(crbug.com/887845): Remove this comment after library ordering issue is fixed.
configs += [
"//common-mk:test",
"//common-mk/common_fuzzer:common_fuzzer",
"//vm_tools/host:vm_host_tools_fuzzer_pkg_deps",
]
pkg_deps = [
"grpc++",
"libchrome-test", # For FuzzedDataProvider
]
deps = [
":libcicerone",
":service_testing_helper_lib",
]
}
}