-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathbuild.rs
30 lines (24 loc) · 808 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::{env, io};
fn set_env(var_name: &str) {
println!("cargo:rerun-if-env-changed={var_name}");
if let Ok(var) = env::var(var_name) {
println!("cargo:rustc-cfg={var_name}=\"{var}\"");
}
}
fn main() -> io::Result<()> {
#[cfg(target_os = "windows")]
if env::var_os("CARGO_CFG_WINDOWS").is_some() && std::env::var("PROFILE").unwrap() == "release"
{
// https://github.com/mxre/winres/
winres::WindowsResource::new()
.set_icon("res/windows/app_icon.ico")
.compile()?;
}
set_env("ANDROID_MIC_FORMAT");
// build protobuf
prost_build::Config::new()
.out_dir("src/streamer")
.compile_protos(&["src/proto/message.proto"], &["src/proto"])
.expect("Failed to compile protobuf files");
Ok(())
}