Skip to content

Commit

Permalink
add version information for the compiler (#1705)
Browse files Browse the repository at this point in the history
  • Loading branch information
rachitnigam authored Aug 30, 2023
1 parent 74b4053 commit 22cfbb3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/cmdline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ pub struct Opts {
#[argh(switch, long = "dump-ir")]
/// print out the IR after every pass
pub dump_ir: bool,

#[argh(switch, long = "version")]
/// print out the version information
pub version: bool,
}

fn read_path(path: &str) -> Result<PathBuf, String> {
Expand Down
10 changes: 10 additions & 0 deletions src/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ pub fn run_compiler() -> CalyxResult<()> {
// parse the command line arguments into Opts struct
let mut opts = Opts::get_opts()?;

// Return the version and the git commit this was built on
if opts.version {
println!("Calyx compiler version {}", env!("CARGO_PKG_VERSION"));
println!(
"Library location: {}",
option_env!("CALYX_PRIMITIVES_DIR").unwrap_or(".")
);
return Ok(());
}

// enable tracing
env_logger::Builder::new()
.format_timestamp(None)
Expand Down

0 comments on commit 22cfbb3

Please sign in to comment.