-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
57 changed files
with
1,928 additions
and
996 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,28 @@ | ||
// The custom build script, needed as we use protocolbuffers. | ||
use std::{env, path::PathBuf}; | ||
|
||
fn main() -> Result<(), anyhow::Error> { | ||
let root = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("protos"); | ||
let proto_files = ["viguno/v1/simulation.proto"] | ||
.iter() | ||
.map(|f| root.join(f)) | ||
.collect::<Vec<_>>(); | ||
|
||
// Tell cargo to recompile if any of these proto files are changed | ||
for proto_file in &proto_files { | ||
println!("cargo:rerun-if-changed={}", proto_file.display()); | ||
} | ||
|
||
let descriptor_path = PathBuf::from(env::var("OUT_DIR").unwrap()).join("proto_descriptor.bin"); | ||
|
||
fn main() { | ||
prost_build::Config::new() | ||
.protoc_arg("-Isrc/proto") | ||
// Save descriptors to file | ||
.file_descriptor_set_path(&descriptor_path) | ||
// Add serde serialization and deserialization to the generated code. | ||
.type_attribute(".", "#[derive(serde::Serialize, serde::Deserialize)]") | ||
// Skip serializing `None` values. | ||
.type_attribute(".", "#[serde_with::skip_serializing_none]") | ||
// Define the protobuf files to compile. | ||
.compile_protos(&["viguno/v1/simulation.proto"], &["src/"]) | ||
.unwrap(); | ||
.compile_protos(&proto_files, &[root])?; | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.