blob: 243e7f330905a0462d3022e3f54ce683c866663f [file] [log] [blame]
John Park33858a32018-09-28 23:05:48 -07001load("//tools:environments.bzl", "mcu_cpus")
Alex Perryd5e13572020-02-22 15:15:08 -08002load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library", "flatbuffer_py_library", "flatbuffer_ts_library")
Austin Schuh972e47e2018-12-20 17:20:58 -08003
Brian Silverman258b9172015-09-19 14:32:57 -04004filegroup(
Brian Silverman6470f442018-08-05 12:08:16 -07005 name = "prime_binaries",
6 srcs = [
Austin Schuh944df342019-12-21 17:08:55 -08007 "//aos:aos_dump",
John Park398c74a2018-10-20 21:17:39 -07008 "//aos/starter",
Tyler Chatowe6f5bef2020-10-31 14:22:04 -07009 "//aos:aos_dump_autocomplete.sh",
Brian Silverman6470f442018-08-05 12:08:16 -070010 ],
11 visibility = ["//visibility:public"],
Austin Schuh1eceeb92015-11-08 21:16:06 -080012)
Austin Schuhc80dd152016-02-29 01:47:44 -080013
14filegroup(
Brian Silverman6470f442018-08-05 12:08:16 -070015 name = "prime_start_binaries",
16 srcs = [
James Kuszmaul38735e82019-12-07 16:42:06 -080017 "//aos/events/logging:logger_main",
Brian Silverman6470f442018-08-05 12:08:16 -070018 ],
19 visibility = ["//visibility:public"],
Austin Schuhc80dd152016-02-29 01:47:44 -080020)
Brian Silverman6470f442018-08-05 12:08:16 -070021
Austin Schuhc80dd152016-02-29 01:47:44 -080022filegroup(
Brian Silverman6470f442018-08-05 12:08:16 -070023 name = "prime_binaries_stripped",
24 srcs = [
25 # starter is hard coded to look for a non-stripped core...
Austin Schuh944df342019-12-21 17:08:55 -080026 "//aos:aos_dump.stripped",
John Park398c74a2018-10-20 21:17:39 -070027 "//aos/starter",
Tyler Chatowe6f5bef2020-10-31 14:22:04 -070028 "//aos:aos_dump_autocomplete.sh",
Brian Silverman6470f442018-08-05 12:08:16 -070029 ],
30 visibility = ["//visibility:public"],
31)
32
33filegroup(
34 name = "prime_start_binaries_stripped",
35 srcs = [
James Kuszmaul38735e82019-12-07 16:42:06 -080036 "//aos/events/logging:logger_main.stripped",
Brian Silverman6470f442018-08-05 12:08:16 -070037 ],
38 visibility = ["//visibility:public"],
Austin Schuhc80dd152016-02-29 01:47:44 -080039)
Sabina Davis2ed5ea22017-09-26 22:27:42 -070040
41cc_library(
John Park33858a32018-09-28 23:05:48 -070042 name = "math",
43 hdrs = [
44 "commonmath.h",
45 ],
46 compatible_with = mcu_cpus,
47 visibility = ["//visibility:public"],
48)
49
50cc_library(
John Park33858a32018-09-28 23:05:48 -070051 name = "byteorder",
52 hdrs = [
53 "byteorder.h",
54 ],
John Park33858a32018-09-28 23:05:48 -070055 visibility = ["//visibility:public"],
56)
57
Brian Silverman6470f442018-08-05 12:08:16 -070058py_library(
59 name = "python_init",
60 srcs = ["__init__.py"],
61 visibility = ["//visibility:public"],
Sabina Davis2ed5ea22017-09-26 22:27:42 -070062)
John Park33858a32018-09-28 23:05:48 -070063
64cc_library(
Austin Schuh972e47e2018-12-20 17:20:58 -080065 name = "macros",
66 hdrs = [
John Park33858a32018-09-28 23:05:48 -070067 "macros.h",
John Park33858a32018-09-28 23:05:48 -070068 ],
Austin Schuh972e47e2018-12-20 17:20:58 -080069 compatible_with = mcu_cpus,
John Park33858a32018-09-28 23:05:48 -070070 visibility = ["//visibility:public"],
71)
72
73cc_library(
74 name = "gtest_prod",
75 hdrs = [
76 "gtest_prod.h",
77 ],
John Park33858a32018-09-28 23:05:48 -070078 visibility = ["//visibility:public"],
79)
80
81cc_library(
82 name = "network_port",
83 hdrs = [
84 "network_port.h",
85 ],
86 visibility = ["//visibility:public"],
87)
88
John Park33858a32018-09-28 23:05:48 -070089cc_library(
90 name = "unique_malloc_ptr",
91 hdrs = [
92 "unique_malloc_ptr.h",
93 ],
John Park33858a32018-09-28 23:05:48 -070094 visibility = ["//visibility:public"],
95)
96
97cc_library(
98 name = "condition",
99 srcs = [
100 "condition.cc",
101 ],
102 hdrs = [
103 "condition.h",
104 ],
John Park33858a32018-09-28 23:05:48 -0700105 visibility = ["//visibility:public"],
Austin Schuh972e47e2018-12-20 17:20:58 -0800106 deps = [
107 "//aos/ipc_lib:aos_sync",
Austin Schuh972e47e2018-12-20 17:20:58 -0800108 "//aos/mutex",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700109 "@com_github_google_glog//:glog",
Austin Schuh972e47e2018-12-20 17:20:58 -0800110 ],
John Park33858a32018-09-28 23:05:48 -0700111)
112
113cc_test(
114 name = "condition_test",
115 srcs = [
116 "condition_test.cc",
117 ],
118 deps = [
119 ":condition",
120 "//aos:die",
John Park398c74a2018-10-20 21:17:39 -0700121 "//aos/ipc_lib:aos_sync",
122 "//aos/ipc_lib:core_lib",
Austin Schuh972e47e2018-12-20 17:20:58 -0800123 "//aos/logging",
124 "//aos/mutex",
John Park33858a32018-09-28 23:05:48 -0700125 "//aos/testing:googletest",
126 "//aos/testing:prevent_exit",
127 "//aos/testing:test_shm",
Austin Schuh972e47e2018-12-20 17:20:58 -0800128 "//aos/time",
John Park33858a32018-09-28 23:05:48 -0700129 ],
130)
131
132cc_library(
133 name = "die",
134 srcs = [
135 "die.cc",
136 ],
137 hdrs = [
138 "die.h",
139 ],
Austin Schuh972e47e2018-12-20 17:20:58 -0800140 visibility = ["//visibility:public"],
John Park33858a32018-09-28 23:05:48 -0700141 deps = [
142 "//aos:macros",
143 "//aos/libc:aos_strerror",
144 ],
John Park33858a32018-09-28 23:05:48 -0700145)
146
John Park33858a32018-09-28 23:05:48 -0700147cc_test(
148 name = "die_test",
149 srcs = [
150 "die_test.cc",
151 ],
152 deps = [
153 ":die",
154 "//aos/testing:googletest",
155 ],
156)
157
158cc_library(
159 name = "event",
160 srcs = [
161 "event.cc",
162 ],
163 hdrs = [
164 "event.h",
165 ],
John Park33858a32018-09-28 23:05:48 -0700166 visibility = ["//visibility:public"],
Austin Schuh972e47e2018-12-20 17:20:58 -0800167 deps = [
168 "//aos/ipc_lib:aos_sync",
Austin Schuh972e47e2018-12-20 17:20:58 -0800169 "//aos/time",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700170 "@com_github_google_glog//:glog",
Austin Schuh972e47e2018-12-20 17:20:58 -0800171 ],
John Park33858a32018-09-28 23:05:48 -0700172)
173
174cc_test(
175 name = "event_test",
176 srcs = [
177 "event_test.cc",
Austin Schuh972e47e2018-12-20 17:20:58 -0800178 ],
John Park33858a32018-09-28 23:05:48 -0700179 deps = [
180 ":event",
John Park33858a32018-09-28 23:05:48 -0700181 "//aos/testing:googletest",
182 "//aos/testing:test_logging",
Austin Schuh972e47e2018-12-20 17:20:58 -0800183 "//aos/time",
John Park33858a32018-09-28 23:05:48 -0700184 ],
185)
John Park398c74a2018-10-20 21:17:39 -0700186
187cc_binary(
188 name = "dump_rtprio",
189 srcs = [
190 "dump_rtprio.cc",
191 ],
192 deps = [
John Park398c74a2018-10-20 21:17:39 -0700193 "//aos/logging",
194 "//aos/logging:implementations",
Austin Schuh972e47e2018-12-20 17:20:58 -0800195 "//aos/time",
John Park398c74a2018-10-20 21:17:39 -0700196 ],
197)
198
199cc_library(
John Park398c74a2018-10-20 21:17:39 -0700200 name = "complex_thread_local",
201 srcs = [
202 "complex_thread_local.cc",
203 ],
204 hdrs = [
205 "complex_thread_local.h",
206 ],
John Park398c74a2018-10-20 21:17:39 -0700207 visibility = ["//visibility:public"],
Austin Schuh972e47e2018-12-20 17:20:58 -0800208 deps = [
209 "//aos:die",
John Park65170ac2020-01-08 20:15:24 -0800210 "@com_google_absl//absl/base",
Austin Schuh972e47e2018-12-20 17:20:58 -0800211 ],
John Park398c74a2018-10-20 21:17:39 -0700212)
213
214cc_test(
215 name = "complex_thread_local_test",
216 srcs = [
217 "complex_thread_local_test.cc",
218 ],
219 deps = [
220 ":complex_thread_local",
221 "//aos/logging",
John Park398c74a2018-10-20 21:17:39 -0700222 "//aos/testing:googletest",
223 ],
224)
225
226cc_library(
227 name = "init",
228 srcs = [
229 "init.cc",
230 ],
231 hdrs = [
232 "init.h",
233 ],
Austin Schuh972e47e2018-12-20 17:20:58 -0800234 visibility = ["//visibility:public"],
John Park398c74a2018-10-20 21:17:39 -0700235 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700236 ":realtime",
John Park398c74a2018-10-20 21:17:39 -0700237 "//aos:die",
Austin Schuh972e47e2018-12-20 17:20:58 -0800238 "//aos/logging:implementations",
John Park398c74a2018-10-20 21:17:39 -0700239 ],
John Park398c74a2018-10-20 21:17:39 -0700240)
241
Alex Perrycb7da4b2019-08-28 19:35:56 -0700242cc_library(
243 name = "realtime",
244 srcs = [
245 "realtime.cc",
246 ],
247 hdrs = [
248 "realtime.h",
249 ],
250 visibility = ["//visibility:public"],
251 deps = [
Austin Schuhcc6070c2020-10-10 20:25:56 -0700252 ":thread_local",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700253 "@com_github_google_glog//:glog",
254 ],
255)
256
Austin Schuhcb108412019-10-13 16:09:54 -0700257flatbuffer_cc_library(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700258 name = "configuration_fbs",
Austin Schuhcb108412019-10-13 16:09:54 -0700259 srcs = ["configuration.fbs"],
James Kuszmaulabb77132020-08-01 19:56:16 -0700260 gen_reflections = 1,
Alex Perrycb7da4b2019-08-28 19:35:56 -0700261 visibility = ["//visibility:public"],
Austin Schuhcb108412019-10-13 16:09:54 -0700262)
263
Alex Perryd5e13572020-02-22 15:15:08 -0800264flatbuffer_ts_library(
265 name = "configuration_ts_fbs",
266 srcs = ["configuration.fbs"],
267 visibility = ["//visibility:public"],
268)
269
Brian Silverman28760272020-02-02 13:21:51 -0800270flatbuffer_py_library(
James Kuszmaul7daef362019-12-31 18:28:17 -0800271 name = "configuration_fbs_python",
272 srcs = ["configuration.fbs"],
273 namespace = "aos",
274 tables = [
275 "Configuration",
276 "Channel",
James Kuszmaul84ff3e52020-01-03 19:48:53 -0800277 "Connection",
James Kuszmaul7daef362019-12-31 18:28:17 -0800278 "Map",
279 "Node",
280 ],
281 visibility = ["//visibility:public"],
282)
283
John Park398c74a2018-10-20 21:17:39 -0700284cc_library(
285 name = "configuration",
286 srcs = [
287 "configuration.cc",
288 ],
289 hdrs = [
290 "configuration.h",
291 ],
Austin Schuh972e47e2018-12-20 17:20:58 -0800292 visibility = ["//visibility:public"],
John Park398c74a2018-10-20 21:17:39 -0700293 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700294 ":configuration_fbs",
Austin Schuhcb108412019-10-13 16:09:54 -0700295 ":flatbuffer_merge",
296 ":flatbuffers",
297 ":json_to_flatbuffer",
John Park398c74a2018-10-20 21:17:39 -0700298 "//aos:unique_malloc_ptr",
Austin Schuh217a9782019-12-21 23:02:50 -0800299 "//aos/network:team_number",
Austin Schuhcb108412019-10-13 16:09:54 -0700300 "//aos/util:file",
301 "@com_github_google_glog//:glog",
302 "@com_google_absl//absl/container:btree",
303 "@com_google_absl//absl/strings",
John Park398c74a2018-10-20 21:17:39 -0700304 ],
John Park398c74a2018-10-20 21:17:39 -0700305)
306
Brian Silvermanf819b442019-01-20 16:51:04 -0800307cc_library(
308 name = "make_unique",
309 hdrs = [
310 "make_unique.h",
311 ],
312 visibility = ["//visibility:public"],
313)
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700314
James Kuszmaulabb77132020-08-01 19:56:16 -0700315flatbuffer_ts_library(
316 name = "json_to_flatbuffer_flatbuffer_ts",
317 srcs = ["json_to_flatbuffer.fbs"],
318 visibility = ["//aos:__subpackages__"],
319)
320
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700321flatbuffer_cc_library(
322 name = "json_to_flatbuffer_flatbuffer",
323 srcs = ["json_to_flatbuffer.fbs"],
Tyler Chatow5e369a42019-11-23 11:57:31 -0800324 gen_reflections = 1,
James Kuszmaulabb77132020-08-01 19:56:16 -0700325 visibility = ["//aos:__subpackages__"],
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700326)
327
328cc_library(
Austin Schuh43c6a352019-09-30 22:22:10 -0700329 name = "flatbuffer_utils",
330 srcs = ["flatbuffer_utils.cc"],
331 hdrs = ["flatbuffer_utils.h"],
332 deps = [
333 "@com_github_google_flatbuffers//:flatbuffers",
334 ],
335)
336
337cc_library(
Austin Schuhd7e252d2019-10-06 13:51:02 -0700338 name = "json_tokenizer",
339 srcs = ["json_tokenizer.cc"],
340 hdrs = ["json_tokenizer.h"],
341 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700342 "@com_github_google_glog//:glog",
Austin Schuhd7e252d2019-10-06 13:51:02 -0700343 "@com_google_absl//absl/strings",
344 ],
345)
346
347cc_library(
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700348 name = "json_to_flatbuffer",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800349 srcs = [
350 "flatbuffer_introspection.cc",
351 "json_to_flatbuffer.cc",
352 ],
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700353 hdrs = ["json_to_flatbuffer.h"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700354 visibility = ["//visibility:public"],
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700355 deps = [
Tyler Chatowfcf16f42020-07-26 12:41:36 -0700356 ":fast_string_builder",
Austin Schuh43c6a352019-09-30 22:22:10 -0700357 ":flatbuffer_utils",
Austin Schuhe93d8642019-10-13 15:27:07 -0700358 ":flatbuffers",
Austin Schuhd7e252d2019-10-06 13:51:02 -0700359 ":json_tokenizer",
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700360 "@com_github_google_flatbuffers//:flatbuffers",
Austin Schuhe93d8642019-10-13 15:27:07 -0700361 "@com_github_google_glog//:glog",
Austin Schuhd339a9b2019-10-05 21:33:32 -0700362 "@com_google_absl//absl/strings",
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700363 ],
364)
365
366cc_test(
367 name = "json_to_flatbuffer_test",
368 srcs = [
369 "json_to_flatbuffer_test.cc",
370 ],
371 deps = [
372 ":json_to_flatbuffer",
373 ":json_to_flatbuffer_flatbuffer",
374 "//aos/testing:googletest",
375 ],
376)
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700377
Tyler Chatow5e369a42019-11-23 11:57:31 -0800378cc_test(
379 name = "flatbuffer_introspection_test",
380 srcs = [
381 "flatbuffer_introspection_test.cc",
382 ],
383 data = [
384 ":json_to_flatbuffer_flatbuffer_reflection_out",
385 ],
386 deps = [
387 ":json_to_flatbuffer",
388 ":json_to_flatbuffer_flatbuffer",
389 "//aos/testing:googletest",
390 "//aos/util:file",
391 "@com_github_google_flatbuffers//:flatbuffers",
392 ],
393)
394
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700395cc_library(
396 name = "flatbuffer_merge",
397 srcs = ["flatbuffer_merge.cc"],
398 hdrs = ["flatbuffer_merge.h"],
399 copts = ["-Wno-cast-align"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700400 visibility = ["//visibility:public"],
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700401 deps = [
402 ":flatbuffer_utils",
Austin Schuhe93d8642019-10-13 15:27:07 -0700403 ":flatbuffers",
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700404 "@com_github_google_flatbuffers//:flatbuffers",
405 ],
406)
407
408cc_test(
409 name = "flatbuffer_merge_test",
410 srcs = [
411 "flatbuffer_merge_test.cc",
412 ],
413 deps = [
414 ":flatbuffer_merge",
415 ":json_to_flatbuffer",
416 ":json_to_flatbuffer_flatbuffer",
417 "//aos/testing:googletest",
418 ],
419)
Austin Schuhe93d8642019-10-13 15:27:07 -0700420
421cc_library(
422 name = "flatbuffers",
Austin Schuh40485ed2019-10-26 21:51:44 -0700423 srcs = [
424 "flatbuffers.cc",
425 ],
Austin Schuhe93d8642019-10-13 15:27:07 -0700426 hdrs = [
427 "flatbuffers.h",
428 ],
Austin Schuh40485ed2019-10-26 21:51:44 -0700429 visibility = ["//visibility:public"],
Austin Schuhe93d8642019-10-13 15:27:07 -0700430 deps = [
James Kuszmaulad8a8082020-02-14 21:21:58 -0800431 "//aos:macros",
Brian Silverman354697a2020-09-22 21:06:32 -0700432 "//aos/containers:resizeable_buffer",
Austin Schuhe93d8642019-10-13 15:27:07 -0700433 "@com_github_google_flatbuffers//:flatbuffers",
Austin Schuh40485ed2019-10-26 21:51:44 -0700434 "@com_github_google_glog//:glog",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700435 "@com_google_absl//absl/strings",
Austin Schuh6f3babe2020-01-26 20:34:50 -0800436 "@com_google_absl//absl/types:span",
Austin Schuhe93d8642019-10-13 15:27:07 -0700437 ],
438)
Austin Schuhcb108412019-10-13 16:09:54 -0700439
440cc_test(
441 name = "configuration_test",
442 srcs = [
443 "configuration_test.cc",
444 ],
445 data = [
Austin Schuh14d7d3d2020-09-10 18:14:36 -0700446 "//aos/events:pingpong_config",
Austin Schuh6b9c4152019-11-29 12:45:24 -0800447 "//aos/events:pong.bfbs",
James Kuszmaulc0c08da2020-05-10 18:56:07 -0700448 "//aos/testdata:test_configs",
Austin Schuhcb108412019-10-13 16:09:54 -0700449 ],
450 deps = [
451 ":configuration",
452 "//aos/testing:googletest",
453 "//aos/testing:test_logging",
454 ],
455)
Alex Perrycb7da4b2019-08-28 19:35:56 -0700456
457cc_binary(
458 name = "config_flattener",
459 srcs = [
460 "config_flattener.cc",
461 ],
462 visibility = ["//visibility:public"],
463 deps = [
464 ":configuration",
465 ":init",
466 "//aos/util:file",
467 "@com_github_google_glog//:glog",
468 ],
469)
Tyler Chatow5e369a42019-11-23 11:57:31 -0800470
471cc_binary(
Austin Schuh944df342019-12-21 17:08:55 -0800472 name = "aos_dump",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800473 srcs = [
Austin Schuh944df342019-12-21 17:08:55 -0800474 "aos_dump.cc",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800475 ],
476 visibility = ["//visibility:public"],
477 deps = [
478 ":configuration",
479 ":json_to_flatbuffer",
480 "//aos:init",
481 "//aos/events:shm_event_loop",
482 "@com_github_google_glog//:glog",
483 ],
484)
Brian Silverman79ec7fc2020-06-08 20:11:22 -0500485
Jim Ostrowski17ce54d2020-10-24 17:24:01 -0700486cc_binary(
487 name = "aos_graph_nodes",
488 srcs = [
489 "aos_graph_nodes.cc",
490 ],
491 visibility = ["//visibility:public"],
492 deps = [
493 ":configuration",
494 ":json_to_flatbuffer",
495 "//aos:init",
496 "//aos/events:shm_event_loop",
497 "@com_github_google_glog//:glog",
498 ],
499)
500
Brian Silverman79ec7fc2020-06-08 20:11:22 -0500501cc_library(
502 name = "ftrace",
503 srcs = [
504 "ftrace.cc",
505 ],
506 hdrs = [
507 "ftrace.h",
508 ],
509 visibility = ["//visibility:public"],
510 deps = [
511 "@com_github_google_glog//:glog",
512 ],
513)
Tyler Chatowfcf16f42020-07-26 12:41:36 -0700514
515cc_library(
516 name = "fast_string_builder",
517 srcs = [
518 "fast_string_builder.cc",
519 ],
520 hdrs = [
521 "fast_string_builder.h",
522 ],
523 deps = [
524 "@com_github_google_glog//:glog",
525 "@com_google_absl//absl/strings",
526 "@com_google_absl//absl/strings:str_format",
527 ],
528)
Brian Silvermanb47f5552020-10-01 15:08:14 -0700529
530cc_library(
531 name = "thread_local",
532 hdrs = [
533 "thread_local.h",
534 ],
535 visibility = ["//visibility:public"],
536)
Austin Schuhcc6070c2020-10-10 20:25:56 -0700537
538cc_test(
539 name = "realtime_test",
540 srcs = [
541 "realtime_test.cc",
542 ],
543 visibility = ["//visibility:public"],
544 deps = [
545 ":realtime",
546 "//aos/testing:googletest",
547 ],
548)