blob: 9db29b675282a5351f9119b70a28a539b3b0ee59 [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
Manoj Guptab7553862020-04-23 15:02:41 -070063libarcnetwork_sources = [
64 "adb_proxy.cc",
65 "arc_service.cc",
66 "broadcast_forwarder.cc",
67 "crostini_service.cc",
68 "datapath.cc",
69 "device.cc",
70 "dns/big_endian.cc",
71 "dns/dns_response.cc",
72 "dns/io_buffer.cc",
73 "helper_process.cc",
74 "manager.cc",
75 "message_dispatcher.cc",
76 "minijailed_process_runner.cc",
77 "multicast_forwarder.cc",
78 "multicast_proxy.cc",
79 "ndproxy.cc",
80 "routing_service.cc",
81 "scoped_ns.cc",
82 "shill_client.cc",
83]
84
Garrick Evans4b66f632019-01-24 15:09:16 +090085shared_library("libarcnetwork-util") {
Garrick Evans4b66f632019-01-24 15:09:16 +090086 sources = util_sources
Ayato Tokubidef23f12019-10-02 12:21:53 +090087 configs += [ ":target_defaults" ]
Garrick Evans4b66f632019-01-24 15:09:16 +090088}
89
Manoj Guptab7553862020-04-23 15:02:41 -070090static_library("libarcnetwork_test") {
91 configs += [ ":target_defaults" ]
92 all_dependent_pkg_deps = [
93 "protobuf",
94 "system_api",
95 ]
96 sources = libarcnetwork_sources
97 deps = [
98 ":protos",
99 ]
100}
101
Garrick Evans428e4762018-12-11 15:18:42 +0900102static_library("libarcnetwork") {
Garrick Evans08843932019-09-17 14:41:08 +0900103 configs += [ ":target_defaults" ]
104 all_dependent_pkg_deps = [
105 "protobuf",
106 "system_api",
107 ]
Manoj Guptab7553862020-04-23 15:02:41 -0700108 sources = libarcnetwork_sources + util_sources
Keigo Okacedea622018-09-03 20:08:05 +0900109 deps = [
110 ":protos",
111 ]
Garrick Evans428e4762018-12-11 15:18:42 +0900112}
113
Garrick Evans08843932019-09-17 14:41:08 +0900114shared_library("libpatchpanel-client") {
115 configs += [ ":target_defaults" ]
116 all_dependent_pkg_deps = [
117 "protobuf",
118 "system_api",
119 ]
120 sources = [
121 "client.cc",
122 ]
Hugo Benichicc6850f2020-01-17 13:26:06 +0900123 sources += util_sources
Garrick Evans08843932019-09-17 14:41:08 +0900124}
125
Garrick Evans428e4762018-12-11 15:18:42 +0900126executable("arc-networkd") {
Garrick Evans428e4762018-12-11 15:18:42 +0900127 sources = [
128 "main.cc",
129 ]
Ayato Tokubidef23f12019-10-02 12:21:53 +0900130 configs += [ ":target_defaults" ]
Garrick Evans428e4762018-12-11 15:18:42 +0900131 deps = [
132 ":libarcnetwork",
133 ]
134}
135
Hugo Benichi1661ca02019-10-16 15:36:13 +0900136if (use.fuzzer) {
137 pkg_config("fuzzing_config") {
138 pkg_deps = [ "libchrome-test-${libbase_ver}" ]
139 }
140
141 executable("multicast_forwarder_fuzzer") {
142 configs += [
143 "//common-mk/common_fuzzer",
144 ":target_defaults",
145 ":fuzzing_config",
146 ]
147 sources = [
148 "multicast_forwarder_fuzzer.cc",
149 ]
150 deps = [
151 ":libarcnetwork",
152 ]
153 }
Taoyu Li906553a2019-10-18 13:44:41 +0900154
155 executable("ndproxy_fuzzer") {
156 configs += [
157 "//common-mk/common_fuzzer",
158 ":target_defaults",
159 ":fuzzing_config",
160 ]
161 sources = [
162 "ndproxy_fuzzer.cc",
163 ]
164 deps = [
165 ":libarcnetwork",
166 ]
167 }
Hugo Benichib9b93fe2019-10-25 23:36:01 +0900168
169 executable("datapath_fuzzer") {
170 configs += [
171 "//common-mk/common_fuzzer",
172 ":target_defaults",
173 ":fuzzing_config",
174 ]
175 sources = [
176 "datapath_fuzzer.cc",
177 ]
178 deps = [
179 ":libarcnetwork",
180 ]
181 }
Hugo Benichi1661ca02019-10-16 15:36:13 +0900182}
183
Garrick Evans428e4762018-12-11 15:18:42 +0900184if (use.test) {
185 pkg_config("test_config") {
Garrick Evans4b66f632019-01-24 15:09:16 +0900186 pkg_deps = [ "libchrome-test-${libbase_ver}" ]
Garrick Evans428e4762018-12-11 15:18:42 +0900187 }
188
189 executable("arc_network_testrunner") {
Garrick Evans428e4762018-12-11 15:18:42 +0900190 sources = [
Garrick Evans0dbd4182019-03-07 08:38:38 +0900191 "address_manager_test.cc",
Garrick Evans54861622019-07-19 09:05:09 +0900192 "arc_service_test.cc",
Hugo Benichicc6850f2020-01-17 13:26:06 +0900193 "client_test.cc",
Garrick Evansf0ab7132019-06-18 14:50:42 +0900194 "datapath_test.cc",
Garrick Evans4b66f632019-01-24 15:09:16 +0900195 "mac_address_generator_test.cc",
Garrick Evans64a2df32018-12-12 16:53:46 +0900196 "minijailed_process_runner_test.cc",
Taoyu Liaa6238b2019-09-06 17:38:52 +0900197 "ndproxy_test.cc",
Hugo Benichi2ac4d072019-05-28 14:51:23 +0900198 "net_util_test.cc",
Hugo Benichi7d9d8db2020-03-30 15:56:56 +0900199 "routing_service_test.cc",
Garrick Evansf2e11f02018-12-25 15:25:39 +0900200 "shill_client_test.cc",
Garrick Evans4b66f632019-01-24 15:09:16 +0900201 "subnet_pool_test.cc",
202 "subnet_test.cc",
Garrick Evans428e4762018-12-11 15:18:42 +0900203 ]
Ayato Tokubidef23f12019-10-02 12:21:53 +0900204 configs += [
205 "//common-mk:test",
206 ":target_defaults",
207 ":test_config",
208 ]
Garrick Evans428e4762018-12-11 15:18:42 +0900209 defines = [ "UNIT_TEST" ]
210 deps = [
Manoj Guptab7553862020-04-23 15:02:41 -0700211 ":libarcnetwork_test",
Hugo Benichicc6850f2020-01-17 13:26:06 +0900212 ":libpatchpanel-client",
Garrick Evans4b66f632019-01-24 15:09:16 +0900213 "//common-mk/testrunner",
Garrick Evans428e4762018-12-11 15:18:42 +0900214 ]
215 }
216}