-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.rs
30 lines (25 loc) · 854 Bytes
/
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
use std::path::PathBuf;
use std::{env, io};
#[cfg(windows)]
use winres::WindowsResource;
fn main() -> io::Result<()> {
let descriptor_path = PathBuf::from(env::var("OUT_DIR").unwrap()).join("descriptor.bin");
let protos = glob::glob("./proto/rumgap/**/*.proto")
.unwrap()
.collect::<Result<Vec<PathBuf>, glob::GlobError>>()
.unwrap();
tonic_build::configure()
.file_descriptor_set_path(descriptor_path)
.build_client(false)
.compile_well_known_types(false)
.protoc_arg("--experimental_allow_proto3_optional")
.compile(protos.as_slice(), &["proto"])?;
#[cfg(windows)]
{
WindowsResource::new()
// This path can be absolute, or relative to your crate root.
.set_icon_with_id("icon.ico", "2")
.compile()?;
}
Ok(())
}