-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathbuild.rs
More file actions
28 lines (26 loc) · 1.02 KB
/
build.rs
File metadata and controls
28 lines (26 loc) · 1.02 KB
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
fn main() {
println!("cargo:rerun-if-changed=assets/icons/linuxdo.ico");
println!("cargo:rerun-if-env-changed=LINUXDO_BUILD_VERSION");
println!("cargo:rerun-if-env-changed=RELEASE_VERSION");
let build_version = std::env::var("LINUXDO_BUILD_VERSION")
.ok()
.filter(|value| !value.trim().is_empty())
.or_else(|| {
std::env::var("RELEASE_VERSION")
.ok()
.filter(|value| !value.trim().is_empty())
})
.or_else(|| {
std::env::var("CARGO_PKG_VERSION")
.ok()
.filter(|value| !value.trim().is_empty())
})
.unwrap_or_else(|| "0.0.0".to_string());
println!("cargo:rustc-env=LINUXDO_BUILD_VERSION={build_version}");
if std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("windows") {
let mut res = winresource::WindowsResource::new();
res.set_icon("assets/icons/linuxdo.ico");
res.compile()
.expect("failed to compile Windows icon resource");
}
}