-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
build.rs
35 lines (29 loc) · 807 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
32
33
34
35
#[cfg(windows)]
extern crate winres;
fn copyright_string() {
use std::io::Write;
use astrolabe::DateUtilities;
let year = astrolabe::Date::now().year();
let out_dir = std::env::var("OUT_DIR").unwrap();
let dest_path = format!("{}/build_info.rs", out_dir);
let mut file = std::fs::File::create(dest_path).unwrap();
writeln!(
&mut file,
"pub const COPYRIGHT: &str = \"© {} Caleb Smith - GPLv3\";",
year
)
.unwrap();
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-changed=src/main.rs");
}
#[cfg(windows)]
fn add_icon() {
let mut res = winres::WindowsResource::new();
res.set_icon("assets/ukmm.ico");
res.compile().unwrap();
}
fn main() {
#[cfg(windows)]
add_icon();
copyright_string();
}