blob: 0470b6eba84f8cf342c5a7bc2d2bc2d56818e84e [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",
Tyler Chatow67ddb032020-01-12 14:30:04 -080072 "//aos/logging:implementations",
Austin Schuha1654ed2019-01-27 17:24:54 -080073 "//aos/time",
Austin Schuh39788ff2019-12-01 18:22:57 -080074 "//aos/util:phased_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -070075 "@com_github_google_flatbuffers//:flatbuffers",
Brian Silverman0fc69932020-01-24 21:54:02 -080076 "@com_google_absl//absl/container:btree",
Alex Perrycb7da4b2019-08-28 19:35:56 -070077 ],
78)
79
Austin Schuh6b9c4152019-11-29 12:45:24 -080080cc_library(
81 name = "ping_lib",
82 srcs = [
83 "ping_lib.cc",
84 ],
85 hdrs = [
86 "ping_lib.h",
87 ],
88 deps = [
89 ":event_loop",
90 ":ping_fbs",
91 ":pong_fbs",
92 "//aos:json_to_flatbuffer",
93 "@com_github_google_glog//:glog",
94 ],
95)
96
Alex Perrycb7da4b2019-08-28 19:35:56 -070097cc_binary(
98 name = "ping",
99 srcs = [
100 "ping.cc",
101 ],
Austin Schuh6b9c4152019-11-29 12:45:24 -0800102 data = ["pingpong_config.json"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700103 deps = [
Austin Schuh6b9c4152019-11-29 12:45:24 -0800104 ":ping_lib",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700105 ":shm_event_loop",
106 "//aos:configuration",
107 "//aos:init",
108 "//aos:json_to_flatbuffer",
109 "@com_github_google_glog//:glog",
110 ],
111)
112
Austin Schuh6b9c4152019-11-29 12:45:24 -0800113aos_config(
Austin Schuh39788ff2019-12-01 18:22:57 -0800114 name = "config",
115 src = "aos.json",
116 flatbuffers = [
117 ":event_loop_fbs",
Tyler Chatow67ddb032020-01-12 14:30:04 -0800118 "//aos/logging:log_message_fbs",
Austin Schuh39788ff2019-12-01 18:22:57 -0800119 ],
120)
121
122aos_config(
Austin Schuh6b9c4152019-11-29 12:45:24 -0800123 name = "pingpong_config",
Austin Schuh39788ff2019-12-01 18:22:57 -0800124 src = "pingpong.json",
Austin Schuh6b9c4152019-11-29 12:45:24 -0800125 flatbuffers = [
126 ":ping_fbs",
127 ":pong_fbs",
128 ],
Austin Schuh39788ff2019-12-01 18:22:57 -0800129 deps = [":config"],
Austin Schuh6b9c4152019-11-29 12:45:24 -0800130)
131
Austin Schuh15649d62019-12-28 16:36:38 -0800132aos_config(
133 name = "multinode_pingpong_config",
134 src = "multinode_pingpong.json",
135 flatbuffers = [
136 ":ping_fbs",
137 ":pong_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800138 "//aos/network:message_bridge_client_fbs",
139 "//aos/network:message_bridge_server_fbs",
Austin Schuh15649d62019-12-28 16:36:38 -0800140 ],
141 deps = [":config"],
142)
143
Austin Schuh6b9c4152019-11-29 12:45:24 -0800144cc_library(
145 name = "pong_lib",
146 srcs = [
147 "pong_lib.cc",
148 ],
149 hdrs = [
150 "pong_lib.h",
151 ],
152 deps = [
153 ":event_loop",
154 ":ping_fbs",
155 ":pong_fbs",
156 "@com_github_google_glog//:glog",
157 ],
158)
159
Alex Perrycb7da4b2019-08-28 19:35:56 -0700160cc_binary(
161 name = "pong",
162 srcs = [
163 "pong.cc",
164 ],
Austin Schuh6b9c4152019-11-29 12:45:24 -0800165 data = ["pingpong_config.json"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700166 deps = [
Austin Schuh6b9c4152019-11-29 12:45:24 -0800167 ":ping_fbs",
168 ":pong_fbs",
169 ":pong_lib",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700170 ":shm_event_loop",
171 "//aos:configuration",
172 "//aos:init",
173 "//aos:json_to_flatbuffer",
174 "@com_github_google_glog//:glog",
Austin Schuha1654ed2019-01-27 17:24:54 -0800175 ],
Parker Schuhe4a70d62017-12-27 20:10:20 -0800176)
177
Austin Schuh6b9c4152019-11-29 12:45:24 -0800178cc_test(
179 name = "pingpong_test",
180 srcs = ["pingpong_test.cc"],
181 data = [":pingpong_config.json"],
182 deps = [
183 ":ping_lib",
184 ":pong_lib",
185 ":simulated_event_loop",
186 "//aos:configuration",
187 "//aos:flatbuffers",
188 "//aos/testing:googletest",
189 ],
190)
191
Parker Schuhe4a70d62017-12-27 20:10:20 -0800192cc_library(
Austin Schuhe4106142019-12-01 18:19:53 -0800193 name = "timing_statistics",
194 srcs = ["timing_statistics.cc"],
195 hdrs = ["timing_statistics.h"],
196 deps = [
197 ":event_loop_fbs",
198 "//aos:configuration",
199 "@com_github_google_glog//:glog",
200 ],
201)
202
203cc_test(
204 name = "timing_statistics_test",
205 srcs = ["timing_statistics_test.cc"],
206 deps = [
207 ":timing_statistics",
208 "//aos:configuration",
209 "//aos:flatbuffers",
210 "//aos/testing:googletest",
211 ],
212)
213
214cc_library(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700215 name = "shm_event_loop",
216 srcs = ["shm_event_loop.cc"],
217 hdrs = ["shm_event_loop.h"],
Austin Schuha1654ed2019-01-27 17:24:54 -0800218 visibility = ["//visibility:public"],
219 deps = [
Tyler Chatow67ddb032020-01-12 14:30:04 -0800220 ":aos_logging",
Austin Schuh6b6dfa52019-06-12 20:16:20 -0700221 ":epoll",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700222 ":event_loop",
Austin Schuh39788ff2019-12-01 18:22:57 -0800223 ":event_loop_fbs",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700224 ":test_message_fbs",
Austin Schuh39788ff2019-12-01 18:22:57 -0800225 ":timing_statistics",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700226 "//aos:realtime",
227 "//aos/ipc_lib:lockless_queue",
228 "//aos/ipc_lib:signalfd",
Austin Schuh32fd5a72019-12-01 22:20:26 -0800229 "//aos/stl_mutex",
Austin Schuh52d325c2019-06-23 18:59:06 -0700230 "//aos/util:phased_loop",
Brian Silverman441591b2020-01-31 17:44:32 -0800231 "@com_google_absl//absl/base",
Austin Schuha1654ed2019-01-27 17:24:54 -0800232 ],
Parker Schuhe4a70d62017-12-27 20:10:20 -0800233)
234
235cc_test(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700236 name = "shm_event_loop_test",
237 srcs = ["shm_event_loop_test.cc"],
Austin Schuh6b6dfa52019-06-12 20:16:20 -0700238 shard_count = 5,
Austin Schuha1654ed2019-01-27 17:24:54 -0800239 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700240 ":event_loop_param_test",
241 ":shm_event_loop",
242 ":test_message_fbs",
Austin Schuha1654ed2019-01-27 17:24:54 -0800243 ],
Parker Schuhe4a70d62017-12-27 20:10:20 -0800244)
245
246cc_library(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700247 name = "event_loop_param_test",
Austin Schuha1654ed2019-01-27 17:24:54 -0800248 testonly = True,
Alex Perrycb7da4b2019-08-28 19:35:56 -0700249 srcs = ["event_loop_param_test.cc"],
250 hdrs = ["event_loop_param_test.h"],
Austin Schuha1654ed2019-01-27 17:24:54 -0800251 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700252 ":event_loop",
253 ":test_message_fbs",
Austin Schuha1654ed2019-01-27 17:24:54 -0800254 "//aos/testing:googletest",
255 ],
Parker Schuhe4a70d62017-12-27 20:10:20 -0800256)
Neil Balchc8f41ed2018-01-20 22:06:53 -0800257
258cc_test(
Austin Schuh7267c532019-05-19 19:55:53 -0700259 name = "simulated_event_loop_test",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700260 srcs = ["simulated_event_loop_test.cc"],
Austin Schuh898f4972020-01-11 17:21:25 -0800261 data = ["multinode_pingpong_config.json"],
Austin Schuha1654ed2019-01-27 17:24:54 -0800262 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700263 ":event_loop_param_test",
Austin Schuh898f4972020-01-11 17:21:25 -0800264 ":ping_lib",
265 ":pong_lib",
Austin Schuh7267c532019-05-19 19:55:53 -0700266 ":simulated_event_loop",
Austin Schuha1654ed2019-01-27 17:24:54 -0800267 "//aos/testing:googletest",
268 ],
Neil Balchc8f41ed2018-01-20 22:06:53 -0800269)
270
271cc_library(
Austin Schuhe1dafe42020-01-06 21:12:03 -0800272 name = "simple_channel",
273 srcs = ["simple_channel.cc"],
274 hdrs = ["simple_channel.h"],
275 deps = [
276 "//aos:configuration_fbs",
277 "@com_github_google_flatbuffers//:flatbuffers",
278 "@com_github_google_glog//:glog",
279 "@com_google_absl//absl/strings",
280 ],
281)
282
283cc_library(
Austin Schuh7267c532019-05-19 19:55:53 -0700284 name = "simulated_event_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700285 srcs = [
286 "event_scheduler.cc",
287 "simulated_event_loop.cc",
Austin Schuh898f4972020-01-11 17:21:25 -0800288 "simulated_network_bridge.cc",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700289 ],
290 hdrs = [
291 "event_scheduler.h",
292 "simulated_event_loop.h",
Austin Schuh898f4972020-01-11 17:21:25 -0800293 "simulated_network_bridge.h",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700294 ],
Austin Schuh7267c532019-05-19 19:55:53 -0700295 visibility = ["//visibility:public"],
Austin Schuha1654ed2019-01-27 17:24:54 -0800296 deps = [
Tyler Chatow67ddb032020-01-12 14:30:04 -0800297 ":aos_logging",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700298 ":event_loop",
Austin Schuhe1dafe42020-01-06 21:12:03 -0800299 ":simple_channel",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700300 "//aos/ipc_lib:index",
Austin Schuh52d325c2019-06-23 18:59:06 -0700301 "//aos/util:phased_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700302 "@com_google_absl//absl/container:btree",
Austin Schuha1654ed2019-01-27 17:24:54 -0800303 ],
Neil Balchc8f41ed2018-01-20 22:06:53 -0800304)
Tyler Chatow67ddb032020-01-12 14:30:04 -0800305
306cc_library(
307 name = "aos_logging",
308 srcs = [
309 "aos_logging.cc",
310 ],
311 hdrs = [
312 "aos_logging.h",
313 ],
314 visibility = ["//visibility:public"],
315 deps = [
316 ":event_loop",
317 "//aos/logging:implementations",
318 "//aos/logging:log_message_fbs",
319 ],
320)