blob: 12e7b804cae76a65581e844e901718bc4761e960 [file] [log] [blame]
Keigo Okacedea622018-09-03 20:08:05 +09001# Copyright 2018 The Chromium OS Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import("//common-mk/pkg_config.gni")
6import("//common-mk/proto_library.gni")
7
8group("all") {
9 deps = [
10 ":arc-networkd",
Garrick Evans428e4762018-12-11 15:18:42 +090011 ":libarcnetwork",
Garrick Evans4b66f632019-01-24 15:09:16 +090012 ":libarcnetwork-util",
Garrick Evans08843932019-09-17 14:41:08 +090013 ":libpatchpanel-client",
Keigo Okacedea622018-09-03 20:08:05 +090014 ]
Hugo Benichi1661ca02019-10-16 15:36:13 +090015 if (use.fuzzer) {
Taoyu Li906553a2019-10-18 13:44:41 +090016 deps += [
Hugo Benichib9b93fe2019-10-25 23:36:01 +090017 ":datapath_fuzzer",
Taoyu Li906553a2019-10-18 13:44:41 +090018 ":multicast_forwarder_fuzzer",
19 ":ndproxy_fuzzer",
20 ]
Hugo Benichi1661ca02019-10-16 15:36:13 +090021 }
Garrick Evans428e4762018-12-11 15:18:42 +090022 if (use.test) {
Garrick Evans4b66f632019-01-24 15:09:16 +090023 deps += [ ":arc_network_testrunner" ]
Garrick Evans428e4762018-12-11 15:18:42 +090024 }
Keigo Okacedea622018-09-03 20:08:05 +090025}
26
27pkg_config("target_defaults") {
28 pkg_deps = [
hscham190698a2020-01-17 12:06:33 +090029 "libbrillo",
Keigo Okacedea622018-09-03 20:08:05 +090030 "libchrome-${libbase_ver}",
Jason Jeremy Imanfa8b6d22020-02-20 03:44:21 +000031 "libpermission_broker-client",
Keigo Okacedea622018-09-03 20:08:05 +090032 "libshill-client",
Garrick Evanscf036f32018-12-21 12:56:59 +090033 "libshill-net-${libbase_ver}",
Garrick Evans08843932019-09-17 14:41:08 +090034 "protobuf-lite",
35 "system_api",
Keigo Okacedea622018-09-03 20:08:05 +090036 ]
Allen Webb33a2f802019-10-24 16:03:17 -070037 if (use.fuzzer) {
38 pkg_deps += [ "protobuf" ]
39 } else {
40 pkg_deps += [ "protobuf-lite" ]
41 }
Keigo Okacedea622018-09-03 20:08:05 +090042}
43
44proto_library("protos") {
45 configs = [ ":target_defaults" ]
46 proto_in_dir = "."
Garrick Evans3388a032020-03-24 11:25:55 +090047 proto_out_dir = "include/patchpanel"
Keigo Okacedea622018-09-03 20:08:05 +090048 sources = [
49 "${proto_in_dir}/ipc.proto",
50 ]
51}
52
Garrick Evans4b66f632019-01-24 15:09:16 +090053util_sources = [
Garrick Evans0dbd4182019-03-07 08:38:38 +090054 "address_manager.cc",
Garrick Evans4b66f632019-01-24 15:09:16 +090055 "mac_address_generator.cc",
Hugo Benichi2ac4d072019-05-28 14:51:23 +090056 "net_util.cc",
Garrick Evans1cce71a2019-06-21 10:43:14 +090057 "socket.cc",
Andreea Costinas74f45d22020-03-13 10:29:31 +010058 "socket_forwarder.cc",
Garrick Evans4b66f632019-01-24 15:09:16 +090059 "subnet.cc",
60 "subnet_pool.cc",
61]
62
63shared_library("libarcnetwork-util") {
Garrick Evans4b66f632019-01-24 15:09:16 +090064 sources = util_sources
Ayato Tokubidef23f12019-10-02 12:21:53 +090065 configs += [ ":target_defaults" ]
Garrick Evans4b66f632019-01-24 15:09:16 +090066}
67
Garrick Evans428e4762018-12-11 15:18:42 +090068static_library("libarcnetwork") {
Garrick Evans08843932019-09-17 14:41:08 +090069 configs += [ ":target_defaults" ]
70 all_dependent_pkg_deps = [
71 "protobuf",
72 "system_api",
73 ]
Keigo Okacedea622018-09-03 20:08:05 +090074 sources = [
Garrick Evans3cbac7c2019-04-18 15:31:31 +090075 "adb_proxy.cc",
Garrick Evansf29f5a32019-12-06 11:34:25 +090076 "arc_service.cc",
Jason Jeremy Iman16f91722020-01-14 09:53:28 +090077 "broadcast_forwarder.cc",
Garrick Evansf29f5a32019-12-06 11:34:25 +090078 "crostini_service.cc",
Garrick Evansf0ab7132019-06-18 14:50:42 +090079 "datapath.cc",
Garrick Evans49879532018-12-03 13:15:36 +090080 "device.cc",
Keigo Okacedea622018-09-03 20:08:05 +090081 "dns/big_endian.cc",
82 "dns/dns_response.cc",
83 "dns/io_buffer.cc",
84 "helper_process.cc",
Keigo Okacedea622018-09-03 20:08:05 +090085 "manager.cc",
Garrick Evans96e03042019-05-28 14:30:52 +090086 "message_dispatcher.cc",
Garrick Evans64a2df32018-12-12 16:53:46 +090087 "minijailed_process_runner.cc",
Keigo Okacedea622018-09-03 20:08:05 +090088 "multicast_forwarder.cc",
Jason Jeremy Iman429b0792020-03-13 15:34:16 +090089 "multicast_proxy.cc",
Taoyu Liaa6238b2019-09-06 17:38:52 +090090 "ndproxy.cc",
Hugo Benichi7d9d8db2020-03-30 15:56:56 +090091 "routing_service.cc",
Douglas Andersondf538282019-02-07 17:42:54 +000092 "scoped_ns.cc",
Garrick Evans4b66f632019-01-24 15:09:16 +090093 "shill_client.cc",
Keigo Okacedea622018-09-03 20:08:05 +090094 ]
Garrick Evans4b66f632019-01-24 15:09:16 +090095 sources += util_sources
Keigo Okacedea622018-09-03 20:08:05 +090096 deps = [
97 ":protos",
98 ]
Garrick Evans428e4762018-12-11 15:18:42 +090099}
100
Garrick Evans08843932019-09-17 14:41:08 +0900101shared_library("libpatchpanel-client") {
102 configs += [ ":target_defaults" ]
103 all_dependent_pkg_deps = [
104 "protobuf",
105 "system_api",
106 ]
107 sources = [
108 "client.cc",
109 ]
Hugo Benichicc6850f2020-01-17 13:26:06 +0900110 sources += util_sources
Garrick Evans08843932019-09-17 14:41:08 +0900111}
112
Garrick Evans428e4762018-12-11 15:18:42 +0900113executable("arc-networkd") {
Garrick Evans428e4762018-12-11 15:18:42 +0900114 sources = [
115 "main.cc",
116 ]
Ayato Tokubidef23f12019-10-02 12:21:53 +0900117 configs += [ ":target_defaults" ]
Garrick Evans428e4762018-12-11 15:18:42 +0900118 deps = [
119 ":libarcnetwork",
120 ]
121}
122
Hugo Benichi1661ca02019-10-16 15:36:13 +0900123if (use.fuzzer) {
124 pkg_config("fuzzing_config") {
125 pkg_deps = [ "libchrome-test-${libbase_ver}" ]
126 }
127
128 executable("multicast_forwarder_fuzzer") {
129 configs += [
130 "//common-mk/common_fuzzer",
131 ":target_defaults",
132 ":fuzzing_config",
133 ]
134 sources = [
135 "multicast_forwarder_fuzzer.cc",
136 ]
137 deps = [
138 ":libarcnetwork",
139 ]
140 }
Taoyu Li906553a2019-10-18 13:44:41 +0900141
142 executable("ndproxy_fuzzer") {
143 configs += [
144 "//common-mk/common_fuzzer",
145 ":target_defaults",
146 ":fuzzing_config",
147 ]
148 sources = [
149 "ndproxy_fuzzer.cc",
150 ]
151 deps = [
152 ":libarcnetwork",
153 ]
154 }
Hugo Benichib9b93fe2019-10-25 23:36:01 +0900155
156 executable("datapath_fuzzer") {
157 configs += [
158 "//common-mk/common_fuzzer",
159 ":target_defaults",
160 ":fuzzing_config",
161 ]
162 sources = [
163 "datapath_fuzzer.cc",
164 ]
165 deps = [
166 ":libarcnetwork",
167 ]
168 }
Hugo Benichi1661ca02019-10-16 15:36:13 +0900169}
170
Garrick Evans428e4762018-12-11 15:18:42 +0900171if (use.test) {
172 pkg_config("test_config") {
Garrick Evans4b66f632019-01-24 15:09:16 +0900173 pkg_deps = [ "libchrome-test-${libbase_ver}" ]
Garrick Evans428e4762018-12-11 15:18:42 +0900174 }
175
176 executable("arc_network_testrunner") {
Garrick Evans428e4762018-12-11 15:18:42 +0900177 sources = [
Garrick Evans0dbd4182019-03-07 08:38:38 +0900178 "address_manager_test.cc",
Garrick Evans54861622019-07-19 09:05:09 +0900179 "arc_service_test.cc",
Hugo Benichicc6850f2020-01-17 13:26:06 +0900180 "client_test.cc",
Garrick Evansf0ab7132019-06-18 14:50:42 +0900181 "datapath_test.cc",
Garrick Evans4b66f632019-01-24 15:09:16 +0900182 "mac_address_generator_test.cc",
Garrick Evans64a2df32018-12-12 16:53:46 +0900183 "minijailed_process_runner_test.cc",
Taoyu Liaa6238b2019-09-06 17:38:52 +0900184 "ndproxy_test.cc",
Hugo Benichi2ac4d072019-05-28 14:51:23 +0900185 "net_util_test.cc",
Hugo Benichi7d9d8db2020-03-30 15:56:56 +0900186 "routing_service_test.cc",
Garrick Evansf2e11f02018-12-25 15:25:39 +0900187 "shill_client_test.cc",
Garrick Evans4b66f632019-01-24 15:09:16 +0900188 "subnet_pool_test.cc",
189 "subnet_test.cc",
Garrick Evans428e4762018-12-11 15:18:42 +0900190 ]
Ayato Tokubidef23f12019-10-02 12:21:53 +0900191 configs += [
192 "//common-mk:test",
193 ":target_defaults",
194 ":test_config",
195 ]
Garrick Evans428e4762018-12-11 15:18:42 +0900196 defines = [ "UNIT_TEST" ]
197 deps = [
Douglas Andersondf538282019-02-07 17:42:54 +0000198 ":libarcnetwork",
Hugo Benichicc6850f2020-01-17 13:26:06 +0900199 ":libpatchpanel-client",
Garrick Evans4b66f632019-01-24 15:09:16 +0900200 "//common-mk/testrunner",
Garrick Evans428e4762018-12-11 15:18:42 +0900201 ]
202 }
203}