Skip to content

Commit

Permalink
cheng-cmd: Add 'date built' to version command
Browse files Browse the repository at this point in the history
  • Loading branch information
francorbacho committed Feb 2, 2024
1 parent 8a3e3c1 commit 26843c5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cheng-cmd/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ fn main() {
"dirty"
};

let date = Command::new("date").arg("-R").output().unwrap().stdout;
let date = String::from_utf8(date).unwrap();

println!("cargo:rustc-env=GIT_HASH={git_hash}");
println!("cargo:rustc-env=GIT_DIRTY={git_dirty}");
println!("cargo:rustc-env=DATE={date}");
}
2 changes: 2 additions & 0 deletions cheng-cmd/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ fn version() {

const GIT_HASH: &str = env!("GIT_HASH");
const GIT_DIRTY: &str = env!("GIT_DIRTY");
const DATE: &str = env!("DATE");

let version = format!("{GIT_HASH}-{GIT_DIRTY}");

Expand All @@ -112,6 +113,7 @@ fn version() {
let bishop_hash_size = size_of_val(unsafe { &*addr_of!(cheng::movegen::BISHOP_MOVES) });

println!("cheng-cmd - {version}");
println!("Built: {DATE}");
println!("Rook hash size: {rook_hash_size} (nbits={})", Rook::nbits());
println!(
"Bishop hash size: {bishop_hash_size} (nbits={})",
Expand Down

0 comments on commit 26843c5

Please sign in to comment.