-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
68 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
[env] | ||
RUST_LOG = "info" | ||
RUST_LOG = "info" | ||
CAIRO_PATH = "cairo" | ||
BOOTLOADER_PATH = "bootloader/recursive_with_poseidon/simple_bootloader.cairo" | ||
BOOTLOADER_OUT_NAME = "bootloader.json" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,41 @@ | ||
use std::env; | ||
use std::path::PathBuf; | ||
use std::process::Command; | ||
|
||
fn main() { | ||
// Check if cairo-run command is present | ||
Command::new("cairo-run") | ||
.arg("--version") | ||
.output() | ||
.expect("Failed to execute cairo-run command"); | ||
check_command("cairo-run"); | ||
|
||
// Check if cairo-compile command is present | ||
check_command("cairo-compile"); | ||
|
||
let workspace_root = | ||
PathBuf::from(env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR env not present")) | ||
.join("../../"); | ||
let out_dir = | ||
PathBuf::from(env::var("OUT_DIR").expect("OUT_DIR env not present")).join("../../../../"); | ||
let cairo_path = PathBuf::from(env::var("CAIRO_PATH").expect("CAIRO_PATH env not present")); | ||
let bootloader_path = | ||
PathBuf::from(env::var("BOOTLOADER_PATH").expect("BOOTLOADER_PATH env not present")); | ||
let bootloader_out_name = PathBuf::from( | ||
env::var("BOOTLOADER_OUT_NAME").expect("BOOTLOADER_OUT_NAME env not present"), | ||
); | ||
|
||
// Compile Bootloader | ||
Command::new("cairo-compile") | ||
.arg("--version") | ||
.arg("--cairo_path") | ||
.arg(&workspace_root.join(&cairo_path)) | ||
.arg(&workspace_root.join(&cairo_path).join(&bootloader_path)) | ||
.arg("--output") | ||
.arg(&out_dir.join(&bootloader_out_name)) | ||
.arg("--proof_mode") | ||
.output() | ||
.expect("Failed to execute cairo-compile command"); | ||
.expect("bootloader compile failed"); | ||
} | ||
|
||
fn check_command(cmd: &str) { | ||
match Command::new(cmd).arg("--version").output() { | ||
Ok(_) => println!("{} command found", cmd), | ||
Err(e) => panic!("Failed to execute {} command: {}", cmd, e), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters