blob: c73336e383cf8356f8728fe41654ac348253966a [file] [log] [blame]
John Park33858a32018-09-28 23:05:48 -07001load("//tools:environments.bzl", "mcu_cpus")
Austin Schuh3e95e5d2019-09-20 00:08:54 -07002load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
John Park33858a32018-09-28 23:05:48 -07003load("//aos/build:queues.bzl", "queue_library")
Austin Schuh972e47e2018-12-20 17:20:58 -08004
Brian Silverman258b9172015-09-19 14:32:57 -04005filegroup(
Brian Silverman6470f442018-08-05 12:08:16 -07006 name = "prime_binaries",
7 srcs = [
Austin Schuh972e47e2018-12-20 17:20:58 -08008 "//aos:core",
John Park33858a32018-09-28 23:05:48 -07009 "//aos/logging:log_displayer",
10 "//aos/logging:log_streamer",
John Park398c74a2018-10-20 21:17:39 -070011 "//aos/starter",
Brian Silverman6470f442018-08-05 12:08:16 -070012 ],
13 visibility = ["//visibility:public"],
Austin Schuh1eceeb92015-11-08 21:16:06 -080014)
Austin Schuhc80dd152016-02-29 01:47:44 -080015
16filegroup(
Brian Silverman6470f442018-08-05 12:08:16 -070017 name = "prime_start_binaries",
18 srcs = [
John Park33858a32018-09-28 23:05:48 -070019 "//aos/logging:binary_log_writer",
Brian Silverman6470f442018-08-05 12:08:16 -070020 ],
21 visibility = ["//visibility:public"],
Austin Schuhc80dd152016-02-29 01:47:44 -080022)
Brian Silverman6470f442018-08-05 12:08:16 -070023
Austin Schuhc80dd152016-02-29 01:47:44 -080024filegroup(
Brian Silverman6470f442018-08-05 12:08:16 -070025 name = "prime_binaries_stripped",
26 srcs = [
27 # starter is hard coded to look for a non-stripped core...
John Park398c74a2018-10-20 21:17:39 -070028 "//aos:core",
John Park33858a32018-09-28 23:05:48 -070029 "//aos/logging:log_streamer.stripped",
30 "//aos/logging:log_displayer.stripped",
John Park398c74a2018-10-20 21:17:39 -070031 "//aos/starter",
Brian Silverman6470f442018-08-05 12:08:16 -070032 ],
33 visibility = ["//visibility:public"],
34)
35
36filegroup(
37 name = "prime_start_binaries_stripped",
38 srcs = [
John Park33858a32018-09-28 23:05:48 -070039 "//aos/logging:binary_log_writer.stripped",
Brian Silverman6470f442018-08-05 12:08:16 -070040 ],
41 visibility = ["//visibility:public"],
Austin Schuhc80dd152016-02-29 01:47:44 -080042)
Sabina Davis2ed5ea22017-09-26 22:27:42 -070043
44cc_library(
John Park33858a32018-09-28 23:05:48 -070045 name = "math",
46 hdrs = [
47 "commonmath.h",
48 ],
49 compatible_with = mcu_cpus,
50 visibility = ["//visibility:public"],
51)
52
53cc_library(
Brian Silverman6470f442018-08-05 12:08:16 -070054 name = "once",
55 srcs = [
56 "once-tmpl.h",
57 ],
58 hdrs = [
59 "once.h",
60 ],
61 visibility = ["//visibility:public"],
62 deps = [
John Park33858a32018-09-28 23:05:48 -070063 "//aos:gtest_prod",
Austin Schuh972e47e2018-12-20 17:20:58 -080064 "//aos/type_traits",
Brian Silverman6470f442018-08-05 12:08:16 -070065 ],
Sabina Davis2ed5ea22017-09-26 22:27:42 -070066)
Brian Silverman6470f442018-08-05 12:08:16 -070067
John Park33858a32018-09-28 23:05:48 -070068cc_library(
69 name = "byteorder",
70 hdrs = [
71 "byteorder.h",
72 ],
John Park33858a32018-09-28 23:05:48 -070073 visibility = ["//visibility:public"],
74)
75
Sabina Davis2ed5ea22017-09-26 22:27:42 -070076cc_test(
Brian Silverman6470f442018-08-05 12:08:16 -070077 name = "once_test",
78 srcs = [
79 "once_test.cc",
80 ],
81 visibility = ["//visibility:public"],
82 deps = [
83 "//aos:once",
84 "//aos/testing:googletest",
85 ],
86)
87
88py_library(
89 name = "python_init",
90 srcs = ["__init__.py"],
91 visibility = ["//visibility:public"],
Sabina Davis2ed5ea22017-09-26 22:27:42 -070092)
John Park33858a32018-09-28 23:05:48 -070093
94cc_library(
Austin Schuh972e47e2018-12-20 17:20:58 -080095 name = "macros",
96 hdrs = [
John Park33858a32018-09-28 23:05:48 -070097 "macros.h",
John Park33858a32018-09-28 23:05:48 -070098 ],
Austin Schuh972e47e2018-12-20 17:20:58 -080099 compatible_with = mcu_cpus,
John Park33858a32018-09-28 23:05:48 -0700100 visibility = ["//visibility:public"],
101)
102
103cc_library(
104 name = "gtest_prod",
105 hdrs = [
106 "gtest_prod.h",
107 ],
John Park33858a32018-09-28 23:05:48 -0700108 visibility = ["//visibility:public"],
109)
110
111cc_library(
112 name = "network_port",
113 hdrs = [
114 "network_port.h",
115 ],
116 visibility = ["//visibility:public"],
117)
118
119genrule(
120 name = "gen_print_field",
121 outs = ["print_field.cc"],
122 cmd = "$(location //aos/build/queues:print_field) $@",
John Park33858a32018-09-28 23:05:48 -0700123 tools = ["//aos/build/queues:print_field"],
124 visibility = ["//visibility:private"],
125)
126
127cc_library(
128 name = "queue_types",
129 srcs = [
130 "print_field_helpers.h",
131 "queue_types.cc",
132 ":gen_print_field",
133 ],
134 hdrs = [
135 "queue_types.h",
136 ],
Austin Schuh972e47e2018-12-20 17:20:58 -0800137 visibility = ["//visibility:public"],
John Park33858a32018-09-28 23:05:48 -0700138 deps = [
John Park33858a32018-09-28 23:05:48 -0700139 ":generated_queue_headers",
Austin Schuh972e47e2018-12-20 17:20:58 -0800140 "//aos:byteorder",
John Park398c74a2018-10-20 21:17:39 -0700141 "//aos/ipc_lib:core_lib",
142 "//aos/ipc_lib:shared_mem",
Austin Schuh972e47e2018-12-20 17:20:58 -0800143 "//aos/logging:printf_formats",
144 "//aos/mutex",
145 "//aos/time",
John Park33858a32018-09-28 23:05:48 -0700146 ],
John Park33858a32018-09-28 23:05:48 -0700147)
148
149cc_test(
150 name = "queue_types_test",
151 srcs = [
152 "queue_types_test.cc",
153 ],
154 deps = [
155 ":queue_types",
156 ":test_queue",
157 "//aos/logging",
158 "//aos/testing:googletest",
159 "//aos/testing:test_logging",
160 ],
161)
162
163cc_library(
164 name = "queues",
165 hdrs = [
166 "queue.h",
167 ],
Austin Schuh972e47e2018-12-20 17:20:58 -0800168 visibility = ["//visibility:public"],
John Park33858a32018-09-28 23:05:48 -0700169 deps = [
John Park398c74a2018-10-20 21:17:39 -0700170 "//aos:queue",
171 "//aos/ipc_lib:queue",
Austin Schuh972e47e2018-12-20 17:20:58 -0800172 "//aos/messages",
John Park33858a32018-09-28 23:05:48 -0700173 ],
John Park33858a32018-09-28 23:05:48 -0700174)
175
176queue_library(
177 name = "test_queue",
178 srcs = [
179 "test_queue.q",
180 ],
181)
182
183genrule(
184 name = "gen_queue_primitives",
185 outs = ["queue_primitives.h"],
186 cmd = "$(location //aos/build/queues:queue_primitives) $@",
John Park33858a32018-09-28 23:05:48 -0700187 tools = ["//aos/build/queues:queue_primitives"],
188 visibility = ["//visibility:private"],
189)
190
191cc_library(
192 name = "generated_queue_headers",
193 hdrs = [
194 ":gen_queue_primitives",
195 ],
John Park33858a32018-09-28 23:05:48 -0700196 visibility = ["//aos/logging:__pkg__"],
197)
198
199cc_test(
200 name = "queue_test",
201 srcs = [
202 "queue_test.cc",
203 ],
204 deps = [
John Park33858a32018-09-28 23:05:48 -0700205 ":test_queue",
Austin Schuh972e47e2018-12-20 17:20:58 -0800206 "//aos:die",
John Park33858a32018-09-28 23:05:48 -0700207 "//aos/testing:googletest",
208 "//aos/testing:test_shm",
Austin Schuh972e47e2018-12-20 17:20:58 -0800209 "//aos/util:thread",
John Park33858a32018-09-28 23:05:48 -0700210 ],
211)
212
213cc_library(
214 name = "unique_malloc_ptr",
215 hdrs = [
216 "unique_malloc_ptr.h",
217 ],
John Park33858a32018-09-28 23:05:48 -0700218 visibility = ["//visibility:public"],
219)
220
221cc_library(
222 name = "condition",
223 srcs = [
224 "condition.cc",
225 ],
226 hdrs = [
227 "condition.h",
228 ],
John Park33858a32018-09-28 23:05:48 -0700229 visibility = ["//visibility:public"],
Austin Schuh972e47e2018-12-20 17:20:58 -0800230 deps = [
231 "//aos/ipc_lib:aos_sync",
232 "//aos/logging",
233 "//aos/mutex",
234 ],
John Park33858a32018-09-28 23:05:48 -0700235)
236
237cc_test(
238 name = "condition_test",
239 srcs = [
240 "condition_test.cc",
241 ],
242 deps = [
243 ":condition",
244 "//aos:die",
John Park398c74a2018-10-20 21:17:39 -0700245 "//aos/ipc_lib:aos_sync",
246 "//aos/ipc_lib:core_lib",
Austin Schuh972e47e2018-12-20 17:20:58 -0800247 "//aos/logging",
248 "//aos/mutex",
John Park33858a32018-09-28 23:05:48 -0700249 "//aos/testing:googletest",
250 "//aos/testing:prevent_exit",
251 "//aos/testing:test_shm",
Austin Schuh972e47e2018-12-20 17:20:58 -0800252 "//aos/time",
253 "//aos/util:thread",
John Park33858a32018-09-28 23:05:48 -0700254 ],
255)
256
257cc_library(
258 name = "die",
259 srcs = [
260 "die.cc",
261 ],
262 hdrs = [
263 "die.h",
264 ],
Austin Schuh972e47e2018-12-20 17:20:58 -0800265 visibility = ["//visibility:public"],
John Park33858a32018-09-28 23:05:48 -0700266 deps = [
267 "//aos:macros",
268 "//aos/libc:aos_strerror",
269 ],
John Park33858a32018-09-28 23:05:48 -0700270)
271
John Park33858a32018-09-28 23:05:48 -0700272cc_test(
273 name = "die_test",
274 srcs = [
275 "die_test.cc",
276 ],
277 deps = [
278 ":die",
279 "//aos/testing:googletest",
280 ],
281)
282
283cc_library(
284 name = "event",
285 srcs = [
286 "event.cc",
287 ],
288 hdrs = [
289 "event.h",
290 ],
John Park33858a32018-09-28 23:05:48 -0700291 visibility = ["//visibility:public"],
Austin Schuh972e47e2018-12-20 17:20:58 -0800292 deps = [
293 "//aos/ipc_lib:aos_sync",
294 "//aos/logging",
295 "//aos/time",
296 ],
John Park33858a32018-09-28 23:05:48 -0700297)
298
299cc_test(
300 name = "event_test",
301 srcs = [
302 "event_test.cc",
Austin Schuh972e47e2018-12-20 17:20:58 -0800303 ],
John Park33858a32018-09-28 23:05:48 -0700304 deps = [
305 ":event",
John Park33858a32018-09-28 23:05:48 -0700306 "//aos/testing:googletest",
307 "//aos/testing:test_logging",
Austin Schuh972e47e2018-12-20 17:20:58 -0800308 "//aos/time",
John Park33858a32018-09-28 23:05:48 -0700309 ],
310)
John Park398c74a2018-10-20 21:17:39 -0700311
312cc_binary(
313 name = "dump_rtprio",
314 srcs = [
315 "dump_rtprio.cc",
316 ],
317 deps = [
John Park398c74a2018-10-20 21:17:39 -0700318 "//aos/logging",
319 "//aos/logging:implementations",
Austin Schuh972e47e2018-12-20 17:20:58 -0800320 "//aos/time",
John Park398c74a2018-10-20 21:17:39 -0700321 ],
322)
323
324cc_library(
325 name = "queue",
326 hdrs = [
327 "queue-tmpl.h",
328 ],
John Park398c74a2018-10-20 21:17:39 -0700329 visibility = ["//aos:__pkg__"],
330)
331
332cc_library(
333 name = "complex_thread_local",
334 srcs = [
335 "complex_thread_local.cc",
336 ],
337 hdrs = [
338 "complex_thread_local.h",
339 ],
John Park398c74a2018-10-20 21:17:39 -0700340 linkopts = [
341 "-lpthread",
342 ],
John Park398c74a2018-10-20 21:17:39 -0700343 visibility = ["//visibility:public"],
Austin Schuh972e47e2018-12-20 17:20:58 -0800344 deps = [
345 "//aos:die",
346 "//aos:once",
347 ],
John Park398c74a2018-10-20 21:17:39 -0700348)
349
350cc_test(
351 name = "complex_thread_local_test",
352 srcs = [
353 "complex_thread_local_test.cc",
354 ],
355 deps = [
356 ":complex_thread_local",
357 "//aos/logging",
John Park398c74a2018-10-20 21:17:39 -0700358 "//aos/testing:googletest",
Austin Schuh972e47e2018-12-20 17:20:58 -0800359 "//aos/util:thread",
John Park398c74a2018-10-20 21:17:39 -0700360 ],
361)
362
363cc_library(
364 name = "init",
365 srcs = [
366 "init.cc",
367 ],
368 hdrs = [
369 "init.h",
370 ],
Austin Schuh972e47e2018-12-20 17:20:58 -0800371 visibility = ["//visibility:public"],
John Park398c74a2018-10-20 21:17:39 -0700372 deps = [
373 "//aos:die",
John Park398c74a2018-10-20 21:17:39 -0700374 "//aos/ipc_lib:shared_mem",
Austin Schuh972e47e2018-12-20 17:20:58 -0800375 "//aos/logging:implementations",
John Park398c74a2018-10-20 21:17:39 -0700376 ],
John Park398c74a2018-10-20 21:17:39 -0700377)
378
379cc_library(
380 name = "configuration",
381 srcs = [
382 "configuration.cc",
383 ],
384 hdrs = [
385 "configuration.h",
386 ],
Austin Schuh972e47e2018-12-20 17:20:58 -0800387 visibility = ["//visibility:public"],
John Park398c74a2018-10-20 21:17:39 -0700388 deps = [
389 "//aos:once",
390 "//aos:unique_malloc_ptr",
391 "//aos/logging",
392 ],
John Park398c74a2018-10-20 21:17:39 -0700393)
394
395cc_binary(
396 name = "core",
397 srcs = [
398 "core.cc",
399 ],
400 deps = [
401 ":init",
402 "//aos/util:run_command",
403 ],
404)
Brian Silvermanf819b442019-01-20 16:51:04 -0800405
406cc_library(
407 name = "make_unique",
408 hdrs = [
409 "make_unique.h",
410 ],
411 visibility = ["//visibility:public"],
412)
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700413
414flatbuffer_cc_library(
415 name = "json_to_flatbuffer_flatbuffer",
416 srcs = ["json_to_flatbuffer.fbs"],
417)
418
419cc_library(
Austin Schuh43c6a352019-09-30 22:22:10 -0700420 name = "flatbuffer_utils",
421 srcs = ["flatbuffer_utils.cc"],
422 hdrs = ["flatbuffer_utils.h"],
423 deps = [
424 "@com_github_google_flatbuffers//:flatbuffers",
425 ],
426)
427
428cc_library(
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700429 name = "json_to_flatbuffer",
430 srcs = ["json_to_flatbuffer.cc"],
431 hdrs = ["json_to_flatbuffer.h"],
432 deps = [
Austin Schuh43c6a352019-09-30 22:22:10 -0700433 ":flatbuffer_utils",
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700434 "//aos/logging",
435 "@com_github_google_flatbuffers//:flatbuffers",
436 ],
437)
438
439cc_test(
440 name = "json_to_flatbuffer_test",
441 srcs = [
442 "json_to_flatbuffer_test.cc",
443 ],
444 deps = [
445 ":json_to_flatbuffer",
446 ":json_to_flatbuffer_flatbuffer",
447 "//aos/testing:googletest",
448 ],
449)