blob: 6b4af79898ed1557c086f09feb4ac0f484bcae9a [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",
Austin Schuha1654ed2019-01-27 17:24:54 -080071 "//aos/time",
Austin Schuh39788ff2019-12-01 18:22:57 -080072 "//aos/util:phased_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -070073 "@com_github_google_flatbuffers//:flatbuffers",
Brian Silverman0fc69932020-01-24 21:54:02 -080074 "@com_google_absl//absl/container:btree",
Alex Perrycb7da4b2019-08-28 19:35:56 -070075 ],
76)
77
Austin Schuh6b9c4152019-11-29 12:45:24 -080078cc_library(
79 name = "ping_lib",
80 srcs = [
81 "ping_lib.cc",
82 ],
83 hdrs = [
84 "ping_lib.h",
85 ],
86 deps = [
87 ":event_loop",
88 ":ping_fbs",
89 ":pong_fbs",
90 "//aos:json_to_flatbuffer",
91 "@com_github_google_glog//:glog",
92 ],
93)
94
Alex Perrycb7da4b2019-08-28 19:35:56 -070095cc_binary(
96 name = "ping",
97 srcs = [
98 "ping.cc",
99 ],
Austin Schuh6b9c4152019-11-29 12:45:24 -0800100 data = ["pingpong_config.json"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700101 deps = [
Austin Schuh6b9c4152019-11-29 12:45:24 -0800102 ":ping_lib",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700103 ":shm_event_loop",
104 "//aos:configuration",
105 "//aos:init",
106 "//aos:json_to_flatbuffer",
107 "@com_github_google_glog//:glog",
108 ],
109)
110
Austin Schuh6b9c4152019-11-29 12:45:24 -0800111aos_config(
Austin Schuh39788ff2019-12-01 18:22:57 -0800112 name = "config",
113 src = "aos.json",
114 flatbuffers = [
115 ":event_loop_fbs",
116 ],
117)
118
119aos_config(
Austin Schuh6b9c4152019-11-29 12:45:24 -0800120 name = "pingpong_config",
Austin Schuh39788ff2019-12-01 18:22:57 -0800121 src = "pingpong.json",
Austin Schuh6b9c4152019-11-29 12:45:24 -0800122 flatbuffers = [
123 ":ping_fbs",
124 ":pong_fbs",
125 ],
Austin Schuh39788ff2019-12-01 18:22:57 -0800126 deps = [":config"],
Austin Schuh6b9c4152019-11-29 12:45:24 -0800127)
128
Austin Schuh15649d62019-12-28 16:36:38 -0800129aos_config(
130 name = "multinode_pingpong_config",
131 src = "multinode_pingpong.json",
132 flatbuffers = [
133 ":ping_fbs",
134 ":pong_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800135 "//aos/network:message_bridge_client_fbs",
136 "//aos/network:message_bridge_server_fbs",
Austin Schuh15649d62019-12-28 16:36:38 -0800137 ],
138 deps = [":config"],
139)
140
Austin Schuh6b9c4152019-11-29 12:45:24 -0800141cc_library(
142 name = "pong_lib",
143 srcs = [
144 "pong_lib.cc",
145 ],
146 hdrs = [
147 "pong_lib.h",
148 ],
149 deps = [
150 ":event_loop",
151 ":ping_fbs",
152 ":pong_fbs",
153 "@com_github_google_glog//:glog",
154 ],
155)
156
Alex Perrycb7da4b2019-08-28 19:35:56 -0700157cc_binary(
158 name = "pong",
159 srcs = [
160 "pong.cc",
161 ],
Austin Schuh6b9c4152019-11-29 12:45:24 -0800162 data = ["pingpong_config.json"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700163 deps = [
Austin Schuh6b9c4152019-11-29 12:45:24 -0800164 ":ping_fbs",
165 ":pong_fbs",
166 ":pong_lib",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700167 ":shm_event_loop",
168 "//aos:configuration",
169 "//aos:init",
170 "//aos:json_to_flatbuffer",
171 "@com_github_google_glog//:glog",
Austin Schuha1654ed2019-01-27 17:24:54 -0800172 ],
Parker Schuhe4a70d62017-12-27 20:10:20 -0800173)
174
Austin Schuh6b9c4152019-11-29 12:45:24 -0800175cc_test(
176 name = "pingpong_test",
177 srcs = ["pingpong_test.cc"],
178 data = [":pingpong_config.json"],
179 deps = [
180 ":ping_lib",
181 ":pong_lib",
182 ":simulated_event_loop",
183 "//aos:configuration",
184 "//aos:flatbuffers",
185 "//aos/testing:googletest",
186 ],
187)
188
Parker Schuhe4a70d62017-12-27 20:10:20 -0800189cc_library(
Austin Schuhe4106142019-12-01 18:19:53 -0800190 name = "timing_statistics",
191 srcs = ["timing_statistics.cc"],
192 hdrs = ["timing_statistics.h"],
193 deps = [
194 ":event_loop_fbs",
195 "//aos:configuration",
196 "@com_github_google_glog//:glog",
197 ],
198)
199
200cc_test(
201 name = "timing_statistics_test",
202 srcs = ["timing_statistics_test.cc"],
203 deps = [
204 ":timing_statistics",
205 "//aos:configuration",
206 "//aos:flatbuffers",
207 "//aos/testing:googletest",
208 ],
209)
210
211cc_library(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700212 name = "shm_event_loop",
213 srcs = ["shm_event_loop.cc"],
214 hdrs = ["shm_event_loop.h"],
Austin Schuha1654ed2019-01-27 17:24:54 -0800215 visibility = ["//visibility:public"],
216 deps = [
Austin Schuh6b6dfa52019-06-12 20:16:20 -0700217 ":epoll",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700218 ":event_loop",
Austin Schuh39788ff2019-12-01 18:22:57 -0800219 ":event_loop_fbs",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700220 ":test_message_fbs",
Austin Schuh39788ff2019-12-01 18:22:57 -0800221 ":timing_statistics",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700222 "//aos:realtime",
223 "//aos/ipc_lib:lockless_queue",
224 "//aos/ipc_lib:signalfd",
Austin Schuh32fd5a72019-12-01 22:20:26 -0800225 "//aos/stl_mutex",
Austin Schuh52d325c2019-06-23 18:59:06 -0700226 "//aos/util:phased_loop",
Brian Silverman441591b2020-01-31 17:44:32 -0800227 "@com_google_absl//absl/base",
Austin Schuha1654ed2019-01-27 17:24:54 -0800228 ],
Parker Schuhe4a70d62017-12-27 20:10:20 -0800229)
230
231cc_test(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700232 name = "shm_event_loop_test",
233 srcs = ["shm_event_loop_test.cc"],
Austin Schuh6b6dfa52019-06-12 20:16:20 -0700234 shard_count = 5,
Austin Schuha1654ed2019-01-27 17:24:54 -0800235 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700236 ":event_loop_param_test",
237 ":shm_event_loop",
238 ":test_message_fbs",
Austin Schuha1654ed2019-01-27 17:24:54 -0800239 ],
Parker Schuhe4a70d62017-12-27 20:10:20 -0800240)
241
242cc_library(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700243 name = "event_loop_param_test",
Austin Schuha1654ed2019-01-27 17:24:54 -0800244 testonly = True,
Alex Perrycb7da4b2019-08-28 19:35:56 -0700245 srcs = ["event_loop_param_test.cc"],
246 hdrs = ["event_loop_param_test.h"],
Austin Schuha1654ed2019-01-27 17:24:54 -0800247 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700248 ":event_loop",
249 ":test_message_fbs",
Austin Schuha1654ed2019-01-27 17:24:54 -0800250 "//aos/testing:googletest",
251 ],
Parker Schuhe4a70d62017-12-27 20:10:20 -0800252)
Neil Balchc8f41ed2018-01-20 22:06:53 -0800253
254cc_test(
Austin Schuh7267c532019-05-19 19:55:53 -0700255 name = "simulated_event_loop_test",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700256 srcs = ["simulated_event_loop_test.cc"],
Austin Schuha1654ed2019-01-27 17:24:54 -0800257 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700258 ":event_loop_param_test",
Austin Schuh7267c532019-05-19 19:55:53 -0700259 ":simulated_event_loop",
Austin Schuha1654ed2019-01-27 17:24:54 -0800260 "//aos/testing:googletest",
261 ],
Neil Balchc8f41ed2018-01-20 22:06:53 -0800262)
263
264cc_library(
Austin Schuhe1dafe42020-01-06 21:12:03 -0800265 name = "simple_channel",
266 srcs = ["simple_channel.cc"],
267 hdrs = ["simple_channel.h"],
268 deps = [
269 "//aos:configuration_fbs",
270 "@com_github_google_flatbuffers//:flatbuffers",
271 "@com_github_google_glog//:glog",
272 "@com_google_absl//absl/strings",
273 ],
274)
275
276cc_library(
Austin Schuh7267c532019-05-19 19:55:53 -0700277 name = "simulated_event_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700278 srcs = [
279 "event_scheduler.cc",
280 "simulated_event_loop.cc",
281 ],
282 hdrs = [
283 "event_scheduler.h",
284 "simulated_event_loop.h",
285 ],
Austin Schuh7267c532019-05-19 19:55:53 -0700286 visibility = ["//visibility:public"],
Austin Schuha1654ed2019-01-27 17:24:54 -0800287 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700288 ":event_loop",
Austin Schuhe1dafe42020-01-06 21:12:03 -0800289 ":simple_channel",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700290 "//aos/ipc_lib:index",
Austin Schuh52d325c2019-06-23 18:59:06 -0700291 "//aos/util:phased_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700292 "@com_google_absl//absl/container:btree",
Austin Schuha1654ed2019-01-27 17:24:54 -0800293 ],
Neil Balchc8f41ed2018-01-20 22:06:53 -0800294)