-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.rs
25 lines (23 loc) · 880 Bytes
/
build.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
const GIT_COMMIT: &&str = &"GIT_COMMIT";
const BARRETENBERG_BIN_DIR: &&str = &"BARRETENBERG_BIN_DIR";
fn main() -> Result<(), String> {
if std::env::var(GIT_COMMIT).is_err() {
build_data::set_GIT_COMMIT();
build_data::set_GIT_DIRTY();
build_data::no_debug_rebuilds();
}
match std::env::var(BARRETENBERG_BIN_DIR) {
Ok(bindir) => {
println!("cargo:rustc-env={BARRETENBERG_BIN_DIR}={bindir}");
Ok(())
}
Err(_) => {
if let Ok(bindir) = pkg_config::get_variable("barretenberg", "bindir") {
println!("cargo:rustc-env={BARRETENBERG_BIN_DIR}={bindir}");
Ok(())
} else {
Err("Unable to locate barretenberg.wasm - Please set the BARRETENBERG_BIN_DIR env var to the directory where it exists".into())
}
}
}
}