Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 1 | load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library") |
Austin Schuh | 6b9c415 | 2019-11-29 12:45:24 -0800 | [diff] [blame] | 2 | load("//aos:config.bzl", "aos_config") |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 3 | |
| 4 | package(default_visibility = ["//visibility:public"]) |
| 5 | |
| 6 | flatbuffer_cc_library( |
| 7 | name = "test_message_fbs", |
| 8 | srcs = ["test_message.fbs"], |
| 9 | gen_reflections = 1, |
| 10 | ) |
| 11 | |
| 12 | flatbuffer_cc_library( |
Austin Schuh | e410614 | 2019-12-01 18:19:53 -0800 | [diff] [blame] | 13 | name = "event_loop_fbs", |
| 14 | srcs = ["event_loop.fbs"], |
| 15 | gen_reflections = 1, |
| 16 | includes = [ |
| 17 | "//aos:configuration_fbs_includes", |
| 18 | ], |
| 19 | ) |
| 20 | |
| 21 | flatbuffer_cc_library( |
Austin Schuh | 6b9c415 | 2019-11-29 12:45:24 -0800 | [diff] [blame] | 22 | name = "ping_fbs", |
| 23 | srcs = ["ping.fbs"], |
| 24 | gen_reflections = 1, |
| 25 | ) |
| 26 | |
| 27 | flatbuffer_cc_library( |
| 28 | name = "pong_fbs", |
| 29 | srcs = ["pong.fbs"], |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 30 | gen_reflections = 1, |
| 31 | ) |
| 32 | |
Parker Schuh | e4a70d6 | 2017-12-27 20:10:20 -0800 | [diff] [blame] | 33 | cc_library( |
Austin Schuh | 6b6dfa5 | 2019-06-12 20:16:20 -0700 | [diff] [blame] | 34 | name = "epoll", |
| 35 | srcs = ["epoll.cc"], |
| 36 | hdrs = ["epoll.h"], |
Austin Schuh | 20b2b08 | 2019-09-11 20:42:56 -0700 | [diff] [blame] | 37 | visibility = ["//visibility:public"], |
Austin Schuh | 6b6dfa5 | 2019-06-12 20:16:20 -0700 | [diff] [blame] | 38 | deps = [ |
Austin Schuh | 6b6dfa5 | 2019-06-12 20:16:20 -0700 | [diff] [blame] | 39 | "//aos/time", |
Austin Schuh | f257f3c | 2019-10-27 21:00:43 -0700 | [diff] [blame] | 40 | "@com_github_google_glog//:glog", |
Austin Schuh | 6b6dfa5 | 2019-06-12 20:16:20 -0700 | [diff] [blame] | 41 | ], |
| 42 | ) |
| 43 | |
| 44 | cc_library( |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 45 | name = "event_loop", |
Austin Schuh | 54cf95f | 2019-11-29 13:14:18 -0800 | [diff] [blame] | 46 | srcs = [ |
| 47 | "event_loop.cc", |
Austin Schuh | 7d87b67 | 2019-12-01 20:23:49 -0800 | [diff] [blame] | 48 | "event_loop_event.h", |
Austin Schuh | 54cf95f | 2019-11-29 13:14:18 -0800 | [diff] [blame] | 49 | "event_loop_tmpl.h", |
| 50 | ], |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 51 | hdrs = [ |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 52 | "event_loop.h", |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 53 | ], |
| 54 | visibility = ["//visibility:public"], |
| 55 | deps = [ |
Austin Schuh | 39788ff | 2019-12-01 18:22:57 -0800 | [diff] [blame] | 56 | ":event_loop_fbs", |
| 57 | ":timing_statistics", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 58 | "//aos:configuration", |
| 59 | "//aos:configuration_fbs", |
| 60 | "//aos:flatbuffers", |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 61 | "//aos/time", |
Austin Schuh | 39788ff | 2019-12-01 18:22:57 -0800 | [diff] [blame] | 62 | "//aos/util:phased_loop", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 63 | "@com_github_google_flatbuffers//:flatbuffers", |
| 64 | ], |
| 65 | ) |
| 66 | |
Austin Schuh | 6b9c415 | 2019-11-29 12:45:24 -0800 | [diff] [blame] | 67 | cc_library( |
| 68 | name = "ping_lib", |
| 69 | srcs = [ |
| 70 | "ping_lib.cc", |
| 71 | ], |
| 72 | hdrs = [ |
| 73 | "ping_lib.h", |
| 74 | ], |
| 75 | deps = [ |
| 76 | ":event_loop", |
| 77 | ":ping_fbs", |
| 78 | ":pong_fbs", |
| 79 | "//aos:json_to_flatbuffer", |
| 80 | "@com_github_google_glog//:glog", |
| 81 | ], |
| 82 | ) |
| 83 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 84 | cc_binary( |
| 85 | name = "ping", |
| 86 | srcs = [ |
| 87 | "ping.cc", |
| 88 | ], |
Austin Schuh | 6b9c415 | 2019-11-29 12:45:24 -0800 | [diff] [blame] | 89 | data = ["pingpong_config.json"], |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 90 | deps = [ |
Austin Schuh | 6b9c415 | 2019-11-29 12:45:24 -0800 | [diff] [blame] | 91 | ":ping_lib", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 92 | ":shm_event_loop", |
| 93 | "//aos:configuration", |
| 94 | "//aos:init", |
| 95 | "//aos:json_to_flatbuffer", |
| 96 | "@com_github_google_glog//:glog", |
| 97 | ], |
| 98 | ) |
| 99 | |
Austin Schuh | 6b9c415 | 2019-11-29 12:45:24 -0800 | [diff] [blame] | 100 | aos_config( |
Austin Schuh | 39788ff | 2019-12-01 18:22:57 -0800 | [diff] [blame] | 101 | name = "config", |
| 102 | src = "aos.json", |
| 103 | flatbuffers = [ |
| 104 | ":event_loop_fbs", |
| 105 | ], |
| 106 | ) |
| 107 | |
| 108 | aos_config( |
Austin Schuh | 6b9c415 | 2019-11-29 12:45:24 -0800 | [diff] [blame] | 109 | name = "pingpong_config", |
Austin Schuh | 39788ff | 2019-12-01 18:22:57 -0800 | [diff] [blame] | 110 | src = "pingpong.json", |
Austin Schuh | 6b9c415 | 2019-11-29 12:45:24 -0800 | [diff] [blame] | 111 | flatbuffers = [ |
| 112 | ":ping_fbs", |
| 113 | ":pong_fbs", |
| 114 | ], |
Austin Schuh | 39788ff | 2019-12-01 18:22:57 -0800 | [diff] [blame] | 115 | deps = [":config"], |
Austin Schuh | 6b9c415 | 2019-11-29 12:45:24 -0800 | [diff] [blame] | 116 | ) |
| 117 | |
| 118 | cc_library( |
| 119 | name = "pong_lib", |
| 120 | srcs = [ |
| 121 | "pong_lib.cc", |
| 122 | ], |
| 123 | hdrs = [ |
| 124 | "pong_lib.h", |
| 125 | ], |
| 126 | deps = [ |
| 127 | ":event_loop", |
| 128 | ":ping_fbs", |
| 129 | ":pong_fbs", |
| 130 | "@com_github_google_glog//:glog", |
| 131 | ], |
| 132 | ) |
| 133 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 134 | cc_binary( |
| 135 | name = "pong", |
| 136 | srcs = [ |
| 137 | "pong.cc", |
| 138 | ], |
Austin Schuh | 6b9c415 | 2019-11-29 12:45:24 -0800 | [diff] [blame] | 139 | data = ["pingpong_config.json"], |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 140 | deps = [ |
Austin Schuh | 6b9c415 | 2019-11-29 12:45:24 -0800 | [diff] [blame] | 141 | ":ping_fbs", |
| 142 | ":pong_fbs", |
| 143 | ":pong_lib", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 144 | ":shm_event_loop", |
| 145 | "//aos:configuration", |
| 146 | "//aos:init", |
| 147 | "//aos:json_to_flatbuffer", |
| 148 | "@com_github_google_glog//:glog", |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 149 | ], |
Parker Schuh | e4a70d6 | 2017-12-27 20:10:20 -0800 | [diff] [blame] | 150 | ) |
| 151 | |
Austin Schuh | 6b9c415 | 2019-11-29 12:45:24 -0800 | [diff] [blame] | 152 | cc_test( |
| 153 | name = "pingpong_test", |
| 154 | srcs = ["pingpong_test.cc"], |
| 155 | data = [":pingpong_config.json"], |
| 156 | deps = [ |
| 157 | ":ping_lib", |
| 158 | ":pong_lib", |
| 159 | ":simulated_event_loop", |
| 160 | "//aos:configuration", |
| 161 | "//aos:flatbuffers", |
| 162 | "//aos/testing:googletest", |
| 163 | ], |
| 164 | ) |
| 165 | |
Parker Schuh | e4a70d6 | 2017-12-27 20:10:20 -0800 | [diff] [blame] | 166 | cc_library( |
Austin Schuh | e410614 | 2019-12-01 18:19:53 -0800 | [diff] [blame] | 167 | name = "timing_statistics", |
| 168 | srcs = ["timing_statistics.cc"], |
| 169 | hdrs = ["timing_statistics.h"], |
| 170 | deps = [ |
| 171 | ":event_loop_fbs", |
| 172 | "//aos:configuration", |
| 173 | "@com_github_google_glog//:glog", |
| 174 | ], |
| 175 | ) |
| 176 | |
| 177 | cc_test( |
| 178 | name = "timing_statistics_test", |
| 179 | srcs = ["timing_statistics_test.cc"], |
| 180 | deps = [ |
| 181 | ":timing_statistics", |
| 182 | "//aos:configuration", |
| 183 | "//aos:flatbuffers", |
| 184 | "//aos/testing:googletest", |
| 185 | ], |
| 186 | ) |
| 187 | |
| 188 | cc_library( |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 189 | name = "shm_event_loop", |
| 190 | srcs = ["shm_event_loop.cc"], |
| 191 | hdrs = ["shm_event_loop.h"], |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 192 | visibility = ["//visibility:public"], |
| 193 | deps = [ |
Austin Schuh | 6b6dfa5 | 2019-06-12 20:16:20 -0700 | [diff] [blame] | 194 | ":epoll", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 195 | ":event_loop", |
Austin Schuh | 39788ff | 2019-12-01 18:22:57 -0800 | [diff] [blame] | 196 | ":event_loop_fbs", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 197 | ":test_message_fbs", |
Austin Schuh | 39788ff | 2019-12-01 18:22:57 -0800 | [diff] [blame] | 198 | ":timing_statistics", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 199 | "//aos:realtime", |
| 200 | "//aos/ipc_lib:lockless_queue", |
| 201 | "//aos/ipc_lib:signalfd", |
Austin Schuh | 32fd5a7 | 2019-12-01 22:20:26 -0800 | [diff] [blame] | 202 | "//aos/stl_mutex", |
Austin Schuh | 52d325c | 2019-06-23 18:59:06 -0700 | [diff] [blame] | 203 | "//aos/util:phased_loop", |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 204 | ], |
Parker Schuh | e4a70d6 | 2017-12-27 20:10:20 -0800 | [diff] [blame] | 205 | ) |
| 206 | |
| 207 | cc_test( |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 208 | name = "shm_event_loop_test", |
| 209 | srcs = ["shm_event_loop_test.cc"], |
Austin Schuh | 6b6dfa5 | 2019-06-12 20:16:20 -0700 | [diff] [blame] | 210 | shard_count = 5, |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 211 | deps = [ |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 212 | ":event_loop_param_test", |
| 213 | ":shm_event_loop", |
| 214 | ":test_message_fbs", |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 215 | ], |
Parker Schuh | e4a70d6 | 2017-12-27 20:10:20 -0800 | [diff] [blame] | 216 | ) |
| 217 | |
| 218 | cc_library( |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 219 | name = "event_loop_param_test", |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 220 | testonly = True, |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 221 | srcs = ["event_loop_param_test.cc"], |
| 222 | hdrs = ["event_loop_param_test.h"], |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 223 | deps = [ |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 224 | ":event_loop", |
| 225 | ":test_message_fbs", |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 226 | "//aos/testing:googletest", |
| 227 | ], |
Parker Schuh | e4a70d6 | 2017-12-27 20:10:20 -0800 | [diff] [blame] | 228 | ) |
Neil Balch | c8f41ed | 2018-01-20 22:06:53 -0800 | [diff] [blame] | 229 | |
| 230 | cc_test( |
Austin Schuh | 7267c53 | 2019-05-19 19:55:53 -0700 | [diff] [blame] | 231 | name = "simulated_event_loop_test", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 232 | srcs = ["simulated_event_loop_test.cc"], |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 233 | deps = [ |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 234 | ":event_loop_param_test", |
Austin Schuh | 7267c53 | 2019-05-19 19:55:53 -0700 | [diff] [blame] | 235 | ":simulated_event_loop", |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 236 | "//aos/testing:googletest", |
| 237 | ], |
Neil Balch | c8f41ed | 2018-01-20 22:06:53 -0800 | [diff] [blame] | 238 | ) |
| 239 | |
| 240 | cc_library( |
Austin Schuh | 7267c53 | 2019-05-19 19:55:53 -0700 | [diff] [blame] | 241 | name = "simulated_event_loop", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 242 | srcs = [ |
| 243 | "event_scheduler.cc", |
| 244 | "simulated_event_loop.cc", |
| 245 | ], |
| 246 | hdrs = [ |
| 247 | "event_scheduler.h", |
| 248 | "simulated_event_loop.h", |
| 249 | ], |
Austin Schuh | 7267c53 | 2019-05-19 19:55:53 -0700 | [diff] [blame] | 250 | visibility = ["//visibility:public"], |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 251 | deps = [ |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 252 | ":event_loop", |
| 253 | "//aos/ipc_lib:index", |
Austin Schuh | 52d325c | 2019-06-23 18:59:06 -0700 | [diff] [blame] | 254 | "//aos/util:phased_loop", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 255 | "@com_google_absl//absl/container:btree", |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 256 | ], |
Neil Balch | c8f41ed | 2018-01-20 22:06:53 -0800 | [diff] [blame] | 257 | ) |