blob: 4a366c9142827a499d62d4d573c2c786b7881ef0 [file] [log] [blame]
Tyler Chatowa79419d2020-08-12 20:12:11 -07001load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
James Kuszmaul293b2172021-11-10 16:20:48 -08002load("//aos:config.bzl", "aos_config")
Tyler Chatowa79419d2020-08-12 20:12:11 -07003
Brian Silverman96d12952015-10-12 13:36:42 -04004# This target is everything which should get deployed to the robot.
5filegroup(
Austin Schuhdde64052019-12-11 20:28:00 -08006 name = "starter",
7 srcs = [
Austin Schuh529ac592021-10-14 16:11:13 -07008 "aos_starter",
Austin Schuhdde64052019-12-11 20:28:00 -08009 "starter.sh",
Austin Schuh44e0b142021-10-16 15:51:10 -070010 "starterd.stripped",
11 ],
12 visibility = ["//visibility:public"],
13)
14
15filegroup(
16 name = "starter_stripped",
17 srcs = [
18 "aos_starter.stripped",
19 "starter.sh",
20 "starterd.stripped",
Austin Schuhdde64052019-12-11 20:28:00 -080021 ],
22 visibility = ["//visibility:public"],
Brian Silverman96d12952015-10-12 13:36:42 -040023)
Brian Silverman100534c2015-09-07 15:51:23 -040024
Tyler Chatowa79419d2020-08-12 20:12:11 -070025cc_library(
James Kuszmaul3224b8e2022-01-07 19:00:39 -080026 name = "subprocess",
27 srcs = ["subprocess.cc"],
28 hdrs = ["subprocess.h"],
29 visibility = ["//visibility:public"],
30 deps = [
31 ":starter_fbs",
32 ":starter_rpc_fbs",
33 "//aos/events:event_loop",
34 "//aos/events:shm_event_loop",
35 "//aos/util:scoped_pipe",
James Kuszmaul6295a642022-03-22 15:23:59 -070036 "//aos/util:top",
James Kuszmaul3224b8e2022-01-07 19:00:39 -080037 "@com_github_google_glog//:glog",
38 ],
39)
40
41cc_library(
Tyler Chatowa79419d2020-08-12 20:12:11 -070042 name = "starterd_lib",
43 srcs = ["starterd_lib.cc"],
44 hdrs = ["starterd_lib.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -080045 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatowa79419d2020-08-12 20:12:11 -070046 deps = [
47 ":starter_fbs",
48 ":starter_rpc_fbs",
James Kuszmaul3224b8e2022-01-07 19:00:39 -080049 ":subprocess",
Tyler Chatowa79419d2020-08-12 20:12:11 -070050 "//aos:configuration",
51 "//aos:macros",
52 "//aos/events:shm_event_loop",
53 "@com_github_google_glog//:glog",
54 ],
55)
56
James Kuszmaul293b2172021-11-10 16:20:48 -080057aos_config(
58 name = "multinode_pingpong_config",
59 src = "multinode_pingpong.json",
60 flatbuffers = [
61 "//aos/events:ping_fbs",
62 "//aos/events:pong_fbs",
63 ":starter_rpc_fbs",
64 ":starter_fbs",
65 "//aos/logging:log_message_fbs",
66 "//aos/events:event_loop_fbs",
67 "//aos/network:message_bridge_client_fbs",
68 "//aos/network:remote_message_fbs",
69 "//aos/network:timestamp_fbs",
70 "//aos/network:message_bridge_server_fbs",
71 ],
72 target_compatible_with = ["@platforms//os:linux"],
73)
74
Tyler Chatowa79419d2020-08-12 20:12:11 -070075cc_test(
James Kuszmauld42edb42022-01-07 18:00:16 -080076 name = "subprocess_test",
77 srcs = ["subprocess_test.cc"],
78 data = [
79 "//aos/events:pingpong_config",
80 ],
James Kuszmaula03bdf02022-02-26 16:39:45 -080081 flaky = True,
James Kuszmauld42edb42022-01-07 18:00:16 -080082 # The roborio compiler doesn't support <filesystem>.
83 target_compatible_with =
84 ["@platforms//os:linux"],
85 deps = [
86 ":subprocess",
87 "//aos/events:shm_event_loop",
88 "//aos/testing:googletest",
89 "//aos/testing:path",
90 "//aos/testing:tmpdir",
91 ],
92)
93
94cc_test(
Tyler Chatowa79419d2020-08-12 20:12:11 -070095 name = "starter_test",
96 srcs = ["starter_test.cc"],
97 data = [
James Kuszmaul293b2172021-11-10 16:20:48 -080098 ":multinode_pingpong_config",
Tyler Chatowa79419d2020-08-12 20:12:11 -070099 "//aos/events:ping",
100 "//aos/events:pingpong_config",
101 "//aos/events:pong",
102 ],
James Kuszmaulbe55e1c2022-04-02 20:06:01 -0700103 # TODO(james): Fix tihs.
104 flaky = True,
James Kuszmaul293b2172021-11-10 16:20:48 -0800105 linkopts = ["-lstdc++fs"],
James Kuszmaule7c7e582022-01-07 18:50:01 -0800106 shard_count = 4,
James Kuszmaul293b2172021-11-10 16:20:48 -0800107 # The roborio compiler doesn't support <filesystem>.
108 target_compatible_with =
109 select({
110 "//tools/platforms/hardware:roborio": ["@platforms//:incompatible"],
111 "//conditions:default": ["@platforms//os:linux"],
112 }),
Tyler Chatowa79419d2020-08-12 20:12:11 -0700113 deps = [
114 ":starter_rpc_lib",
115 ":starterd_lib",
116 "//aos/events:ping_fbs",
117 "//aos/events:pong_fbs",
James Kuszmaul293b2172021-11-10 16:20:48 -0800118 "//aos/events:simulated_event_loop",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700119 "//aos/testing:googletest",
Austin Schuh373f1762021-06-02 21:07:09 -0700120 "//aos/testing:path",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700121 "//aos/testing:tmpdir",
122 ],
123)
124
125cc_binary(
126 name = "starterd",
127 srcs = ["starterd.cc"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800128 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh529ac592021-10-14 16:11:13 -0700129 visibility = ["//visibility:public"],
Tyler Chatowa79419d2020-08-12 20:12:11 -0700130 deps = [
131 ":starterd_lib",
132 "//aos:init",
133 ],
134)
135
136cc_library(
137 name = "starter_rpc_lib",
138 srcs = ["starter_rpc_lib.cc"],
139 hdrs = ["starter_rpc_lib.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800140 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul293b2172021-11-10 16:20:48 -0800141 visibility = ["//visibility:public"],
Tyler Chatowa79419d2020-08-12 20:12:11 -0700142 deps = [
143 ":starter_fbs",
144 ":starter_rpc_fbs",
James Kuszmaul293b2172021-11-10 16:20:48 -0800145 ":starterd_lib",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700146 "//aos:configuration",
147 "//aos:init",
148 "//aos/events:shm_event_loop",
149 ],
150)
151
152cc_binary(
Austin Schuh529ac592021-10-14 16:11:13 -0700153 name = "aos_starter",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700154 srcs = ["starter_cmd.cc"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800155 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh529ac592021-10-14 16:11:13 -0700156 visibility = ["//visibility:public"],
Tyler Chatowa79419d2020-08-12 20:12:11 -0700157 deps = [
158 ":starter_rpc_lib",
Austin Schuhc61e9c02021-04-26 12:10:40 -0700159 "//aos/time",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700160 "@com_github_google_glog//:glog",
Philipp Schrader08537492021-01-23 16:17:55 -0800161 "@com_google_absl//absl/strings:str_format",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700162 ],
163)
164
165flatbuffer_cc_library(
166 name = "starter_fbs",
167 srcs = ["starter.fbs"],
168 gen_reflections = True,
James Kuszmaul6295a642022-03-22 15:23:59 -0700169 includes = ["//aos/util:process_info_fbs_includes"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800170 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatowa79419d2020-08-12 20:12:11 -0700171 visibility = ["//visibility:public"],
172)
173
174flatbuffer_cc_library(
Austin Schuh608514f2022-12-30 15:51:30 -0800175 name = "kthread_fbs",
176 srcs = ["kthread.fbs"],
177 gen_reflections = True,
178 target_compatible_with = ["@platforms//os:linux"],
179 visibility = ["//visibility:public"],
180)
181
182flatbuffer_cc_library(
Tyler Chatowa79419d2020-08-12 20:12:11 -0700183 name = "starter_rpc_fbs",
184 srcs = ["starter_rpc.fbs"],
185 gen_reflections = True,
Philipp Schraderdada1072020-11-24 11:34:46 -0800186 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatowa79419d2020-08-12 20:12:11 -0700187 visibility = ["//visibility:public"],
188)
James Kuszmaul77e19812021-05-19 21:36:10 -0700189
190py_binary(
191 name = "starter_demo",
192 srcs = ["starter_demo.py"],
193 args = [
194 "$(rootpath :starterd)",
195 "\"$(rootpaths //aos/events:pingpong_config)\"",
196 "$(rootpath //aos/events:ping)",
197 "$(rootpath //aos/events:pong)",
Austin Schuh529ac592021-10-14 16:11:13 -0700198 "$(rootpath :aos_starter)",
Austin Schuh48d10d62022-10-16 22:19:23 -0700199 "$(rootpath //aos:aos_dump)",
200 "$(rootpath //aos/events/logging:logger_main)",
James Kuszmaul77e19812021-05-19 21:36:10 -0700201 ],
202 data = [
Austin Schuh529ac592021-10-14 16:11:13 -0700203 ":aos_starter",
James Kuszmaul77e19812021-05-19 21:36:10 -0700204 ":starterd",
Austin Schuh48d10d62022-10-16 22:19:23 -0700205 "//aos:aos_dump",
James Kuszmaul77e19812021-05-19 21:36:10 -0700206 "//aos/events:ping",
207 "//aos/events:pingpong_config",
208 "//aos/events:pong",
Austin Schuh48d10d62022-10-16 22:19:23 -0700209 "//aos/events/logging:logger_main",
James Kuszmaul77e19812021-05-19 21:36:10 -0700210 ],
211)
Austin Schuh2ec71fd2022-12-30 14:48:59 -0800212
213cc_library(
214 name = "irq_affinity_lib",
215 srcs = ["irq_affinity_lib.cc"],
216 hdrs = ["irq_affinity_lib.h"],
217 deps = [
218 "//aos/scoped:scoped_fd",
219 "@com_github_google_glog//:glog",
220 "@com_google_absl//absl/strings",
221 ],
222)
223
Austin Schuh608514f2022-12-30 15:51:30 -0800224cc_binary(
225 name = "irq_affinity",
226 srcs = [
227 "irq_affinity.cc",
228 ],
229 deps = [
230 ":irq_affinity_lib",
231 ":kthread_fbs",
232 "//aos:init",
233 "//aos:realtime",
234 "//aos/events:shm_event_loop",
235 "//aos/util:top",
236 ],
237)
238
Austin Schuh2ec71fd2022-12-30 14:48:59 -0800239cc_test(
240 name = "irq_affinity_lib_test",
241 srcs = ["irq_affinity_lib_test.cc"],
242 deps = [
243 ":irq_affinity_lib",
244 "//aos/testing:googletest",
245 ],
246)