24 lines
605 B
Rust
24 lines
605 B
Rust
use {
|
|
std::{env, io},
|
|
winresource::WindowsResource,
|
|
};
|
|
|
|
use std::process::Command;
|
|
|
|
fn main() -> io::Result<()> {
|
|
if env::var_os("CARGO_CFG_WINDOWS").is_some() {
|
|
WindowsResource::new()
|
|
// This path can be absolute, or relative to your crate root.
|
|
.set_icon("assets/icon.ico")
|
|
.compile()?;
|
|
}
|
|
|
|
let output = Command::new("git")
|
|
.args(&["rev-parse", "--short", "HEAD"])
|
|
.output()
|
|
.unwrap();
|
|
let git_hash = String::from_utf8(output.stdout).unwrap();
|
|
println!("cargo:rustc-env=GIT_HASH={}", git_hash);
|
|
Ok(())
|
|
}
|