blob: b9a510a1c90f4d212027227203d8b8341bafe447 [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",
Brian Silverman6470f442018-08-05 12:08:16 -07009 ],
10 visibility = ["//visibility:public"],
Austin Schuh1eceeb92015-11-08 21:16:06 -080011)
Austin Schuhc80dd152016-02-29 01:47:44 -080012
13filegroup(
Brian Silverman6470f442018-08-05 12:08:16 -070014 name = "prime_start_binaries",
15 srcs = [
James Kuszmaul38735e82019-12-07 16:42:06 -080016 "//aos/events/logging:logger_main",
Brian Silverman6470f442018-08-05 12:08:16 -070017 ],
18 visibility = ["//visibility:public"],
Austin Schuhc80dd152016-02-29 01:47:44 -080019)
Brian Silverman6470f442018-08-05 12:08:16 -070020
Austin Schuhc80dd152016-02-29 01:47:44 -080021filegroup(
Brian Silverman6470f442018-08-05 12:08:16 -070022 name = "prime_binaries_stripped",
23 srcs = [
24 # starter is hard coded to look for a non-stripped core...
Austin Schuh944df342019-12-21 17:08:55 -080025 "//aos:aos_dump.stripped",
John Park398c74a2018-10-20 21:17:39 -070026 "//aos/starter",
Brian Silverman6470f442018-08-05 12:08:16 -070027 ],
28 visibility = ["//visibility:public"],
29)
30
31filegroup(
32 name = "prime_start_binaries_stripped",
33 srcs = [
James Kuszmaul38735e82019-12-07 16:42:06 -080034 "//aos/events/logging:logger_main.stripped",
Brian Silverman6470f442018-08-05 12:08:16 -070035 ],
36 visibility = ["//visibility:public"],
Austin Schuhc80dd152016-02-29 01:47:44 -080037)
Sabina Davis2ed5ea22017-09-26 22:27:42 -070038
39cc_library(
John Park33858a32018-09-28 23:05:48 -070040 name = "math",
41 hdrs = [
42 "commonmath.h",
43 ],
44 compatible_with = mcu_cpus,
45 visibility = ["//visibility:public"],
46)
47
48cc_library(
John Park33858a32018-09-28 23:05:48 -070049 name = "byteorder",
50 hdrs = [
51 "byteorder.h",
52 ],
John Park33858a32018-09-28 23:05:48 -070053 visibility = ["//visibility:public"],
54)
55
Brian Silverman6470f442018-08-05 12:08:16 -070056py_library(
57 name = "python_init",
58 srcs = ["__init__.py"],
59 visibility = ["//visibility:public"],
Sabina Davis2ed5ea22017-09-26 22:27:42 -070060)
John Park33858a32018-09-28 23:05:48 -070061
62cc_library(
Austin Schuh972e47e2018-12-20 17:20:58 -080063 name = "macros",
64 hdrs = [
John Park33858a32018-09-28 23:05:48 -070065 "macros.h",
John Park33858a32018-09-28 23:05:48 -070066 ],
Austin Schuh972e47e2018-12-20 17:20:58 -080067 compatible_with = mcu_cpus,
John Park33858a32018-09-28 23:05:48 -070068 visibility = ["//visibility:public"],
69)
70
71cc_library(
72 name = "gtest_prod",
73 hdrs = [
74 "gtest_prod.h",
75 ],
John Park33858a32018-09-28 23:05:48 -070076 visibility = ["//visibility:public"],
77)
78
79cc_library(
80 name = "network_port",
81 hdrs = [
82 "network_port.h",
83 ],
84 visibility = ["//visibility:public"],
85)
86
John Park33858a32018-09-28 23:05:48 -070087cc_library(
88 name = "unique_malloc_ptr",
89 hdrs = [
90 "unique_malloc_ptr.h",
91 ],
John Park33858a32018-09-28 23:05:48 -070092 visibility = ["//visibility:public"],
93)
94
95cc_library(
96 name = "condition",
97 srcs = [
98 "condition.cc",
99 ],
100 hdrs = [
101 "condition.h",
102 ],
John Park33858a32018-09-28 23:05:48 -0700103 visibility = ["//visibility:public"],
Austin Schuh972e47e2018-12-20 17:20:58 -0800104 deps = [
105 "//aos/ipc_lib:aos_sync",
Austin Schuh972e47e2018-12-20 17:20:58 -0800106 "//aos/mutex",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700107 "@com_github_google_glog//:glog",
Austin Schuh972e47e2018-12-20 17:20:58 -0800108 ],
John Park33858a32018-09-28 23:05:48 -0700109)
110
111cc_test(
112 name = "condition_test",
113 srcs = [
114 "condition_test.cc",
115 ],
116 deps = [
117 ":condition",
118 "//aos:die",
John Park398c74a2018-10-20 21:17:39 -0700119 "//aos/ipc_lib:aos_sync",
120 "//aos/ipc_lib:core_lib",
Austin Schuh972e47e2018-12-20 17:20:58 -0800121 "//aos/logging",
122 "//aos/mutex",
John Park33858a32018-09-28 23:05:48 -0700123 "//aos/testing:googletest",
124 "//aos/testing:prevent_exit",
125 "//aos/testing:test_shm",
Austin Schuh972e47e2018-12-20 17:20:58 -0800126 "//aos/time",
John Park33858a32018-09-28 23:05:48 -0700127 ],
128)
129
130cc_library(
131 name = "die",
132 srcs = [
133 "die.cc",
134 ],
135 hdrs = [
136 "die.h",
137 ],
Austin Schuh972e47e2018-12-20 17:20:58 -0800138 visibility = ["//visibility:public"],
John Park33858a32018-09-28 23:05:48 -0700139 deps = [
140 "//aos:macros",
141 "//aos/libc:aos_strerror",
142 ],
John Park33858a32018-09-28 23:05:48 -0700143)
144
John Park33858a32018-09-28 23:05:48 -0700145cc_test(
146 name = "die_test",
147 srcs = [
148 "die_test.cc",
149 ],
150 deps = [
151 ":die",
152 "//aos/testing:googletest",
153 ],
154)
155
156cc_library(
157 name = "event",
158 srcs = [
159 "event.cc",
160 ],
161 hdrs = [
162 "event.h",
163 ],
John Park33858a32018-09-28 23:05:48 -0700164 visibility = ["//visibility:public"],
Austin Schuh972e47e2018-12-20 17:20:58 -0800165 deps = [
166 "//aos/ipc_lib:aos_sync",
Austin Schuh972e47e2018-12-20 17:20:58 -0800167 "//aos/time",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700168 "@com_github_google_glog//:glog",
Austin Schuh972e47e2018-12-20 17:20:58 -0800169 ],
John Park33858a32018-09-28 23:05:48 -0700170)
171
172cc_test(
173 name = "event_test",
174 srcs = [
175 "event_test.cc",
Austin Schuh972e47e2018-12-20 17:20:58 -0800176 ],
John Park33858a32018-09-28 23:05:48 -0700177 deps = [
178 ":event",
John Park33858a32018-09-28 23:05:48 -0700179 "//aos/testing:googletest",
180 "//aos/testing:test_logging",
Austin Schuh972e47e2018-12-20 17:20:58 -0800181 "//aos/time",
John Park33858a32018-09-28 23:05:48 -0700182 ],
183)
John Park398c74a2018-10-20 21:17:39 -0700184
185cc_binary(
186 name = "dump_rtprio",
187 srcs = [
188 "dump_rtprio.cc",
189 ],
190 deps = [
John Park398c74a2018-10-20 21:17:39 -0700191 "//aos/logging",
192 "//aos/logging:implementations",
Austin Schuh972e47e2018-12-20 17:20:58 -0800193 "//aos/time",
John Park398c74a2018-10-20 21:17:39 -0700194 ],
195)
196
197cc_library(
John Park398c74a2018-10-20 21:17:39 -0700198 name = "complex_thread_local",
199 srcs = [
200 "complex_thread_local.cc",
201 ],
202 hdrs = [
203 "complex_thread_local.h",
204 ],
John Park398c74a2018-10-20 21:17:39 -0700205 visibility = ["//visibility:public"],
Austin Schuh972e47e2018-12-20 17:20:58 -0800206 deps = [
207 "//aos:die",
John Park65170ac2020-01-08 20:15:24 -0800208 "@com_google_absl//absl/base",
Austin Schuh972e47e2018-12-20 17:20:58 -0800209 ],
John Park398c74a2018-10-20 21:17:39 -0700210)
211
212cc_test(
213 name = "complex_thread_local_test",
214 srcs = [
215 "complex_thread_local_test.cc",
216 ],
217 deps = [
218 ":complex_thread_local",
219 "//aos/logging",
John Park398c74a2018-10-20 21:17:39 -0700220 "//aos/testing:googletest",
221 ],
222)
223
224cc_library(
225 name = "init",
226 srcs = [
227 "init.cc",
228 ],
229 hdrs = [
230 "init.h",
231 ],
Austin Schuh972e47e2018-12-20 17:20:58 -0800232 visibility = ["//visibility:public"],
John Park398c74a2018-10-20 21:17:39 -0700233 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700234 ":realtime",
John Park398c74a2018-10-20 21:17:39 -0700235 "//aos:die",
Austin Schuh972e47e2018-12-20 17:20:58 -0800236 "//aos/logging:implementations",
John Park398c74a2018-10-20 21:17:39 -0700237 ],
John Park398c74a2018-10-20 21:17:39 -0700238)
239
Alex Perrycb7da4b2019-08-28 19:35:56 -0700240cc_library(
241 name = "realtime",
242 srcs = [
243 "realtime.cc",
244 ],
245 hdrs = [
246 "realtime.h",
247 ],
248 visibility = ["//visibility:public"],
249 deps = [
Austin Schuhcc6070c2020-10-10 20:25:56 -0700250 ":thread_local",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700251 "@com_github_google_glog//:glog",
252 ],
253)
254
Austin Schuhcb108412019-10-13 16:09:54 -0700255flatbuffer_cc_library(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700256 name = "configuration_fbs",
Austin Schuhcb108412019-10-13 16:09:54 -0700257 srcs = ["configuration.fbs"],
James Kuszmaulabb77132020-08-01 19:56:16 -0700258 gen_reflections = 1,
Alex Perrycb7da4b2019-08-28 19:35:56 -0700259 visibility = ["//visibility:public"],
Austin Schuhcb108412019-10-13 16:09:54 -0700260)
261
Alex Perryd5e13572020-02-22 15:15:08 -0800262flatbuffer_ts_library(
263 name = "configuration_ts_fbs",
264 srcs = ["configuration.fbs"],
265 visibility = ["//visibility:public"],
266)
267
Brian Silverman28760272020-02-02 13:21:51 -0800268flatbuffer_py_library(
James Kuszmaul7daef362019-12-31 18:28:17 -0800269 name = "configuration_fbs_python",
270 srcs = ["configuration.fbs"],
271 namespace = "aos",
272 tables = [
273 "Configuration",
274 "Channel",
James Kuszmaul84ff3e52020-01-03 19:48:53 -0800275 "Connection",
James Kuszmaul7daef362019-12-31 18:28:17 -0800276 "Map",
277 "Node",
278 ],
279 visibility = ["//visibility:public"],
280)
281
John Park398c74a2018-10-20 21:17:39 -0700282cc_library(
283 name = "configuration",
284 srcs = [
285 "configuration.cc",
286 ],
287 hdrs = [
288 "configuration.h",
289 ],
Austin Schuh972e47e2018-12-20 17:20:58 -0800290 visibility = ["//visibility:public"],
John Park398c74a2018-10-20 21:17:39 -0700291 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700292 ":configuration_fbs",
Austin Schuhcb108412019-10-13 16:09:54 -0700293 ":flatbuffer_merge",
294 ":flatbuffers",
295 ":json_to_flatbuffer",
John Park398c74a2018-10-20 21:17:39 -0700296 "//aos:unique_malloc_ptr",
Austin Schuh217a9782019-12-21 23:02:50 -0800297 "//aos/network:team_number",
Austin Schuhcb108412019-10-13 16:09:54 -0700298 "//aos/util:file",
299 "@com_github_google_glog//:glog",
300 "@com_google_absl//absl/container:btree",
301 "@com_google_absl//absl/strings",
John Park398c74a2018-10-20 21:17:39 -0700302 ],
John Park398c74a2018-10-20 21:17:39 -0700303)
304
Brian Silvermanf819b442019-01-20 16:51:04 -0800305cc_library(
306 name = "make_unique",
307 hdrs = [
308 "make_unique.h",
309 ],
310 visibility = ["//visibility:public"],
311)
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700312
James Kuszmaulabb77132020-08-01 19:56:16 -0700313flatbuffer_ts_library(
314 name = "json_to_flatbuffer_flatbuffer_ts",
315 srcs = ["json_to_flatbuffer.fbs"],
316 visibility = ["//aos:__subpackages__"],
317)
318
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700319flatbuffer_cc_library(
320 name = "json_to_flatbuffer_flatbuffer",
321 srcs = ["json_to_flatbuffer.fbs"],
Tyler Chatow5e369a42019-11-23 11:57:31 -0800322 gen_reflections = 1,
James Kuszmaulabb77132020-08-01 19:56:16 -0700323 visibility = ["//aos:__subpackages__"],
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700324)
325
326cc_library(
Austin Schuh43c6a352019-09-30 22:22:10 -0700327 name = "flatbuffer_utils",
328 srcs = ["flatbuffer_utils.cc"],
329 hdrs = ["flatbuffer_utils.h"],
330 deps = [
331 "@com_github_google_flatbuffers//:flatbuffers",
332 ],
333)
334
335cc_library(
Austin Schuhd7e252d2019-10-06 13:51:02 -0700336 name = "json_tokenizer",
337 srcs = ["json_tokenizer.cc"],
338 hdrs = ["json_tokenizer.h"],
339 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700340 "@com_github_google_glog//:glog",
Austin Schuhd7e252d2019-10-06 13:51:02 -0700341 "@com_google_absl//absl/strings",
342 ],
343)
344
345cc_library(
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700346 name = "json_to_flatbuffer",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800347 srcs = [
348 "flatbuffer_introspection.cc",
349 "json_to_flatbuffer.cc",
350 ],
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700351 hdrs = ["json_to_flatbuffer.h"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700352 visibility = ["//visibility:public"],
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700353 deps = [
Tyler Chatowfcf16f42020-07-26 12:41:36 -0700354 ":fast_string_builder",
Austin Schuh43c6a352019-09-30 22:22:10 -0700355 ":flatbuffer_utils",
Austin Schuhe93d8642019-10-13 15:27:07 -0700356 ":flatbuffers",
Austin Schuhd7e252d2019-10-06 13:51:02 -0700357 ":json_tokenizer",
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700358 "@com_github_google_flatbuffers//:flatbuffers",
Austin Schuhe93d8642019-10-13 15:27:07 -0700359 "@com_github_google_glog//:glog",
Austin Schuhd339a9b2019-10-05 21:33:32 -0700360 "@com_google_absl//absl/strings",
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700361 ],
362)
363
364cc_test(
365 name = "json_to_flatbuffer_test",
366 srcs = [
367 "json_to_flatbuffer_test.cc",
368 ],
369 deps = [
370 ":json_to_flatbuffer",
371 ":json_to_flatbuffer_flatbuffer",
372 "//aos/testing:googletest",
373 ],
374)
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700375
Tyler Chatow5e369a42019-11-23 11:57:31 -0800376cc_test(
377 name = "flatbuffer_introspection_test",
378 srcs = [
379 "flatbuffer_introspection_test.cc",
380 ],
381 data = [
382 ":json_to_flatbuffer_flatbuffer_reflection_out",
383 ],
384 deps = [
385 ":json_to_flatbuffer",
386 ":json_to_flatbuffer_flatbuffer",
387 "//aos/testing:googletest",
388 "//aos/util:file",
389 "@com_github_google_flatbuffers//:flatbuffers",
390 ],
391)
392
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700393cc_library(
394 name = "flatbuffer_merge",
395 srcs = ["flatbuffer_merge.cc"],
396 hdrs = ["flatbuffer_merge.h"],
397 copts = ["-Wno-cast-align"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700398 visibility = ["//visibility:public"],
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700399 deps = [
400 ":flatbuffer_utils",
Austin Schuhe93d8642019-10-13 15:27:07 -0700401 ":flatbuffers",
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700402 "@com_github_google_flatbuffers//:flatbuffers",
403 ],
404)
405
406cc_test(
407 name = "flatbuffer_merge_test",
408 srcs = [
409 "flatbuffer_merge_test.cc",
410 ],
411 deps = [
412 ":flatbuffer_merge",
413 ":json_to_flatbuffer",
414 ":json_to_flatbuffer_flatbuffer",
415 "//aos/testing:googletest",
416 ],
417)
Austin Schuhe93d8642019-10-13 15:27:07 -0700418
419cc_library(
420 name = "flatbuffers",
Austin Schuh40485ed2019-10-26 21:51:44 -0700421 srcs = [
422 "flatbuffers.cc",
423 ],
Austin Schuhe93d8642019-10-13 15:27:07 -0700424 hdrs = [
425 "flatbuffers.h",
426 ],
Austin Schuh40485ed2019-10-26 21:51:44 -0700427 visibility = ["//visibility:public"],
Austin Schuhe93d8642019-10-13 15:27:07 -0700428 deps = [
James Kuszmaulad8a8082020-02-14 21:21:58 -0800429 "//aos:macros",
Brian Silverman354697a2020-09-22 21:06:32 -0700430 "//aos/containers:resizeable_buffer",
Austin Schuhe93d8642019-10-13 15:27:07 -0700431 "@com_github_google_flatbuffers//:flatbuffers",
Austin Schuh40485ed2019-10-26 21:51:44 -0700432 "@com_github_google_glog//:glog",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700433 "@com_google_absl//absl/strings",
Austin Schuh6f3babe2020-01-26 20:34:50 -0800434 "@com_google_absl//absl/types:span",
Austin Schuhe93d8642019-10-13 15:27:07 -0700435 ],
436)
Austin Schuhcb108412019-10-13 16:09:54 -0700437
438cc_test(
439 name = "configuration_test",
440 srcs = [
441 "configuration_test.cc",
442 ],
443 data = [
Austin Schuh14d7d3d2020-09-10 18:14:36 -0700444 "//aos/events:pingpong_config",
Austin Schuh6b9c4152019-11-29 12:45:24 -0800445 "//aos/events:pong.bfbs",
James Kuszmaulc0c08da2020-05-10 18:56:07 -0700446 "//aos/testdata:test_configs",
Austin Schuhcb108412019-10-13 16:09:54 -0700447 ],
448 deps = [
449 ":configuration",
450 "//aos/testing:googletest",
451 "//aos/testing:test_logging",
452 ],
453)
Alex Perrycb7da4b2019-08-28 19:35:56 -0700454
455cc_binary(
456 name = "config_flattener",
457 srcs = [
458 "config_flattener.cc",
459 ],
460 visibility = ["//visibility:public"],
461 deps = [
462 ":configuration",
463 ":init",
464 "//aos/util:file",
465 "@com_github_google_glog//:glog",
466 ],
467)
Tyler Chatow5e369a42019-11-23 11:57:31 -0800468
469cc_binary(
Austin Schuh944df342019-12-21 17:08:55 -0800470 name = "aos_dump",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800471 srcs = [
Austin Schuh944df342019-12-21 17:08:55 -0800472 "aos_dump.cc",
Tyler Chatow5e369a42019-11-23 11:57:31 -0800473 ],
474 visibility = ["//visibility:public"],
475 deps = [
476 ":configuration",
477 ":json_to_flatbuffer",
478 "//aos:init",
479 "//aos/events:shm_event_loop",
480 "@com_github_google_glog//:glog",
481 ],
482)
Brian Silverman79ec7fc2020-06-08 20:11:22 -0500483
484cc_library(
485 name = "ftrace",
486 srcs = [
487 "ftrace.cc",
488 ],
489 hdrs = [
490 "ftrace.h",
491 ],
492 visibility = ["//visibility:public"],
493 deps = [
494 "@com_github_google_glog//:glog",
495 ],
496)
Tyler Chatowfcf16f42020-07-26 12:41:36 -0700497
498cc_library(
499 name = "fast_string_builder",
500 srcs = [
501 "fast_string_builder.cc",
502 ],
503 hdrs = [
504 "fast_string_builder.h",
505 ],
506 deps = [
507 "@com_github_google_glog//:glog",
508 "@com_google_absl//absl/strings",
509 "@com_google_absl//absl/strings:str_format",
510 ],
511)
Brian Silvermanb47f5552020-10-01 15:08:14 -0700512
513cc_library(
514 name = "thread_local",
515 hdrs = [
516 "thread_local.h",
517 ],
518 visibility = ["//visibility:public"],
519)
Austin Schuhcc6070c2020-10-10 20:25:56 -0700520
521cc_test(
522 name = "realtime_test",
523 srcs = [
524 "realtime_test.cc",
525 ],
526 visibility = ["//visibility:public"],
527 deps = [
528 ":realtime",
529 "//aos/testing:googletest",
530 ],
531)