-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.rs
34 lines (28 loc) · 835 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
use std::process::Command;
#[cfg(windows)]
fn main() {
let version = git_semver();
let hash = git_hash();
println!("cargo:rustc-env=GIT_PKG_VERSION_SEMVER={}", version);
let mut res = winres::WindowsResource::new();
res.set_icon("app.ico")
.set_language(0x0409)
.set("FileDescription", &format!("Lyche {}", hash));
res.compile().unwrap();
}
fn git_semver() -> String {
let output = Command::new("git")
.args(&["describe", "HEAD"])
.output()
.unwrap();
String::from_utf8(output.stdout).unwrap().trim().to_string()
}
fn git_hash() -> String {
let output = Command::new("git")
.args(&["rev-parse", "--short", "HEAD"])
.output()
.unwrap();
String::from_utf8(output.stdout).unwrap().trim().to_string()
}
#[cfg(unix)]
fn main() {}