blob: a4c24ce958c76612f2dffff8dc08c4a70f27c009 [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
44cc_library(
Alex Perrycb7da4b2019-08-28 19:35:56 -070045 name = "event_loop",
Austin Schuh54cf95f2019-11-29 13:14:18 -080046 srcs = [
47 "event_loop.cc",
Austin Schuh7d87b672019-12-01 20:23:49 -080048 "event_loop_event.h",
Austin Schuh54cf95f2019-11-29 13:14:18 -080049 "event_loop_tmpl.h",
50 ],
Austin Schuha1654ed2019-01-27 17:24:54 -080051 hdrs = [
Alex Perrycb7da4b2019-08-28 19:35:56 -070052 "event_loop.h",
Austin Schuha1654ed2019-01-27 17:24:54 -080053 ],
54 visibility = ["//visibility:public"],
55 deps = [
Austin Schuh39788ff2019-12-01 18:22:57 -080056 ":event_loop_fbs",
57 ":timing_statistics",
Alex Perrycb7da4b2019-08-28 19:35:56 -070058 "//aos:configuration",
59 "//aos:configuration_fbs",
60 "//aos:flatbuffers",
Brian Silvermana1652f32020-01-29 20:41:44 -080061 "//aos/ipc_lib:data_alignment",
Austin Schuha1654ed2019-01-27 17:24:54 -080062 "//aos/time",
Austin Schuh39788ff2019-12-01 18:22:57 -080063 "//aos/util:phased_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -070064 "@com_github_google_flatbuffers//:flatbuffers",
Brian Silverman0fc69932020-01-24 21:54:02 -080065 "@com_google_absl//absl/container:btree",
Alex Perrycb7da4b2019-08-28 19:35:56 -070066 ],
67)
68
Austin Schuh6b9c4152019-11-29 12:45:24 -080069cc_library(
70 name = "ping_lib",
71 srcs = [
72 "ping_lib.cc",
73 ],
74 hdrs = [
75 "ping_lib.h",
76 ],
77 deps = [
78 ":event_loop",
79 ":ping_fbs",
80 ":pong_fbs",
81 "//aos:json_to_flatbuffer",
82 "@com_github_google_glog//:glog",
83 ],
84)
85
Alex Perrycb7da4b2019-08-28 19:35:56 -070086cc_binary(
87 name = "ping",
88 srcs = [
89 "ping.cc",
90 ],
Austin Schuh6b9c4152019-11-29 12:45:24 -080091 data = ["pingpong_config.json"],
Alex Perrycb7da4b2019-08-28 19:35:56 -070092 deps = [
Austin Schuh6b9c4152019-11-29 12:45:24 -080093 ":ping_lib",
Alex Perrycb7da4b2019-08-28 19:35:56 -070094 ":shm_event_loop",
95 "//aos:configuration",
96 "//aos:init",
97 "//aos:json_to_flatbuffer",
98 "@com_github_google_glog//:glog",
99 ],
100)
101
Austin Schuh6b9c4152019-11-29 12:45:24 -0800102aos_config(
Austin Schuh39788ff2019-12-01 18:22:57 -0800103 name = "config",
104 src = "aos.json",
105 flatbuffers = [
106 ":event_loop_fbs",
107 ],
108)
109
110aos_config(
Austin Schuh6b9c4152019-11-29 12:45:24 -0800111 name = "pingpong_config",
Austin Schuh39788ff2019-12-01 18:22:57 -0800112 src = "pingpong.json",
Austin Schuh6b9c4152019-11-29 12:45:24 -0800113 flatbuffers = [
114 ":ping_fbs",
115 ":pong_fbs",
116 ],
Austin Schuh39788ff2019-12-01 18:22:57 -0800117 deps = [":config"],
Austin Schuh6b9c4152019-11-29 12:45:24 -0800118)
119
Austin Schuh15649d62019-12-28 16:36:38 -0800120aos_config(
121 name = "multinode_pingpong_config",
122 src = "multinode_pingpong.json",
123 flatbuffers = [
124 ":ping_fbs",
125 ":pong_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800126 "//aos/network:message_bridge_client_fbs",
127 "//aos/network:message_bridge_server_fbs",
Austin Schuh15649d62019-12-28 16:36:38 -0800128 ],
129 deps = [":config"],
130)
131
Austin Schuh6b9c4152019-11-29 12:45:24 -0800132cc_library(
133 name = "pong_lib",
134 srcs = [
135 "pong_lib.cc",
136 ],
137 hdrs = [
138 "pong_lib.h",
139 ],
140 deps = [
141 ":event_loop",
142 ":ping_fbs",
143 ":pong_fbs",
144 "@com_github_google_glog//:glog",
145 ],
146)
147
Alex Perrycb7da4b2019-08-28 19:35:56 -0700148cc_binary(
149 name = "pong",
150 srcs = [
151 "pong.cc",
152 ],
Austin Schuh6b9c4152019-11-29 12:45:24 -0800153 data = ["pingpong_config.json"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700154 deps = [
Austin Schuh6b9c4152019-11-29 12:45:24 -0800155 ":ping_fbs",
156 ":pong_fbs",
157 ":pong_lib",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700158 ":shm_event_loop",
159 "//aos:configuration",
160 "//aos:init",
161 "//aos:json_to_flatbuffer",
162 "@com_github_google_glog//:glog",
Austin Schuha1654ed2019-01-27 17:24:54 -0800163 ],
Parker Schuhe4a70d62017-12-27 20:10:20 -0800164)
165
Austin Schuh6b9c4152019-11-29 12:45:24 -0800166cc_test(
167 name = "pingpong_test",
168 srcs = ["pingpong_test.cc"],
169 data = [":pingpong_config.json"],
170 deps = [
171 ":ping_lib",
172 ":pong_lib",
173 ":simulated_event_loop",
174 "//aos:configuration",
175 "//aos:flatbuffers",
176 "//aos/testing:googletest",
177 ],
178)
179
Parker Schuhe4a70d62017-12-27 20:10:20 -0800180cc_library(
Austin Schuhe4106142019-12-01 18:19:53 -0800181 name = "timing_statistics",
182 srcs = ["timing_statistics.cc"],
183 hdrs = ["timing_statistics.h"],
184 deps = [
185 ":event_loop_fbs",
186 "//aos:configuration",
187 "@com_github_google_glog//:glog",
188 ],
189)
190
191cc_test(
192 name = "timing_statistics_test",
193 srcs = ["timing_statistics_test.cc"],
194 deps = [
195 ":timing_statistics",
196 "//aos:configuration",
197 "//aos:flatbuffers",
198 "//aos/testing:googletest",
199 ],
200)
201
202cc_library(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700203 name = "shm_event_loop",
204 srcs = ["shm_event_loop.cc"],
205 hdrs = ["shm_event_loop.h"],
Austin Schuha1654ed2019-01-27 17:24:54 -0800206 visibility = ["//visibility:public"],
207 deps = [
Austin Schuh6b6dfa52019-06-12 20:16:20 -0700208 ":epoll",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700209 ":event_loop",
Austin Schuh39788ff2019-12-01 18:22:57 -0800210 ":event_loop_fbs",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700211 ":test_message_fbs",
Austin Schuh39788ff2019-12-01 18:22:57 -0800212 ":timing_statistics",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700213 "//aos:realtime",
214 "//aos/ipc_lib:lockless_queue",
215 "//aos/ipc_lib:signalfd",
Austin Schuh32fd5a72019-12-01 22:20:26 -0800216 "//aos/stl_mutex",
Austin Schuh52d325c2019-06-23 18:59:06 -0700217 "//aos/util:phased_loop",
Austin Schuha1654ed2019-01-27 17:24:54 -0800218 ],
Parker Schuhe4a70d62017-12-27 20:10:20 -0800219)
220
221cc_test(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700222 name = "shm_event_loop_test",
223 srcs = ["shm_event_loop_test.cc"],
Austin Schuh6b6dfa52019-06-12 20:16:20 -0700224 shard_count = 5,
Austin Schuha1654ed2019-01-27 17:24:54 -0800225 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700226 ":event_loop_param_test",
227 ":shm_event_loop",
228 ":test_message_fbs",
Austin Schuha1654ed2019-01-27 17:24:54 -0800229 ],
Parker Schuhe4a70d62017-12-27 20:10:20 -0800230)
231
232cc_library(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700233 name = "event_loop_param_test",
Austin Schuha1654ed2019-01-27 17:24:54 -0800234 testonly = True,
Alex Perrycb7da4b2019-08-28 19:35:56 -0700235 srcs = ["event_loop_param_test.cc"],
236 hdrs = ["event_loop_param_test.h"],
Austin Schuha1654ed2019-01-27 17:24:54 -0800237 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700238 ":event_loop",
239 ":test_message_fbs",
Austin Schuha1654ed2019-01-27 17:24:54 -0800240 "//aos/testing:googletest",
241 ],
Parker Schuhe4a70d62017-12-27 20:10:20 -0800242)
Neil Balchc8f41ed2018-01-20 22:06:53 -0800243
244cc_test(
Austin Schuh7267c532019-05-19 19:55:53 -0700245 name = "simulated_event_loop_test",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700246 srcs = ["simulated_event_loop_test.cc"],
Austin Schuh898f4972020-01-11 17:21:25 -0800247 data = ["multinode_pingpong_config.json"],
Austin Schuha1654ed2019-01-27 17:24:54 -0800248 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700249 ":event_loop_param_test",
Austin Schuh898f4972020-01-11 17:21:25 -0800250 ":ping_lib",
251 ":pong_lib",
Austin Schuh7267c532019-05-19 19:55:53 -0700252 ":simulated_event_loop",
Austin Schuha1654ed2019-01-27 17:24:54 -0800253 "//aos/testing:googletest",
254 ],
Neil Balchc8f41ed2018-01-20 22:06:53 -0800255)
256
257cc_library(
Austin Schuhe1dafe42020-01-06 21:12:03 -0800258 name = "simple_channel",
259 srcs = ["simple_channel.cc"],
260 hdrs = ["simple_channel.h"],
261 deps = [
262 "//aos:configuration_fbs",
263 "@com_github_google_flatbuffers//:flatbuffers",
264 "@com_github_google_glog//:glog",
265 "@com_google_absl//absl/strings",
266 ],
267)
268
269cc_library(
Austin Schuh7267c532019-05-19 19:55:53 -0700270 name = "simulated_event_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700271 srcs = [
272 "event_scheduler.cc",
273 "simulated_event_loop.cc",
Austin Schuh898f4972020-01-11 17:21:25 -0800274 "simulated_network_bridge.cc",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700275 ],
276 hdrs = [
277 "event_scheduler.h",
278 "simulated_event_loop.h",
Austin Schuh898f4972020-01-11 17:21:25 -0800279 "simulated_network_bridge.h",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700280 ],
Austin Schuh7267c532019-05-19 19:55:53 -0700281 visibility = ["//visibility:public"],
Austin Schuha1654ed2019-01-27 17:24:54 -0800282 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700283 ":event_loop",
Austin Schuhe1dafe42020-01-06 21:12:03 -0800284 ":simple_channel",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700285 "//aos/ipc_lib:index",
Austin Schuh52d325c2019-06-23 18:59:06 -0700286 "//aos/util:phased_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700287 "@com_google_absl//absl/container:btree",
Austin Schuha1654ed2019-01-27 17:24:54 -0800288 ],
Neil Balchc8f41ed2018-01-20 22:06:53 -0800289)