blob: e9d5efbcbd8d3668f03b0d4355a60e74bfb1426c [file] [log] [blame] [edit]
# Copyright 2020 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-proxies.gni")
import("//common-mk/pkg_config.gni")
import("//common-mk/proto_library.gni")
group("all") {
deps = [ ":libpatchpanel-client" ]
if (use.fuzzer) {
deps += [ ":patchpanel_client_fuzzer" ]
}
if (use.test) {
deps += [ ":patchpanel-client_testrunner" ]
}
}
pkg_config("target_defaults") {
cflags = [ "-Wconversion" ]
pkg_deps = [
"libbrillo",
"libchrome",
"libnet-base",
"system_api",
]
}
# Generate the D-Bus C++ binding.
generate_dbus_proxies("patchpanel_dbus_proxies") {
sources = [ "../dbus_bindings/org.chromium.patchpanel.xml" ]
proxy_output_file = "include/patchpanel/dbus-proxies.h"
dbus_service_config = "../dbus_bindings/dbus-service-config.json"
}
shared_library("libpatchpanel-client") {
sources = [
"../net_util.cc",
"client.cc",
"fake_client.cc",
]
configs += [ ":target_defaults" ]
if (use.fuzzer) {
all_dependent_pkg_deps = [ "protobuf" ]
} else {
all_dependent_pkg_deps = [ "protobuf-lite" ]
}
libs = [ "system_api" ]
deps = [ ":patchpanel_dbus_proxies" ]
}
if (use.fuzzer || use.test) {
source_set("patchpanel_client_test_support") {
sources = [ "mock_patchpanel_proxy.cc" ]
configs += [
"//common-mk:test",
":target_defaults",
]
deps = [ ":libpatchpanel-client" ]
}
}
if (use.fuzzer) {
pkg_config("fuzzing_config") {
pkg_deps = [ "libchrome-test" ]
}
executable("patchpanel_client_fuzzer") {
sources = [ "client_fuzzer.cc" ]
configs += [
"//common-mk/common_fuzzer",
":target_defaults",
":fuzzing_config",
]
deps = [
":libpatchpanel-client",
":patchpanel_client_test_support",
]
}
}
if (use.test) {
pkg_config("test_config") {
pkg_deps = [ "libchrome-test" ]
}
executable("patchpanel-client_testrunner") {
sources = [ "client_test.cc" ]
configs += [
"//common-mk:test",
":target_defaults",
":test_config",
]
defines = [ "UNIT_TEST" ]
deps = [
":libpatchpanel-client",
":patchpanel_client_test_support",
"//common-mk/testrunner",
]
}
}