| # 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/proto_library.gni") |
| |
| group("all") { |
| deps = [ |
| ":libpatchpanel", |
| ":libpatchpanel-client", |
| ":libpatchpanel-util", |
| ":patchpaneld", |
| ] |
| if (use.fuzzer) { |
| deps += [ |
| ":datapath_fuzzer", |
| ":multicast_forwarder_fuzzer", |
| ":ndproxy_fuzzer", |
| ":patchpanel_client_fuzzer", |
| ] |
| } |
| if (use.test) { |
| deps += [ ":patchpanel_testrunner" ] |
| } |
| } |
| |
| pkg_config("target_defaults") { |
| pkg_deps = [ |
| "libbrillo", |
| "libchrome-${libbase_ver}", |
| "libpermission_broker-client", |
| "libshill-client", |
| "libshill-net-${libbase_ver}", |
| "protobuf-lite", |
| "system_api", |
| ] |
| if (use.fuzzer) { |
| pkg_deps += [ "protobuf" ] |
| } else { |
| pkg_deps += [ "protobuf-lite" ] |
| } |
| defines = [ "USE_ARCVM=${use.arcvm}" ] |
| } |
| |
| proto_library("protos") { |
| configs = [ ":target_defaults" ] |
| proto_in_dir = "." |
| proto_out_dir = "include/patchpanel" |
| sources = [ "${proto_in_dir}/ipc.proto" ] |
| } |
| |
| util_sources = [ |
| "address_manager.cc", |
| "mac_address_generator.cc", |
| "net_util.cc", |
| "socket.cc", |
| "socket_forwarder.cc", |
| "subnet.cc", |
| "subnet_pool.cc", |
| ] |
| |
| libpatchpanel_sources = [ |
| "adb_proxy.cc", |
| "arc_service.cc", |
| "broadcast_forwarder.cc", |
| "crostini_service.cc", |
| "datapath.cc", |
| "device.cc", |
| "dns/big_endian.cc", |
| "dns/dns_response.cc", |
| "dns/io_buffer.cc", |
| "helper_process.cc", |
| "manager.cc", |
| "message_dispatcher.cc", |
| "minijailed_process_runner.cc", |
| "multicast_forwarder.cc", |
| "multicast_proxy.cc", |
| "ndproxy.cc", |
| "network_monitor_service.cc", |
| "routing_service.cc", |
| "scoped_ns.cc", |
| "shill_client.cc", |
| ] |
| |
| shared_library("libpatchpanel-util") { |
| sources = util_sources |
| configs += [ ":target_defaults" ] |
| } |
| |
| static_library("libpatchpanel_test") { |
| configs += [ ":target_defaults" ] |
| all_dependent_pkg_deps = [ |
| "protobuf", |
| "system_api", |
| ] |
| sources = libpatchpanel_sources |
| deps = [ ":protos" ] |
| } |
| |
| static_library("libpatchpanel") { |
| configs += [ ":target_defaults" ] |
| all_dependent_pkg_deps = [ |
| "protobuf", |
| "system_api", |
| ] |
| sources = libpatchpanel_sources + util_sources |
| deps = [ ":protos" ] |
| } |
| |
| shared_library("libpatchpanel-client") { |
| configs += [ ":target_defaults" ] |
| all_dependent_pkg_deps = [ |
| "protobuf", |
| "system_api", |
| ] |
| sources = [ "client.cc" ] |
| sources += util_sources |
| } |
| |
| executable("patchpaneld") { |
| sources = [ "main.cc" ] |
| configs += [ ":target_defaults" ] |
| deps = [ ":libpatchpanel" ] |
| } |
| |
| if (use.fuzzer) { |
| pkg_config("fuzzing_config") { |
| pkg_deps = [ "libchrome-test-${libbase_ver}" ] |
| } |
| |
| executable("multicast_forwarder_fuzzer") { |
| configs += [ |
| "//common-mk/common_fuzzer", |
| ":target_defaults", |
| ":fuzzing_config", |
| ] |
| sources = [ "multicast_forwarder_fuzzer.cc" ] |
| deps = [ ":libpatchpanel" ] |
| } |
| |
| executable("ndproxy_fuzzer") { |
| configs += [ |
| "//common-mk/common_fuzzer", |
| ":target_defaults", |
| ":fuzzing_config", |
| ] |
| sources = [ "ndproxy_fuzzer.cc" ] |
| deps = [ ":libpatchpanel" ] |
| } |
| |
| executable("datapath_fuzzer") { |
| configs += [ |
| "//common-mk/common_fuzzer", |
| ":target_defaults", |
| ":fuzzing_config", |
| ] |
| sources = [ "datapath_fuzzer.cc" ] |
| deps = [ ":libpatchpanel" ] |
| } |
| |
| executable("patchpanel_client_fuzzer") { |
| configs += [ |
| "//common-mk/common_fuzzer", |
| ":target_defaults", |
| ":fuzzing_config", |
| ] |
| sources = [ "client_fuzzer.cc" ] |
| deps = [ |
| ":libpatchpanel", |
| ":libpatchpanel-client", |
| ] |
| } |
| } |
| |
| if (use.test) { |
| pkg_config("test_config") { |
| pkg_deps = [ "libchrome-test-${libbase_ver}" ] |
| } |
| |
| executable("patchpanel_testrunner") { |
| sources = [ |
| "address_manager_test.cc", |
| "arc_service_test.cc", |
| "client_test.cc", |
| "datapath_test.cc", |
| "mac_address_generator_test.cc", |
| "minijailed_process_runner_test.cc", |
| "ndproxy_test.cc", |
| "net_util_test.cc", |
| "network_monitor_service_test.cc", |
| "routing_service_test.cc", |
| "shill_client_test.cc", |
| "subnet_pool_test.cc", |
| "subnet_test.cc", |
| ] |
| configs += [ |
| "//common-mk:test", |
| ":target_defaults", |
| ":test_config", |
| ] |
| defines = [ "UNIT_TEST" ] |
| deps = [ |
| ":libpatchpanel-client", |
| ":libpatchpanel_test", |
| "//common-mk/testrunner", |
| ] |
| } |
| } |