blob: 17ed688793354332748c0cb6708284aad38f0183 [file] [log] [blame]
Alex Perrycb7da4b2019-08-28 19:35:56 -07001load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
2
3package(default_visibility = ["//visibility:public"])
4
5flatbuffer_cc_library(
6 name = "test_message_fbs",
7 srcs = ["test_message.fbs"],
8 gen_reflections = 1,
9)
10
11flatbuffer_cc_library(
12 name = "pingpong_fbs",
13 srcs = ["pingpong.fbs"],
14 gen_reflections = 1,
15)
16
Parker Schuhe4a70d62017-12-27 20:10:20 -080017cc_library(
Austin Schuh6b6dfa52019-06-12 20:16:20 -070018 name = "epoll",
19 srcs = ["epoll.cc"],
20 hdrs = ["epoll.h"],
Austin Schuh20b2b082019-09-11 20:42:56 -070021 visibility = ["//visibility:public"],
Austin Schuh6b6dfa52019-06-12 20:16:20 -070022 deps = [
Austin Schuh6b6dfa52019-06-12 20:16:20 -070023 "//aos/time",
Austin Schuhf257f3c2019-10-27 21:00:43 -070024 "@com_github_google_glog//:glog",
Austin Schuh6b6dfa52019-06-12 20:16:20 -070025 ],
26)
27
28cc_library(
Alex Perrycb7da4b2019-08-28 19:35:56 -070029 name = "event_loop",
30 srcs = ["event_loop_tmpl.h"],
Austin Schuha1654ed2019-01-27 17:24:54 -080031 hdrs = [
Alex Perrycb7da4b2019-08-28 19:35:56 -070032 "event_loop.h",
Austin Schuha1654ed2019-01-27 17:24:54 -080033 ],
34 visibility = ["//visibility:public"],
35 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -070036 "//aos:configuration",
37 "//aos:configuration_fbs",
38 "//aos:flatbuffers",
Austin Schuha1654ed2019-01-27 17:24:54 -080039 "//aos/time",
Alex Perrycb7da4b2019-08-28 19:35:56 -070040 "@com_github_google_flatbuffers//:flatbuffers",
41 ],
42)
43
44cc_binary(
45 name = "ping",
46 srcs = [
47 "ping.cc",
48 ],
49 data = ["config.fb.json"],
50 deps = [
51 ":pingpong_fbs",
52 ":shm_event_loop",
53 "//aos:configuration",
54 "//aos:init",
55 "//aos:json_to_flatbuffer",
56 "@com_github_google_glog//:glog",
57 ],
58)
59
60cc_binary(
61 name = "pong",
62 srcs = [
63 "pong.cc",
64 ],
65 data = ["config.fb.json"],
66 deps = [
67 ":pingpong_fbs",
68 ":shm_event_loop",
69 "//aos:configuration",
70 "//aos:init",
71 "//aos:json_to_flatbuffer",
72 "@com_github_google_glog//:glog",
Austin Schuha1654ed2019-01-27 17:24:54 -080073 ],
Parker Schuhe4a70d62017-12-27 20:10:20 -080074)
75
76cc_library(
Alex Perrycb7da4b2019-08-28 19:35:56 -070077 name = "shm_event_loop",
78 srcs = ["shm_event_loop.cc"],
79 hdrs = ["shm_event_loop.h"],
Austin Schuha1654ed2019-01-27 17:24:54 -080080 visibility = ["//visibility:public"],
81 deps = [
Austin Schuh6b6dfa52019-06-12 20:16:20 -070082 ":epoll",
Alex Perrycb7da4b2019-08-28 19:35:56 -070083 ":event_loop",
84 ":test_message_fbs",
85 "//aos:realtime",
86 "//aos/ipc_lib:lockless_queue",
87 "//aos/ipc_lib:signalfd",
Austin Schuh52d325c2019-06-23 18:59:06 -070088 "//aos/util:phased_loop",
Austin Schuha1654ed2019-01-27 17:24:54 -080089 ],
Parker Schuhe4a70d62017-12-27 20:10:20 -080090)
91
92cc_test(
Alex Perrycb7da4b2019-08-28 19:35:56 -070093 name = "shm_event_loop_test",
94 srcs = ["shm_event_loop_test.cc"],
Austin Schuh6b6dfa52019-06-12 20:16:20 -070095 shard_count = 5,
Austin Schuha1654ed2019-01-27 17:24:54 -080096 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -070097 ":event_loop_param_test",
98 ":shm_event_loop",
99 ":test_message_fbs",
Austin Schuha1654ed2019-01-27 17:24:54 -0800100 ],
Parker Schuhe4a70d62017-12-27 20:10:20 -0800101)
102
103cc_library(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700104 name = "event_loop_param_test",
Austin Schuha1654ed2019-01-27 17:24:54 -0800105 testonly = True,
Alex Perrycb7da4b2019-08-28 19:35:56 -0700106 srcs = ["event_loop_param_test.cc"],
107 hdrs = ["event_loop_param_test.h"],
Austin Schuha1654ed2019-01-27 17:24:54 -0800108 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700109 ":event_loop",
110 ":test_message_fbs",
Austin Schuha1654ed2019-01-27 17:24:54 -0800111 "//aos/testing:googletest",
112 ],
Parker Schuhe4a70d62017-12-27 20:10:20 -0800113)
Neil Balchc8f41ed2018-01-20 22:06:53 -0800114
115cc_test(
Austin Schuh7267c532019-05-19 19:55:53 -0700116 name = "simulated_event_loop_test",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700117 srcs = ["simulated_event_loop_test.cc"],
Austin Schuha1654ed2019-01-27 17:24:54 -0800118 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700119 ":event_loop_param_test",
Austin Schuh7267c532019-05-19 19:55:53 -0700120 ":simulated_event_loop",
Austin Schuha1654ed2019-01-27 17:24:54 -0800121 "//aos/testing:googletest",
122 ],
Neil Balchc8f41ed2018-01-20 22:06:53 -0800123)
124
125cc_library(
Austin Schuh7267c532019-05-19 19:55:53 -0700126 name = "simulated_event_loop",
Austin Schuh82c0c822019-05-27 19:55:20 -0700127 testonly = True,
Alex Perrycb7da4b2019-08-28 19:35:56 -0700128 srcs = [
129 "event_scheduler.cc",
130 "simulated_event_loop.cc",
131 ],
132 hdrs = [
133 "event_scheduler.h",
134 "simulated_event_loop.h",
135 ],
Austin Schuh7267c532019-05-19 19:55:53 -0700136 visibility = ["//visibility:public"],
Austin Schuha1654ed2019-01-27 17:24:54 -0800137 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700138 ":event_loop",
139 "//aos/ipc_lib:index",
Austin Schuh52d325c2019-06-23 18:59:06 -0700140 "//aos/util:phased_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700141 "@com_google_absl//absl/container:btree",
Austin Schuha1654ed2019-01-27 17:24:54 -0800142 ],
Neil Balchc8f41ed2018-01-20 22:06:53 -0800143)