-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.rs
45 lines (40 loc) · 1.45 KB
/
build.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
use std::path::{Path, PathBuf};
fn compile_packet(filename: &str, protos: &[impl AsRef<Path>], includes: &[impl AsRef<Path>]) {
let mut build = prost_build::Config::new();
build
.default_package_filename(filename)
.out_dir(PathBuf::from("src/league_protocols"))
.compile_protos(protos, includes)
.unwrap_or_else(|e| {
panic!(
"Failed to compile {} protobuf files (reason: {})",
filename, e
)
});
}
fn main() {
compile_packet(
"simulation_packet",
&[
"league_protocols_definitions/simulation/ssl_simulation_control.proto",
"league_protocols_definitions/simulation/ssl_simulation_robot_control.proto",
"league_protocols_definitions/simulation/ssl_simulation_robot_feedback.proto",
],
&["league_protocols_definitions/simulation/"],
);
compile_packet(
"vision_packet",
&["league_protocols_definitions/vision/messages_robocup_ssl_wrapper.proto"],
&["league_protocols_definitions/vision"],
);
compile_packet(
"game_controller_packet",
&["league_protocols_definitions/game_controller/ssl_gc_referee_message.proto"],
&["league_protocols_definitions/game_controller"],
);
compile_packet(
"robot_packet",
&["league_protocols_definitions/robot/base_wrapper.proto"],
&["league_protocols_definitions/robot"],
);
}