cargo_openvm/
lib.rs
1pub mod commands;
2pub mod default;
3pub mod input;
4mod util;
5
6use std::process::{Command, Stdio};
7
8use eyre::{Context, Result};
9
10pub const RUSTUP_TOOLCHAIN_NAME: &str = "nightly-2025-02-14";
11
12pub const OPENVM_VERSION_MESSAGE: &str = concat!(
13 "openvm",
14 " (",
15 env!("VERGEN_GIT_SHA"),
16 " ",
17 env!("VERGEN_BUILD_TIMESTAMP"),
18 ")"
19);
20
21#[allow(dead_code)]
22trait CommandExecutor {
23 fn run(&mut self) -> Result<()>;
24}
25
26impl CommandExecutor for Command {
27 fn run(&mut self) -> Result<()> {
28 self.stderr(Stdio::inherit())
29 .stdout(Stdio::inherit())
30 .stdin(Stdio::inherit())
31 .output()
32 .with_context(|| format!("while executing `{:?}`", &self))
33 .map(|_| ())
34 }
35}
36
37#[allow(unreachable_code)]
38pub fn is_supported_target() -> bool {
39 #[cfg(all(target_arch = "x86_64", target_os = "linux"))]
40 return true;
41
42 #[cfg(all(target_arch = "aarch64", target_os = "linux"))]
43 return true;
44
45 #[cfg(all(target_arch = "x86_64", target_os = "macos"))]
46 return true;
47
48 #[cfg(all(target_arch = "aarch64", target_os = "macos"))]
49 return true;
50
51 false
52}
53
54pub fn get_target() -> String {
55 target_lexicon::HOST.to_string()
56}