blob: 2761cbff33897bb0fbadde9308a57e0964c1b638 [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",
Tyler Chatowe6f5bef2020-10-31 14:22:04 -07008 "//aos:aos_dump_autocomplete.sh",
Austin Schuh91d8d062020-11-02 17:11:13 -08009 "//aos/starter",
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",
Austin Schuh91d8d062020-11-02 17:11:13 -0800170 "//aos/type_traits",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700171 "@com_github_google_glog//:glog",
Austin Schuh972e47e2018-12-20 17:20:58 -0800172 ],
John Park33858a32018-09-28 23:05:48 -0700173)
174
175cc_test(
176 name = "event_test",
177 srcs = [
178 "event_test.cc",
Austin Schuh972e47e2018-12-20 17:20:58 -0800179 ],
John Park33858a32018-09-28 23:05:48 -0700180 deps = [
181 ":event",
John Park33858a32018-09-28 23:05:48 -0700182 "//aos/testing:googletest",
183 "//aos/testing:test_logging",
Austin Schuh972e47e2018-12-20 17:20:58 -0800184 "//aos/time",
John Park33858a32018-09-28 23:05:48 -0700185 ],
186)
John Park398c74a2018-10-20 21:17:39 -0700187
188cc_binary(
189 name = "dump_rtprio",
190 srcs = [
191 "dump_rtprio.cc",
192 ],
193 deps = [
John Park398c74a2018-10-20 21:17:39 -0700194 "//aos/logging",
195 "//aos/logging:implementations",
Austin Schuh972e47e2018-12-20 17:20:58 -0800196 "//aos/time",
John Park398c74a2018-10-20 21:17:39 -0700197 ],
198)
199
200cc_library(
John Park398c74a2018-10-20 21:17:39 -0700201 name = "complex_thread_local",
202 srcs = [
203 "complex_thread_local.cc",
204 ],
205 hdrs = [
206 "complex_thread_local.h",
207 ],
John Park398c74a2018-10-20 21:17:39 -0700208 visibility = ["//visibility:public"],
Austin Schuh972e47e2018-12-20 17:20:58 -0800209 deps = [
210 "//aos:die",
John Park65170ac2020-01-08 20:15:24 -0800211 "@com_google_absl//absl/base",
Austin Schuh972e47e2018-12-20 17:20:58 -0800212 ],
John Park398c74a2018-10-20 21:17:39 -0700213)
214
215cc_test(
216 name = "complex_thread_local_test",
217 srcs = [
218 "complex_thread_local_test.cc",
219 ],
220 deps = [
221 ":complex_thread_local",
222 "//aos/logging",
John Park398c74a2018-10-20 21:17:39 -0700223 "//aos/testing:googletest",
224 ],
225)
226
227cc_library(
228 name = "init",
229 srcs = [
230 "init.cc",
231 ],
232 hdrs = [
233 "init.h",
234 ],
Austin Schuh972e47e2018-12-20 17:20:58 -0800235 visibility = ["//visibility:public"],
John Park398c74a2018-10-20 21:17:39 -0700236 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700237 ":realtime",
John Park398c74a2018-10-20 21:17:39 -0700238 "//aos:die",
Austin Schuh972e47e2018-12-20 17:20:58 -0800239 "//aos/logging:implementations",
John Park398c74a2018-10-20 21:17:39 -0700240 ],
John Park398c74a2018-10-20 21:17:39 -0700241)
242
Alex Perrycb7da4b2019-08-28 19:35:56 -0700243cc_library(
244 name = "realtime",
245 srcs = [
246 "realtime.cc",
247 ],
248 hdrs = [
249 "realtime.h",
250 ],
251 visibility = ["//visibility:public"],
252 deps = [
Austin Schuhcc6070c2020-10-10 20:25:56 -0700253 ":thread_local",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700254 "@com_github_google_glog//:glog",
255 ],
256)
257
Austin Schuhcb108412019-10-13 16:09:54 -0700258flatbuffer_cc_library(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700259 name = "configuration_fbs",
Austin Schuhcb108412019-10-13 16:09:54 -0700260 srcs = ["configuration.fbs"],
James Kuszmaulabb77132020-08-01 19:56:16 -0700261 gen_reflections = 1,
Alex Perrycb7da4b2019-08-28 19:35:56 -0700262 visibility = ["//visibility:public"],
Austin Schuhcb108412019-10-13 16:09:54 -0700263)
264
Alex Perryd5e13572020-02-22 15:15:08 -0800265flatbuffer_ts_library(
266 name = "configuration_ts_fbs",
267 srcs = ["configuration.fbs"],
268 visibility = ["//visibility:public"],
269)
270
Brian Silverman28760272020-02-02 13:21:51 -0800271flatbuffer_py_library(
James Kuszmaul7daef362019-12-31 18:28:17 -0800272 name = "configuration_fbs_python",
273 srcs = ["configuration.fbs"],
274 namespace = "aos",
275 tables = [
276 "Configuration",
277 "Channel",
James Kuszmaul84ff3e52020-01-03 19:48:53 -0800278 "Connection",
James Kuszmaul7daef362019-12-31 18:28:17 -0800279 "Map",
280 "Node",
281 ],
282 visibility = ["//visibility:public"],
283)
284
John Park398c74a2018-10-20 21:17:39 -0700285cc_library(
286 name = "configuration",
287 srcs = [
288 "configuration.cc",
289 ],
290 hdrs = [
291 "configuration.h",
292 ],
Austin Schuh972e47e2018-12-20 17:20:58 -0800293 visibility = ["//visibility:public"],
John Park398c74a2018-10-20 21:17:39 -0700294 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700295 ":configuration_fbs",
Austin Schuhcb108412019-10-13 16:09:54 -0700296 ":flatbuffer_merge",
297 ":flatbuffers",
298 ":json_to_flatbuffer",
John Park398c74a2018-10-20 21:17:39 -0700299 "//aos:unique_malloc_ptr",
Austin Schuh217a9782019-12-21 23:02:50 -0800300 "//aos/network:team_number",
Austin Schuhcb108412019-10-13 16:09:54 -0700301 "//aos/util:file",
302 "@com_github_google_glog//:glog",
303 "@com_google_absl//absl/container:btree",
304 "@com_google_absl//absl/strings",
John Park398c74a2018-10-20 21:17:39 -0700305 ],
John Park398c74a2018-10-20 21:17:39 -0700306)
307
Brian Silvermanf819b442019-01-20 16:51:04 -0800308cc_library(
309 name = "make_unique",
310 hdrs = [
311 "make_unique.h",
312 ],
313 visibility = ["//visibility:public"],
314)
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700315
James Kuszmaulabb77132020-08-01 19:56:16 -0700316flatbuffer_ts_library(
317 name = "json_to_flatbuffer_flatbuffer_ts",
318 srcs = ["json_to_flatbuffer.fbs"],
319 visibility = ["//aos:__subpackages__"],
320)
321
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700322flatbuffer_cc_library(
323 name = "json_to_flatbuffer_flatbuffer",
324 srcs = ["json_to_flatbuffer.fbs"],
Tyler Chatow5e369a42019-11-23 11:57:31 -0800325 gen_reflections = 1,
James Kuszmaulabb77132020-08-01 19:56:16 -0700326 visibility = ["//aos:__subpackages__"],
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700327)
328
329cc_library(
Austin Schuh43c6a352019-09-30 22:22:10 -0700330 name = "flatbuffer_utils",
331 srcs = ["flatbuffer_utils.cc"],
332 hdrs = ["flatbuffer_utils.h"],
333 deps = [
334 "@com_github_google_flatbuffers//:flatbuffers",
335 ],
336)
337
338cc_library(
Austin Schuhd7e252d2019-10-06 13:51:02 -0700339 name = "json_tokenizer",
340 srcs = ["json_tokenizer.cc"],
341 hdrs = ["json_tokenizer.h"],
342 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700343 "@com_github_google_glog//:glog",
Austin Schuhd7e252d2019-10-06 13:51:02 -0700344 "@com_google_absl//absl/strings",
345 ],
346)
347
348cc_library(
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700349 name = "json_to_flatbuffer",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800350 srcs = [
351 "flatbuffer_introspection.cc",
352 "json_to_flatbuffer.cc",
353 ],
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700354 hdrs = ["json_to_flatbuffer.h"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700355 visibility = ["//visibility:public"],
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700356 deps = [
Tyler Chatowfcf16f42020-07-26 12:41:36 -0700357 ":fast_string_builder",
Austin Schuh43c6a352019-09-30 22:22:10 -0700358 ":flatbuffer_utils",
Austin Schuhe93d8642019-10-13 15:27:07 -0700359 ":flatbuffers",
Austin Schuhd7e252d2019-10-06 13:51:02 -0700360 ":json_tokenizer",
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700361 "@com_github_google_flatbuffers//:flatbuffers",
Austin Schuhe93d8642019-10-13 15:27:07 -0700362 "@com_github_google_glog//:glog",
Austin Schuhd339a9b2019-10-05 21:33:32 -0700363 "@com_google_absl//absl/strings",
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700364 ],
365)
366
367cc_test(
368 name = "json_to_flatbuffer_test",
369 srcs = [
370 "json_to_flatbuffer_test.cc",
371 ],
372 deps = [
373 ":json_to_flatbuffer",
374 ":json_to_flatbuffer_flatbuffer",
375 "//aos/testing:googletest",
376 ],
377)
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700378
Tyler Chatow5e369a42019-11-23 11:57:31 -0800379cc_test(
380 name = "flatbuffer_introspection_test",
381 srcs = [
382 "flatbuffer_introspection_test.cc",
383 ],
384 data = [
385 ":json_to_flatbuffer_flatbuffer_reflection_out",
386 ],
387 deps = [
388 ":json_to_flatbuffer",
389 ":json_to_flatbuffer_flatbuffer",
390 "//aos/testing:googletest",
391 "//aos/util:file",
392 "@com_github_google_flatbuffers//:flatbuffers",
393 ],
394)
395
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700396cc_library(
397 name = "flatbuffer_merge",
398 srcs = ["flatbuffer_merge.cc"],
399 hdrs = ["flatbuffer_merge.h"],
400 copts = ["-Wno-cast-align"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700401 visibility = ["//visibility:public"],
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700402 deps = [
403 ":flatbuffer_utils",
Austin Schuhe93d8642019-10-13 15:27:07 -0700404 ":flatbuffers",
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700405 "@com_github_google_flatbuffers//:flatbuffers",
406 ],
407)
408
409cc_test(
410 name = "flatbuffer_merge_test",
411 srcs = [
412 "flatbuffer_merge_test.cc",
413 ],
414 deps = [
415 ":flatbuffer_merge",
416 ":json_to_flatbuffer",
417 ":json_to_flatbuffer_flatbuffer",
418 "//aos/testing:googletest",
419 ],
420)
Austin Schuhe93d8642019-10-13 15:27:07 -0700421
422cc_library(
423 name = "flatbuffers",
Austin Schuh40485ed2019-10-26 21:51:44 -0700424 srcs = [
425 "flatbuffers.cc",
426 ],
Austin Schuhe93d8642019-10-13 15:27:07 -0700427 hdrs = [
428 "flatbuffers.h",
429 ],
Austin Schuh40485ed2019-10-26 21:51:44 -0700430 visibility = ["//visibility:public"],
Austin Schuhe93d8642019-10-13 15:27:07 -0700431 deps = [
James Kuszmaulad8a8082020-02-14 21:21:58 -0800432 "//aos:macros",
Brian Silverman354697a2020-09-22 21:06:32 -0700433 "//aos/containers:resizeable_buffer",
Austin Schuhe93d8642019-10-13 15:27:07 -0700434 "@com_github_google_flatbuffers//:flatbuffers",
Austin Schuh40485ed2019-10-26 21:51:44 -0700435 "@com_github_google_glog//:glog",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700436 "@com_google_absl//absl/strings",
Austin Schuh6f3babe2020-01-26 20:34:50 -0800437 "@com_google_absl//absl/types:span",
Austin Schuhe93d8642019-10-13 15:27:07 -0700438 ],
439)
Austin Schuhcb108412019-10-13 16:09:54 -0700440
441cc_test(
442 name = "configuration_test",
443 srcs = [
444 "configuration_test.cc",
445 ],
446 data = [
Austin Schuh14d7d3d2020-09-10 18:14:36 -0700447 "//aos/events:pingpong_config",
Austin Schuh6b9c4152019-11-29 12:45:24 -0800448 "//aos/events:pong.bfbs",
James Kuszmaulc0c08da2020-05-10 18:56:07 -0700449 "//aos/testdata:test_configs",
Austin Schuhcb108412019-10-13 16:09:54 -0700450 ],
451 deps = [
452 ":configuration",
453 "//aos/testing:googletest",
454 "//aos/testing:test_logging",
455 ],
456)
Alex Perrycb7da4b2019-08-28 19:35:56 -0700457
458cc_binary(
459 name = "config_flattener",
460 srcs = [
461 "config_flattener.cc",
462 ],
463 visibility = ["//visibility:public"],
464 deps = [
465 ":configuration",
466 ":init",
467 "//aos/util:file",
468 "@com_github_google_glog//:glog",
469 ],
470)
Tyler Chatow5e369a42019-11-23 11:57:31 -0800471
472cc_binary(
Austin Schuh944df342019-12-21 17:08:55 -0800473 name = "aos_dump",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800474 srcs = [
Austin Schuh944df342019-12-21 17:08:55 -0800475 "aos_dump.cc",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800476 ],
477 visibility = ["//visibility:public"],
478 deps = [
479 ":configuration",
480 ":json_to_flatbuffer",
481 "//aos:init",
482 "//aos/events:shm_event_loop",
483 "@com_github_google_glog//:glog",
484 ],
485)
Brian Silverman79ec7fc2020-06-08 20:11:22 -0500486
Jim Ostrowski17ce54d2020-10-24 17:24:01 -0700487cc_binary(
488 name = "aos_graph_nodes",
489 srcs = [
490 "aos_graph_nodes.cc",
491 ],
492 visibility = ["//visibility:public"],
493 deps = [
494 ":configuration",
495 ":json_to_flatbuffer",
496 "//aos:init",
497 "//aos/events:shm_event_loop",
498 "@com_github_google_glog//:glog",
499 ],
500)
501
Brian Silverman79ec7fc2020-06-08 20:11:22 -0500502cc_library(
503 name = "ftrace",
504 srcs = [
505 "ftrace.cc",
506 ],
507 hdrs = [
508 "ftrace.h",
509 ],
510 visibility = ["//visibility:public"],
511 deps = [
512 "@com_github_google_glog//:glog",
513 ],
514)
Tyler Chatowfcf16f42020-07-26 12:41:36 -0700515
516cc_library(
517 name = "fast_string_builder",
518 srcs = [
519 "fast_string_builder.cc",
520 ],
521 hdrs = [
522 "fast_string_builder.h",
523 ],
524 deps = [
525 "@com_github_google_glog//:glog",
526 "@com_google_absl//absl/strings",
527 "@com_google_absl//absl/strings:str_format",
528 ],
529)
Brian Silvermanb47f5552020-10-01 15:08:14 -0700530
531cc_library(
532 name = "thread_local",
533 hdrs = [
534 "thread_local.h",
535 ],
536 visibility = ["//visibility:public"],
537)
Austin Schuhcc6070c2020-10-10 20:25:56 -0700538
539cc_test(
540 name = "realtime_test",
541 srcs = [
542 "realtime_test.cc",
543 ],
544 visibility = ["//visibility:public"],
545 deps = [
546 ":realtime",
547 "//aos/testing:googletest",
548 ],
549)