-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.rs
31 lines (26 loc) · 950 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
31
fn main() -> std::io::Result<()> {
glib_build_tools::compile_resources(
&["data"],
"data/resources.gresource.xml",
"resources.gresource",
);
if cfg!(target_os = "windows") {
use std::{env, fs, path::PathBuf, process::Command};
let manifest_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
fs::copy(manifest_dir.join("icon.ico"), out_dir.join("icon.ico")).unwrap();
fs::write(out_dir.join("icon.rc"), "icon ICON icon.ico").unwrap();
Command::new("windres")
.current_dir(&out_dir)
.arg("icon.rc")
.arg("icon.lib")
.spawn()
.unwrap();
println!(
"cargo:rustc-link-search={}",
out_dir.into_os_string().into_string().unwrap()
);
println!("cargo:rustc-link-lib=icon");
}
Ok(())
}