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 | |
Austin Schuh | 15649d6 | 2019-12-28 16:36:38 -0800 | [diff] [blame^] | 118 | aos_config( |
| 119 | name = "multinode_pingpong_config", |
| 120 | src = "multinode_pingpong.json", |
| 121 | flatbuffers = [ |
| 122 | ":ping_fbs", |
| 123 | ":pong_fbs", |
| 124 | ], |
| 125 | deps = [":config"], |
| 126 | ) |
| 127 | |
Austin Schuh | 6b9c415 | 2019-11-29 12:45:24 -0800 | [diff] [blame] | 128 | cc_library( |
| 129 | name = "pong_lib", |
| 130 | srcs = [ |
| 131 | "pong_lib.cc", |
| 132 | ], |
| 133 | hdrs = [ |
| 134 | "pong_lib.h", |
| 135 | ], |
| 136 | deps = [ |
| 137 | ":event_loop", |
| 138 | ":ping_fbs", |
| 139 | ":pong_fbs", |
| 140 | "@com_github_google_glog//:glog", |
| 141 | ], |
| 142 | ) |
| 143 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 144 | cc_binary( |
| 145 | name = "pong", |
| 146 | srcs = [ |
| 147 | "pong.cc", |
| 148 | ], |
Austin Schuh | 6b9c415 | 2019-11-29 12:45:24 -0800 | [diff] [blame] | 149 | data = ["pingpong_config.json"], |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 150 | deps = [ |
Austin Schuh | 6b9c415 | 2019-11-29 12:45:24 -0800 | [diff] [blame] | 151 | ":ping_fbs", |
| 152 | ":pong_fbs", |
| 153 | ":pong_lib", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 154 | ":shm_event_loop", |
| 155 | "//aos:configuration", |
| 156 | "//aos:init", |
| 157 | "//aos:json_to_flatbuffer", |
| 158 | "@com_github_google_glog//:glog", |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 159 | ], |
Parker Schuh | e4a70d6 | 2017-12-27 20:10:20 -0800 | [diff] [blame] | 160 | ) |
| 161 | |
Austin Schuh | 6b9c415 | 2019-11-29 12:45:24 -0800 | [diff] [blame] | 162 | cc_test( |
| 163 | name = "pingpong_test", |
| 164 | srcs = ["pingpong_test.cc"], |
| 165 | data = [":pingpong_config.json"], |
| 166 | deps = [ |
| 167 | ":ping_lib", |
| 168 | ":pong_lib", |
| 169 | ":simulated_event_loop", |
| 170 | "//aos:configuration", |
| 171 | "//aos:flatbuffers", |
| 172 | "//aos/testing:googletest", |
| 173 | ], |
| 174 | ) |
| 175 | |
Parker Schuh | e4a70d6 | 2017-12-27 20:10:20 -0800 | [diff] [blame] | 176 | cc_library( |
Austin Schuh | e410614 | 2019-12-01 18:19:53 -0800 | [diff] [blame] | 177 | name = "timing_statistics", |
| 178 | srcs = ["timing_statistics.cc"], |
| 179 | hdrs = ["timing_statistics.h"], |
| 180 | deps = [ |
| 181 | ":event_loop_fbs", |
| 182 | "//aos:configuration", |
| 183 | "@com_github_google_glog//:glog", |
| 184 | ], |
| 185 | ) |
| 186 | |
| 187 | cc_test( |
| 188 | name = "timing_statistics_test", |
| 189 | srcs = ["timing_statistics_test.cc"], |
| 190 | deps = [ |
| 191 | ":timing_statistics", |
| 192 | "//aos:configuration", |
| 193 | "//aos:flatbuffers", |
| 194 | "//aos/testing:googletest", |
| 195 | ], |
| 196 | ) |
| 197 | |
| 198 | cc_library( |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 199 | name = "shm_event_loop", |
| 200 | srcs = ["shm_event_loop.cc"], |
| 201 | hdrs = ["shm_event_loop.h"], |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 202 | visibility = ["//visibility:public"], |
| 203 | deps = [ |
Austin Schuh | 6b6dfa5 | 2019-06-12 20:16:20 -0700 | [diff] [blame] | 204 | ":epoll", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 205 | ":event_loop", |
Austin Schuh | 39788ff | 2019-12-01 18:22:57 -0800 | [diff] [blame] | 206 | ":event_loop_fbs", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 207 | ":test_message_fbs", |
Austin Schuh | 39788ff | 2019-12-01 18:22:57 -0800 | [diff] [blame] | 208 | ":timing_statistics", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 209 | "//aos:realtime", |
| 210 | "//aos/ipc_lib:lockless_queue", |
| 211 | "//aos/ipc_lib:signalfd", |
Austin Schuh | 32fd5a7 | 2019-12-01 22:20:26 -0800 | [diff] [blame] | 212 | "//aos/stl_mutex", |
Austin Schuh | 52d325c | 2019-06-23 18:59:06 -0700 | [diff] [blame] | 213 | "//aos/util:phased_loop", |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 214 | ], |
Parker Schuh | e4a70d6 | 2017-12-27 20:10:20 -0800 | [diff] [blame] | 215 | ) |
| 216 | |
| 217 | cc_test( |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 218 | name = "shm_event_loop_test", |
| 219 | srcs = ["shm_event_loop_test.cc"], |
Austin Schuh | 6b6dfa5 | 2019-06-12 20:16:20 -0700 | [diff] [blame] | 220 | shard_count = 5, |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 221 | deps = [ |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 222 | ":event_loop_param_test", |
| 223 | ":shm_event_loop", |
| 224 | ":test_message_fbs", |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 225 | ], |
Parker Schuh | e4a70d6 | 2017-12-27 20:10:20 -0800 | [diff] [blame] | 226 | ) |
| 227 | |
| 228 | cc_library( |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 229 | name = "event_loop_param_test", |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 230 | testonly = True, |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 231 | srcs = ["event_loop_param_test.cc"], |
| 232 | hdrs = ["event_loop_param_test.h"], |
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", |
| 235 | ":test_message_fbs", |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 236 | "//aos/testing:googletest", |
| 237 | ], |
Parker Schuh | e4a70d6 | 2017-12-27 20:10:20 -0800 | [diff] [blame] | 238 | ) |
Neil Balch | c8f41ed | 2018-01-20 22:06:53 -0800 | [diff] [blame] | 239 | |
| 240 | cc_test( |
Austin Schuh | 7267c53 | 2019-05-19 19:55:53 -0700 | [diff] [blame] | 241 | name = "simulated_event_loop_test", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 242 | srcs = ["simulated_event_loop_test.cc"], |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 243 | deps = [ |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 244 | ":event_loop_param_test", |
Austin Schuh | 7267c53 | 2019-05-19 19:55:53 -0700 | [diff] [blame] | 245 | ":simulated_event_loop", |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 246 | "//aos/testing:googletest", |
| 247 | ], |
Neil Balch | c8f41ed | 2018-01-20 22:06:53 -0800 | [diff] [blame] | 248 | ) |
| 249 | |
| 250 | cc_library( |
Austin Schuh | 7267c53 | 2019-05-19 19:55:53 -0700 | [diff] [blame] | 251 | name = "simulated_event_loop", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 252 | srcs = [ |
| 253 | "event_scheduler.cc", |
| 254 | "simulated_event_loop.cc", |
| 255 | ], |
| 256 | hdrs = [ |
| 257 | "event_scheduler.h", |
| 258 | "simulated_event_loop.h", |
| 259 | ], |
Austin Schuh | 7267c53 | 2019-05-19 19:55:53 -0700 | [diff] [blame] | 260 | visibility = ["//visibility:public"], |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 261 | deps = [ |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 262 | ":event_loop", |
| 263 | "//aos/ipc_lib:index", |
Austin Schuh | 52d325c | 2019-06-23 18:59:06 -0700 | [diff] [blame] | 264 | "//aos/util:phased_loop", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 265 | "@com_google_absl//absl/container:btree", |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 266 | ], |
Neil Balch | c8f41ed | 2018-01-20 22:06:53 -0800 | [diff] [blame] | 267 | ) |