-
-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathbuild.rs
More file actions
28 lines (23 loc) · 678 Bytes
/
build.rs
File metadata and controls
28 lines (23 loc) · 678 Bytes
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
use std::{
env,
io::{self},
};
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<()> {
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")
.set_manifest_file("res/windows/manifest.xml")
.compile()?;
}
set_env("FAN_CONTROL_VERSION");
set_env("FAN_CONTROL_COMMIT");
Ok(())
}