const PROTO_FILES: &[&str] = &[
"proto/auth.proto",
"proto/matchmaking.proto",
"proto/telemetry.proto",
];
fn main() -> Result<(), Box<dyn std::error::Error>> {
for proto in PROTO_FILES {
println!("cargo:rerun-if-changed={proto}");
}
#[cfg(feature = "grpc")]
{
let target_arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap_or_default();
let is_wasm = target_arch == "wasm32";
if is_wasm {
tonic_prost_build::configure()
.build_client(false)
.build_server(false)
.compile_protos(PROTO_FILES, &["proto"])?;
} else {
tonic_prost_build::configure().compile_protos(PROTO_FILES, &["proto"])?;
}
}
Ok(())
}