blob: 9cfdf10a7b6545a912a8ddcb90f6abdaacffe086 [file] [log] [blame]
Alex Perrycb7da4b2019-08-28 19:35:56 -07001load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
Austin Schuh6b9c4152019-11-29 12:45:24 -08002load("//aos:config.bzl", "aos_config")
Alex Perrycb7da4b2019-08-28 19:35:56 -07003
4package(default_visibility = ["//visibility:public"])
5
6flatbuffer_cc_library(
7 name = "test_message_fbs",
8 srcs = ["test_message.fbs"],
9 gen_reflections = 1,
10)
11
12flatbuffer_cc_library(
Austin Schuhe4106142019-12-01 18:19:53 -080013 name = "event_loop_fbs",
14 srcs = ["event_loop.fbs"],
15 gen_reflections = 1,
16 includes = [
17 "//aos:configuration_fbs_includes",
18 ],
19)
20
21flatbuffer_cc_library(
Austin Schuh6b9c4152019-11-29 12:45:24 -080022 name = "ping_fbs",
23 srcs = ["ping.fbs"],
24 gen_reflections = 1,
25)
26
27flatbuffer_cc_library(
28 name = "pong_fbs",
29 srcs = ["pong.fbs"],
Alex Perrycb7da4b2019-08-28 19:35:56 -070030 gen_reflections = 1,
31)
32
Parker Schuhe4a70d62017-12-27 20:10:20 -080033cc_library(
Austin Schuh6b6dfa52019-06-12 20:16:20 -070034 name = "epoll",
35 srcs = ["epoll.cc"],
36 hdrs = ["epoll.h"],
Austin Schuh20b2b082019-09-11 20:42:56 -070037 visibility = ["//visibility:public"],
Austin Schuh6b6dfa52019-06-12 20:16:20 -070038 deps = [
Austin Schuh6b6dfa52019-06-12 20:16:20 -070039 "//aos/time",
Austin Schuhf257f3c2019-10-27 21:00:43 -070040 "@com_github_google_glog//:glog",
Austin Schuh6b6dfa52019-06-12 20:16:20 -070041 ],
42)
43
Brian Silverman441591b2020-01-31 17:44:32 -080044cc_test(
45 name = "epoll_test",
46 srcs = ["epoll_test.cc"],
47 deps = [
48 ":epoll",
49 "//aos/testing:googletest",
50 "@com_github_google_glog//:glog",
51 ],
52)
53
Austin Schuh6b6dfa52019-06-12 20:16:20 -070054cc_library(
Alex Perrycb7da4b2019-08-28 19:35:56 -070055 name = "event_loop",
Austin Schuh54cf95f2019-11-29 13:14:18 -080056 srcs = [
57 "event_loop.cc",
Austin Schuh7d87b672019-12-01 20:23:49 -080058 "event_loop_event.h",
Austin Schuh54cf95f2019-11-29 13:14:18 -080059 "event_loop_tmpl.h",
60 ],
Austin Schuha1654ed2019-01-27 17:24:54 -080061 hdrs = [
Alex Perrycb7da4b2019-08-28 19:35:56 -070062 "event_loop.h",
Austin Schuha1654ed2019-01-27 17:24:54 -080063 ],
64 visibility = ["//visibility:public"],
65 deps = [
Austin Schuh39788ff2019-12-01 18:22:57 -080066 ":event_loop_fbs",
67 ":timing_statistics",
Alex Perrycb7da4b2019-08-28 19:35:56 -070068 "//aos:configuration",
69 "//aos:configuration_fbs",
70 "//aos:flatbuffers",
Brian Silvermana1652f32020-01-29 20:41:44 -080071 "//aos/ipc_lib:data_alignment",
Austin Schuha1654ed2019-01-27 17:24:54 -080072 "//aos/time",
Austin Schuh39788ff2019-12-01 18:22:57 -080073 "//aos/util:phased_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -070074 "@com_github_google_flatbuffers//:flatbuffers",
Brian Silverman0fc69932020-01-24 21:54:02 -080075 "@com_google_absl//absl/container:btree",
Alex Perrycb7da4b2019-08-28 19:35:56 -070076 ],
77)
78
Austin Schuh6b9c4152019-11-29 12:45:24 -080079cc_library(
80 name = "ping_lib",
81 srcs = [
82 "ping_lib.cc",
83 ],
84 hdrs = [
85 "ping_lib.h",
86 ],
87 deps = [
88 ":event_loop",
89 ":ping_fbs",
90 ":pong_fbs",
91 "//aos:json_to_flatbuffer",
92 "@com_github_google_glog//:glog",
93 ],
94)
95
Alex Perrycb7da4b2019-08-28 19:35:56 -070096cc_binary(
97 name = "ping",
98 srcs = [
99 "ping.cc",
100 ],
Austin Schuh6b9c4152019-11-29 12:45:24 -0800101 data = ["pingpong_config.json"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700102 deps = [
Austin Schuh6b9c4152019-11-29 12:45:24 -0800103 ":ping_lib",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700104 ":shm_event_loop",
105 "//aos:configuration",
106 "//aos:init",
107 "//aos:json_to_flatbuffer",
108 "@com_github_google_glog//:glog",
109 ],
110)
111
Austin Schuh6b9c4152019-11-29 12:45:24 -0800112aos_config(
Austin Schuh39788ff2019-12-01 18:22:57 -0800113 name = "config",
114 src = "aos.json",
115 flatbuffers = [
116 ":event_loop_fbs",
117 ],
118)
119
120aos_config(
Austin Schuh6b9c4152019-11-29 12:45:24 -0800121 name = "pingpong_config",
Austin Schuh39788ff2019-12-01 18:22:57 -0800122 src = "pingpong.json",
Austin Schuh6b9c4152019-11-29 12:45:24 -0800123 flatbuffers = [
124 ":ping_fbs",
125 ":pong_fbs",
126 ],
Austin Schuh39788ff2019-12-01 18:22:57 -0800127 deps = [":config"],
Austin Schuh6b9c4152019-11-29 12:45:24 -0800128)
129
Austin Schuh15649d62019-12-28 16:36:38 -0800130aos_config(
131 name = "multinode_pingpong_config",
132 src = "multinode_pingpong.json",
133 flatbuffers = [
134 ":ping_fbs",
135 ":pong_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800136 "//aos/network:message_bridge_client_fbs",
137 "//aos/network:message_bridge_server_fbs",
Austin Schuh15649d62019-12-28 16:36:38 -0800138 ],
139 deps = [":config"],
140)
141
Austin Schuh6b9c4152019-11-29 12:45:24 -0800142cc_library(
143 name = "pong_lib",
144 srcs = [
145 "pong_lib.cc",
146 ],
147 hdrs = [
148 "pong_lib.h",
149 ],
150 deps = [
151 ":event_loop",
152 ":ping_fbs",
153 ":pong_fbs",
154 "@com_github_google_glog//:glog",
155 ],
156)
157
Alex Perrycb7da4b2019-08-28 19:35:56 -0700158cc_binary(
159 name = "pong",
160 srcs = [
161 "pong.cc",
162 ],
Austin Schuh6b9c4152019-11-29 12:45:24 -0800163 data = ["pingpong_config.json"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700164 deps = [
Austin Schuh6b9c4152019-11-29 12:45:24 -0800165 ":ping_fbs",
166 ":pong_fbs",
167 ":pong_lib",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700168 ":shm_event_loop",
169 "//aos:configuration",
170 "//aos:init",
171 "//aos:json_to_flatbuffer",
172 "@com_github_google_glog//:glog",
Austin Schuha1654ed2019-01-27 17:24:54 -0800173 ],
Parker Schuhe4a70d62017-12-27 20:10:20 -0800174)
175
Austin Schuh6b9c4152019-11-29 12:45:24 -0800176cc_test(
177 name = "pingpong_test",
178 srcs = ["pingpong_test.cc"],
179 data = [":pingpong_config.json"],
180 deps = [
181 ":ping_lib",
182 ":pong_lib",
183 ":simulated_event_loop",
184 "//aos:configuration",
185 "//aos:flatbuffers",
186 "//aos/testing:googletest",
187 ],
188)
189
Parker Schuhe4a70d62017-12-27 20:10:20 -0800190cc_library(
Austin Schuhe4106142019-12-01 18:19:53 -0800191 name = "timing_statistics",
192 srcs = ["timing_statistics.cc"],
193 hdrs = ["timing_statistics.h"],
194 deps = [
195 ":event_loop_fbs",
196 "//aos:configuration",
197 "@com_github_google_glog//:glog",
198 ],
199)
200
201cc_test(
202 name = "timing_statistics_test",
203 srcs = ["timing_statistics_test.cc"],
204 deps = [
205 ":timing_statistics",
206 "//aos:configuration",
207 "//aos:flatbuffers",
208 "//aos/testing:googletest",
209 ],
210)
211
212cc_library(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700213 name = "shm_event_loop",
214 srcs = ["shm_event_loop.cc"],
215 hdrs = ["shm_event_loop.h"],
Austin Schuha1654ed2019-01-27 17:24:54 -0800216 visibility = ["//visibility:public"],
217 deps = [
Austin Schuh6b6dfa52019-06-12 20:16:20 -0700218 ":epoll",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700219 ":event_loop",
Austin Schuh39788ff2019-12-01 18:22:57 -0800220 ":event_loop_fbs",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700221 ":test_message_fbs",
Austin Schuh39788ff2019-12-01 18:22:57 -0800222 ":timing_statistics",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700223 "//aos:realtime",
224 "//aos/ipc_lib:lockless_queue",
225 "//aos/ipc_lib:signalfd",
Austin Schuh32fd5a72019-12-01 22:20:26 -0800226 "//aos/stl_mutex",
Austin Schuh52d325c2019-06-23 18:59:06 -0700227 "//aos/util:phased_loop",
Brian Silverman441591b2020-01-31 17:44:32 -0800228 "@com_google_absl//absl/base",
Austin Schuha1654ed2019-01-27 17:24:54 -0800229 ],
Parker Schuhe4a70d62017-12-27 20:10:20 -0800230)
231
232cc_test(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700233 name = "shm_event_loop_test",
234 srcs = ["shm_event_loop_test.cc"],
Austin Schuh6b6dfa52019-06-12 20:16:20 -0700235 shard_count = 5,
Austin Schuha1654ed2019-01-27 17:24:54 -0800236 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700237 ":event_loop_param_test",
238 ":shm_event_loop",
239 ":test_message_fbs",
Austin Schuha1654ed2019-01-27 17:24:54 -0800240 ],
Parker Schuhe4a70d62017-12-27 20:10:20 -0800241)
242
243cc_library(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700244 name = "event_loop_param_test",
Austin Schuha1654ed2019-01-27 17:24:54 -0800245 testonly = True,
Alex Perrycb7da4b2019-08-28 19:35:56 -0700246 srcs = ["event_loop_param_test.cc"],
247 hdrs = ["event_loop_param_test.h"],
Austin Schuha1654ed2019-01-27 17:24:54 -0800248 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700249 ":event_loop",
250 ":test_message_fbs",
Austin Schuha1654ed2019-01-27 17:24:54 -0800251 "//aos/testing:googletest",
252 ],
Parker Schuhe4a70d62017-12-27 20:10:20 -0800253)
Neil Balchc8f41ed2018-01-20 22:06:53 -0800254
255cc_test(
Austin Schuh7267c532019-05-19 19:55:53 -0700256 name = "simulated_event_loop_test",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700257 srcs = ["simulated_event_loop_test.cc"],
Austin Schuh898f4972020-01-11 17:21:25 -0800258 data = ["multinode_pingpong_config.json"],
Austin Schuha1654ed2019-01-27 17:24:54 -0800259 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700260 ":event_loop_param_test",
Austin Schuh898f4972020-01-11 17:21:25 -0800261 ":ping_lib",
262 ":pong_lib",
Austin Schuh7267c532019-05-19 19:55:53 -0700263 ":simulated_event_loop",
Austin Schuha1654ed2019-01-27 17:24:54 -0800264 "//aos/testing:googletest",
265 ],
Neil Balchc8f41ed2018-01-20 22:06:53 -0800266)
267
268cc_library(
Austin Schuhe1dafe42020-01-06 21:12:03 -0800269 name = "simple_channel",
270 srcs = ["simple_channel.cc"],
271 hdrs = ["simple_channel.h"],
272 deps = [
273 "//aos:configuration_fbs",
274 "@com_github_google_flatbuffers//:flatbuffers",
275 "@com_github_google_glog//:glog",
276 "@com_google_absl//absl/strings",
277 ],
278)
279
280cc_library(
Austin Schuh7267c532019-05-19 19:55:53 -0700281 name = "simulated_event_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700282 srcs = [
283 "event_scheduler.cc",
284 "simulated_event_loop.cc",
Austin Schuh898f4972020-01-11 17:21:25 -0800285 "simulated_network_bridge.cc",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700286 ],
287 hdrs = [
288 "event_scheduler.h",
289 "simulated_event_loop.h",
Austin Schuh898f4972020-01-11 17:21:25 -0800290 "simulated_network_bridge.h",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700291 ],
Austin Schuh7267c532019-05-19 19:55:53 -0700292 visibility = ["//visibility:public"],
Austin Schuha1654ed2019-01-27 17:24:54 -0800293 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700294 ":event_loop",
Austin Schuhe1dafe42020-01-06 21:12:03 -0800295 ":simple_channel",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700296 "//aos/ipc_lib:index",
Austin Schuh52d325c2019-06-23 18:59:06 -0700297 "//aos/util:phased_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700298 "@com_google_absl//absl/container:btree",
Austin Schuha1654ed2019-01-27 17:24:54 -0800299 ],
Neil Balchc8f41ed2018-01-20 22:06:53 -0800300)