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 | 6b9c415 | 2019-11-29 12:45:24 -0800 | [diff] [blame^] | 13 | name = "ping_fbs", |
| 14 | srcs = ["ping.fbs"], |
| 15 | gen_reflections = 1, |
| 16 | ) |
| 17 | |
| 18 | flatbuffer_cc_library( |
| 19 | name = "pong_fbs", |
| 20 | srcs = ["pong.fbs"], |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 21 | gen_reflections = 1, |
| 22 | ) |
| 23 | |
Parker Schuh | e4a70d6 | 2017-12-27 20:10:20 -0800 | [diff] [blame] | 24 | cc_library( |
Austin Schuh | 6b6dfa5 | 2019-06-12 20:16:20 -0700 | [diff] [blame] | 25 | name = "epoll", |
| 26 | srcs = ["epoll.cc"], |
| 27 | hdrs = ["epoll.h"], |
Austin Schuh | 20b2b08 | 2019-09-11 20:42:56 -0700 | [diff] [blame] | 28 | visibility = ["//visibility:public"], |
Austin Schuh | 6b6dfa5 | 2019-06-12 20:16:20 -0700 | [diff] [blame] | 29 | deps = [ |
Austin Schuh | 6b6dfa5 | 2019-06-12 20:16:20 -0700 | [diff] [blame] | 30 | "//aos/time", |
Austin Schuh | f257f3c | 2019-10-27 21:00:43 -0700 | [diff] [blame] | 31 | "@com_github_google_glog//:glog", |
Austin Schuh | 6b6dfa5 | 2019-06-12 20:16:20 -0700 | [diff] [blame] | 32 | ], |
| 33 | ) |
| 34 | |
| 35 | cc_library( |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 36 | name = "event_loop", |
| 37 | srcs = ["event_loop_tmpl.h"], |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 38 | hdrs = [ |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 39 | "event_loop.h", |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 40 | ], |
| 41 | visibility = ["//visibility:public"], |
| 42 | deps = [ |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 43 | "//aos:configuration", |
| 44 | "//aos:configuration_fbs", |
| 45 | "//aos:flatbuffers", |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 46 | "//aos/time", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 47 | "@com_github_google_flatbuffers//:flatbuffers", |
| 48 | ], |
| 49 | ) |
| 50 | |
Austin Schuh | 6b9c415 | 2019-11-29 12:45:24 -0800 | [diff] [blame^] | 51 | cc_library( |
| 52 | name = "ping_lib", |
| 53 | srcs = [ |
| 54 | "ping_lib.cc", |
| 55 | ], |
| 56 | hdrs = [ |
| 57 | "ping_lib.h", |
| 58 | ], |
| 59 | deps = [ |
| 60 | ":event_loop", |
| 61 | ":ping_fbs", |
| 62 | ":pong_fbs", |
| 63 | "//aos:json_to_flatbuffer", |
| 64 | "@com_github_google_glog//:glog", |
| 65 | ], |
| 66 | ) |
| 67 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 68 | cc_binary( |
| 69 | name = "ping", |
| 70 | srcs = [ |
| 71 | "ping.cc", |
| 72 | ], |
Austin Schuh | 6b9c415 | 2019-11-29 12:45:24 -0800 | [diff] [blame^] | 73 | data = ["pingpong_config.json"], |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 74 | deps = [ |
Austin Schuh | 6b9c415 | 2019-11-29 12:45:24 -0800 | [diff] [blame^] | 75 | ":ping_lib", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 76 | ":shm_event_loop", |
| 77 | "//aos:configuration", |
| 78 | "//aos:init", |
| 79 | "//aos:json_to_flatbuffer", |
| 80 | "@com_github_google_glog//:glog", |
| 81 | ], |
| 82 | ) |
| 83 | |
Austin Schuh | 6b9c415 | 2019-11-29 12:45:24 -0800 | [diff] [blame^] | 84 | aos_config( |
| 85 | name = "pingpong_config", |
| 86 | src = "config.fb.json", |
| 87 | flatbuffers = [ |
| 88 | ":ping_fbs", |
| 89 | ":pong_fbs", |
| 90 | ], |
| 91 | ) |
| 92 | |
| 93 | cc_library( |
| 94 | name = "pong_lib", |
| 95 | srcs = [ |
| 96 | "pong_lib.cc", |
| 97 | ], |
| 98 | hdrs = [ |
| 99 | "pong_lib.h", |
| 100 | ], |
| 101 | deps = [ |
| 102 | ":event_loop", |
| 103 | ":ping_fbs", |
| 104 | ":pong_fbs", |
| 105 | "@com_github_google_glog//:glog", |
| 106 | ], |
| 107 | ) |
| 108 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 109 | cc_binary( |
| 110 | name = "pong", |
| 111 | srcs = [ |
| 112 | "pong.cc", |
| 113 | ], |
Austin Schuh | 6b9c415 | 2019-11-29 12:45:24 -0800 | [diff] [blame^] | 114 | data = ["pingpong_config.json"], |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 115 | deps = [ |
Austin Schuh | 6b9c415 | 2019-11-29 12:45:24 -0800 | [diff] [blame^] | 116 | ":ping_fbs", |
| 117 | ":pong_fbs", |
| 118 | ":pong_lib", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 119 | ":shm_event_loop", |
| 120 | "//aos:configuration", |
| 121 | "//aos:init", |
| 122 | "//aos:json_to_flatbuffer", |
| 123 | "@com_github_google_glog//:glog", |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 124 | ], |
Parker Schuh | e4a70d6 | 2017-12-27 20:10:20 -0800 | [diff] [blame] | 125 | ) |
| 126 | |
Austin Schuh | 6b9c415 | 2019-11-29 12:45:24 -0800 | [diff] [blame^] | 127 | cc_test( |
| 128 | name = "pingpong_test", |
| 129 | srcs = ["pingpong_test.cc"], |
| 130 | data = [":pingpong_config.json"], |
| 131 | deps = [ |
| 132 | ":ping_lib", |
| 133 | ":pong_lib", |
| 134 | ":simulated_event_loop", |
| 135 | "//aos:configuration", |
| 136 | "//aos:flatbuffers", |
| 137 | "//aos/testing:googletest", |
| 138 | ], |
| 139 | ) |
| 140 | |
Parker Schuh | e4a70d6 | 2017-12-27 20:10:20 -0800 | [diff] [blame] | 141 | cc_library( |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 142 | name = "shm_event_loop", |
| 143 | srcs = ["shm_event_loop.cc"], |
| 144 | hdrs = ["shm_event_loop.h"], |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 145 | visibility = ["//visibility:public"], |
| 146 | deps = [ |
Austin Schuh | 6b6dfa5 | 2019-06-12 20:16:20 -0700 | [diff] [blame] | 147 | ":epoll", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 148 | ":event_loop", |
| 149 | ":test_message_fbs", |
| 150 | "//aos:realtime", |
| 151 | "//aos/ipc_lib:lockless_queue", |
| 152 | "//aos/ipc_lib:signalfd", |
Austin Schuh | 52d325c | 2019-06-23 18:59:06 -0700 | [diff] [blame] | 153 | "//aos/util:phased_loop", |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 154 | ], |
Parker Schuh | e4a70d6 | 2017-12-27 20:10:20 -0800 | [diff] [blame] | 155 | ) |
| 156 | |
| 157 | cc_test( |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 158 | name = "shm_event_loop_test", |
| 159 | srcs = ["shm_event_loop_test.cc"], |
Austin Schuh | 6b6dfa5 | 2019-06-12 20:16:20 -0700 | [diff] [blame] | 160 | shard_count = 5, |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 161 | deps = [ |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 162 | ":event_loop_param_test", |
| 163 | ":shm_event_loop", |
| 164 | ":test_message_fbs", |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 165 | ], |
Parker Schuh | e4a70d6 | 2017-12-27 20:10:20 -0800 | [diff] [blame] | 166 | ) |
| 167 | |
| 168 | cc_library( |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 169 | name = "event_loop_param_test", |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 170 | testonly = True, |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 171 | srcs = ["event_loop_param_test.cc"], |
| 172 | hdrs = ["event_loop_param_test.h"], |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 173 | deps = [ |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 174 | ":event_loop", |
| 175 | ":test_message_fbs", |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 176 | "//aos/testing:googletest", |
| 177 | ], |
Parker Schuh | e4a70d6 | 2017-12-27 20:10:20 -0800 | [diff] [blame] | 178 | ) |
Neil Balch | c8f41ed | 2018-01-20 22:06:53 -0800 | [diff] [blame] | 179 | |
| 180 | cc_test( |
Austin Schuh | 7267c53 | 2019-05-19 19:55:53 -0700 | [diff] [blame] | 181 | name = "simulated_event_loop_test", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 182 | srcs = ["simulated_event_loop_test.cc"], |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 183 | deps = [ |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 184 | ":event_loop_param_test", |
Austin Schuh | 7267c53 | 2019-05-19 19:55:53 -0700 | [diff] [blame] | 185 | ":simulated_event_loop", |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 186 | "//aos/testing:googletest", |
| 187 | ], |
Neil Balch | c8f41ed | 2018-01-20 22:06:53 -0800 | [diff] [blame] | 188 | ) |
| 189 | |
| 190 | cc_library( |
Austin Schuh | 7267c53 | 2019-05-19 19:55:53 -0700 | [diff] [blame] | 191 | name = "simulated_event_loop", |
Austin Schuh | 82c0c82 | 2019-05-27 19:55:20 -0700 | [diff] [blame] | 192 | testonly = True, |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 193 | srcs = [ |
| 194 | "event_scheduler.cc", |
| 195 | "simulated_event_loop.cc", |
| 196 | ], |
| 197 | hdrs = [ |
| 198 | "event_scheduler.h", |
| 199 | "simulated_event_loop.h", |
| 200 | ], |
Austin Schuh | 7267c53 | 2019-05-19 19:55:53 -0700 | [diff] [blame] | 201 | visibility = ["//visibility:public"], |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 202 | deps = [ |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 203 | ":event_loop", |
| 204 | "//aos/ipc_lib:index", |
Austin Schuh | 52d325c | 2019-06-23 18:59:06 -0700 | [diff] [blame] | 205 | "//aos/util:phased_loop", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 206 | "@com_google_absl//absl/container:btree", |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 207 | ], |
Neil Balch | c8f41ed | 2018-01-20 22:06:53 -0800 | [diff] [blame] | 208 | ) |