use std::path::PathBuf; fn main() { let proto_root = PathBuf::from(env!("CARGO_MANIFEST_DIR")) .join("../../proto") .canonicalize() .expect("proto root must exist"); let proto_files = [ proto_root.join("continuum/v1/material.proto"), proto_root.join("continuum/v1/print_params.proto"), proto_root.join("continuum/v1/template.proto"), proto_root.join("continuum/v1/print_job.proto"), ]; for file in &proto_files { println!("cargo:rerun-if-changed={}", file.display()); } let mut config = prost_build::Config::new(); config.type_attribute(".", "#[derive(serde::Serialize, serde::Deserialize)]"); config.type_attribute(".", "#[serde(rename_all = \"camelCase\")]"); config .compile_protos(&proto_files, &[proto_root]) .expect("failed to compile continuum .proto sources"); }