Skip to content

Commit

Permalink
Allow usage of installed protoc
Browse files Browse the repository at this point in the history
When protoc-bin-vendored does not work (notably on ARM), do not crash
but allow for the installed protoc to be used.
  • Loading branch information
lukipuki committed Mar 20, 2024
1 parent db93102 commit bb7c9b0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,14 @@ fn main() -> std::io::Result<()> {
println!("cargo:rerun-if-changed={}", protobufs_dir);

// Allows protobuf compilation without installing the `protoc` binary
let protoc_path = protoc_bin_vendored::protoc_bin_path().unwrap();
std::env::set_var("PROTOC", protoc_path);
match protoc_bin_vendored::protoc_bin_path() {
Ok(protoc_path) => {
std::env::set_var("PROTOC", protoc_path);
}
Err(err) => {
println!("Install protoc yourself, protoc-bin-vendored failed: {err}");
}
}

let mut protos = vec![];

Expand Down

0 comments on commit bb7c9b0

Please sign in to comment.