blob: e40ab997189a5adc9430fbc043d8f89742aa75c0 [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",
Austin Schuha1654ed2019-01-27 17:24:54 -080061 "//aos/time",
Austin Schuh39788ff2019-12-01 18:22:57 -080062 "//aos/util:phased_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -070063 "@com_github_google_flatbuffers//:flatbuffers",
64 ],
65)
66
Austin Schuh6b9c4152019-11-29 12:45:24 -080067cc_library(
68 name = "ping_lib",
69 srcs = [
70 "ping_lib.cc",
71 ],
72 hdrs = [
73 "ping_lib.h",
74 ],
75 deps = [
76 ":event_loop",
77 ":ping_fbs",
78 ":pong_fbs",
79 "//aos:json_to_flatbuffer",
80 "@com_github_google_glog//:glog",
81 ],
82)
83
Alex Perrycb7da4b2019-08-28 19:35:56 -070084cc_binary(
85 name = "ping",
86 srcs = [
87 "ping.cc",
88 ],
Austin Schuh6b9c4152019-11-29 12:45:24 -080089 data = ["pingpong_config.json"],
Alex Perrycb7da4b2019-08-28 19:35:56 -070090 deps = [
Austin Schuh6b9c4152019-11-29 12:45:24 -080091 ":ping_lib",
Alex Perrycb7da4b2019-08-28 19:35:56 -070092 ":shm_event_loop",
93 "//aos:configuration",
94 "//aos:init",
95 "//aos:json_to_flatbuffer",
96 "@com_github_google_glog//:glog",
97 ],
98)
99
Austin Schuh6b9c4152019-11-29 12:45:24 -0800100aos_config(
Austin Schuh39788ff2019-12-01 18:22:57 -0800101 name = "config",
102 src = "aos.json",
103 flatbuffers = [
104 ":event_loop_fbs",
105 ],
106)
107
108aos_config(
Austin Schuh6b9c4152019-11-29 12:45:24 -0800109 name = "pingpong_config",
Austin Schuh39788ff2019-12-01 18:22:57 -0800110 src = "pingpong.json",
Austin Schuh6b9c4152019-11-29 12:45:24 -0800111 flatbuffers = [
112 ":ping_fbs",
113 ":pong_fbs",
114 ],
Austin Schuh39788ff2019-12-01 18:22:57 -0800115 deps = [":config"],
Austin Schuh6b9c4152019-11-29 12:45:24 -0800116)
117
Austin Schuh15649d62019-12-28 16:36:38 -0800118aos_config(
119 name = "multinode_pingpong_config",
120 src = "multinode_pingpong.json",
121 flatbuffers = [
122 ":ping_fbs",
123 ":pong_fbs",
124 ],
125 deps = [":config"],
126)
127
Austin Schuh6b9c4152019-11-29 12:45:24 -0800128cc_library(
129 name = "pong_lib",
130 srcs = [
131 "pong_lib.cc",
132 ],
133 hdrs = [
134 "pong_lib.h",
135 ],
136 deps = [
137 ":event_loop",
138 ":ping_fbs",
139 ":pong_fbs",
140 "@com_github_google_glog//:glog",
141 ],
142)
143
Alex Perrycb7da4b2019-08-28 19:35:56 -0700144cc_binary(
145 name = "pong",
146 srcs = [
147 "pong.cc",
148 ],
Austin Schuh6b9c4152019-11-29 12:45:24 -0800149 data = ["pingpong_config.json"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700150 deps = [
Austin Schuh6b9c4152019-11-29 12:45:24 -0800151 ":ping_fbs",
152 ":pong_fbs",
153 ":pong_lib",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700154 ":shm_event_loop",
155 "//aos:configuration",
156 "//aos:init",
157 "//aos:json_to_flatbuffer",
158 "@com_github_google_glog//:glog",
Austin Schuha1654ed2019-01-27 17:24:54 -0800159 ],
Parker Schuhe4a70d62017-12-27 20:10:20 -0800160)
161
Austin Schuh6b9c4152019-11-29 12:45:24 -0800162cc_test(
163 name = "pingpong_test",
164 srcs = ["pingpong_test.cc"],
165 data = [":pingpong_config.json"],
166 deps = [
167 ":ping_lib",
168 ":pong_lib",
169 ":simulated_event_loop",
170 "//aos:configuration",
171 "//aos:flatbuffers",
172 "//aos/testing:googletest",
173 ],
174)
175
Parker Schuhe4a70d62017-12-27 20:10:20 -0800176cc_library(
Austin Schuhe4106142019-12-01 18:19:53 -0800177 name = "timing_statistics",
178 srcs = ["timing_statistics.cc"],
179 hdrs = ["timing_statistics.h"],
180 deps = [
181 ":event_loop_fbs",
182 "//aos:configuration",
183 "@com_github_google_glog//:glog",
184 ],
185)
186
187cc_test(
188 name = "timing_statistics_test",
189 srcs = ["timing_statistics_test.cc"],
190 deps = [
191 ":timing_statistics",
192 "//aos:configuration",
193 "//aos:flatbuffers",
194 "//aos/testing:googletest",
195 ],
196)
197
198cc_library(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700199 name = "shm_event_loop",
200 srcs = ["shm_event_loop.cc"],
201 hdrs = ["shm_event_loop.h"],
Austin Schuha1654ed2019-01-27 17:24:54 -0800202 visibility = ["//visibility:public"],
203 deps = [
Austin Schuh6b6dfa52019-06-12 20:16:20 -0700204 ":epoll",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700205 ":event_loop",
Austin Schuh39788ff2019-12-01 18:22:57 -0800206 ":event_loop_fbs",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700207 ":test_message_fbs",
Austin Schuh39788ff2019-12-01 18:22:57 -0800208 ":timing_statistics",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700209 "//aos:realtime",
210 "//aos/ipc_lib:lockless_queue",
211 "//aos/ipc_lib:signalfd",
Austin Schuh32fd5a72019-12-01 22:20:26 -0800212 "//aos/stl_mutex",
Austin Schuh52d325c2019-06-23 18:59:06 -0700213 "//aos/util:phased_loop",
Austin Schuha1654ed2019-01-27 17:24:54 -0800214 ],
Parker Schuhe4a70d62017-12-27 20:10:20 -0800215)
216
217cc_test(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700218 name = "shm_event_loop_test",
219 srcs = ["shm_event_loop_test.cc"],
Austin Schuh6b6dfa52019-06-12 20:16:20 -0700220 shard_count = 5,
Austin Schuha1654ed2019-01-27 17:24:54 -0800221 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700222 ":event_loop_param_test",
223 ":shm_event_loop",
224 ":test_message_fbs",
Austin Schuha1654ed2019-01-27 17:24:54 -0800225 ],
Parker Schuhe4a70d62017-12-27 20:10:20 -0800226)
227
228cc_library(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700229 name = "event_loop_param_test",
Austin Schuha1654ed2019-01-27 17:24:54 -0800230 testonly = True,
Alex Perrycb7da4b2019-08-28 19:35:56 -0700231 srcs = ["event_loop_param_test.cc"],
232 hdrs = ["event_loop_param_test.h"],
Austin Schuha1654ed2019-01-27 17:24:54 -0800233 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700234 ":event_loop",
235 ":test_message_fbs",
Austin Schuha1654ed2019-01-27 17:24:54 -0800236 "//aos/testing:googletest",
237 ],
Parker Schuhe4a70d62017-12-27 20:10:20 -0800238)
Neil Balchc8f41ed2018-01-20 22:06:53 -0800239
240cc_test(
Austin Schuh7267c532019-05-19 19:55:53 -0700241 name = "simulated_event_loop_test",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700242 srcs = ["simulated_event_loop_test.cc"],
Austin Schuha1654ed2019-01-27 17:24:54 -0800243 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700244 ":event_loop_param_test",
Austin Schuh7267c532019-05-19 19:55:53 -0700245 ":simulated_event_loop",
Austin Schuha1654ed2019-01-27 17:24:54 -0800246 "//aos/testing:googletest",
247 ],
Neil Balchc8f41ed2018-01-20 22:06:53 -0800248)
249
250cc_library(
Austin Schuh7267c532019-05-19 19:55:53 -0700251 name = "simulated_event_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700252 srcs = [
253 "event_scheduler.cc",
254 "simulated_event_loop.cc",
255 ],
256 hdrs = [
257 "event_scheduler.h",
258 "simulated_event_loop.h",
259 ],
Austin Schuh7267c532019-05-19 19:55:53 -0700260 visibility = ["//visibility:public"],
Austin Schuha1654ed2019-01-27 17:24:54 -0800261 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700262 ":event_loop",
263 "//aos/ipc_lib:index",
Austin Schuh52d325c2019-06-23 18:59:06 -0700264 "//aos/util:phased_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700265 "@com_google_absl//absl/container:btree",
Austin Schuha1654ed2019-01-27 17:24:54 -0800266 ],
Neil Balchc8f41ed2018-01-20 22:06:53 -0800267)