Skip to content

Commit 461495d

Browse files
chore(cli): CLI version command display enabled special features [cuda] (#2109)
1 parent 0c9f423 commit 461495d

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

crates/cli/build.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
11
fn main() {
22
vergen::EmitBuilder::builder().git_sha(true).emit().unwrap();
3+
4+
// Define features to check and display
5+
let features_to_check = vec!["cuda", "tco"];
6+
7+
// Check which of these features are enabled
8+
let mut enabled_features = Vec::new();
9+
for feature in features_to_check {
10+
let env_var = format!("CARGO_FEATURE_{}", feature.to_uppercase().replace('-', "_"));
11+
if std::env::var(&env_var).is_ok() {
12+
enabled_features.push(feature);
13+
}
14+
}
15+
16+
if !enabled_features.is_empty() {
17+
let features_str = enabled_features.join(", ");
18+
println!("Building cargo-openvm with features: {features_str}");
19+
}
320
}

crates/cli/src/lib.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,34 @@ use std::process::{Command, Stdio};
1111
use eyre::{Context, Result};
1212
pub use openvm_build::{get_rustup_toolchain_name, DEFAULT_RUSTUP_TOOLCHAIN_NAME};
1313

14+
#[cfg(all(feature = "cuda", feature = "tco"))]
15+
pub const OPENVM_VERSION_MESSAGE: &str = concat!(
16+
"v",
17+
env!("CARGO_PKG_VERSION"),
18+
" (",
19+
env!("VERGEN_GIT_SHA"),
20+
") [cuda, tco]"
21+
);
22+
23+
#[cfg(all(feature = "cuda", not(feature = "tco")))]
24+
pub const OPENVM_VERSION_MESSAGE: &str = concat!(
25+
"v",
26+
env!("CARGO_PKG_VERSION"),
27+
" (",
28+
env!("VERGEN_GIT_SHA"),
29+
") [cuda]"
30+
);
31+
32+
#[cfg(all(not(feature = "cuda"), feature = "tco"))]
33+
pub const OPENVM_VERSION_MESSAGE: &str = concat!(
34+
"v",
35+
env!("CARGO_PKG_VERSION"),
36+
" (",
37+
env!("VERGEN_GIT_SHA"),
38+
") [tco]"
39+
);
40+
41+
#[cfg(all(not(feature = "cuda"), not(feature = "tco")))]
1442
pub const OPENVM_VERSION_MESSAGE: &str = concat!(
1543
"v",
1644
env!("CARGO_PKG_VERSION"),

0 commit comments

Comments
 (0)