Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vstd: Add no-std build mode #772

Closed
wants to merge 10 commits into from
Prev Previous commit
Next Next commit
vstd_build: Allow disabling std and alloc
zhaofengli committed Sep 12, 2023
commit 5d6d650d30aa7a2be173e4af898ac9bb766fc48a
18 changes: 18 additions & 0 deletions source/vstd_build/src/main.rs
Original file line number Diff line number Diff line change
@@ -29,6 +29,8 @@ fn main() {

let mut release = false;
let mut no_verify = false;
let mut no_std = false;
let mut no_alloc = false;
let mut verbose = false;
for arg in args {
if arg == "--release" {
@@ -37,11 +39,19 @@ fn main() {
no_verify = true;
} else if arg == "--verbose" {
verbose = true;
} else if arg == "--no-std" {
no_std = true;
} else if arg == "--no-alloc" {
no_alloc = true;
} else {
panic!("unexpected argument: {:}", arg)
}
}

if !no_std && no_alloc {
panic!("--no-alloc must be specified along with --no-std");
}

#[cfg(target_os = "macos")]
let (pre, dl) = ("lib", "dylib");

@@ -89,6 +99,14 @@ fn main() {
child_args.push("-C".to_string());
child_args.push("opt-level=3".to_string());
}
if !no_std {
child_args.push("--cfg".to_string());
child_args.push("feature=\"std\"".to_string());
}
if !no_alloc {
child_args.push("--cfg".to_string());
child_args.push("feature=\"alloc\"".to_string());
}
child_args.push(VSTD_RS_PATH.to_string());

let cmd = verus_target_path.join("rust_verify");