-
Notifications
You must be signed in to change notification settings - Fork 12
/
build.rs
26 lines (24 loc) · 916 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
use std::io;
use winres::WindowsResource;
// Issues with winres to keep in mind:
// https://github.com/mxre/winres/issues/32
// https://github.com/mxre/winres/issues/40
fn main() -> io::Result<()> {
if std::env::var("CARGO_CFG_TARGET_FAMILY").unwrap() == "windows" {
let mut res = WindowsResource::new();
let env = std::env::var("CARGO_CFG_TARGET_ENV").unwrap();
match env.as_str() {
"gnu" => {
// Not sure whether this works the same if build on windows; needs testing
// Perfectly fine if cross compiling from linux
res.set_ar_path("x86_64-w64-mingw32-ar")
.set_windres_path("x86_64-w64-mingw32-windres");
}
"msvc" => {}
_ => panic!("unsupported target-env: {}", env),
};
res.set_icon("assets/icon-256.ico");
res.compile()?;
}
Ok(())
}