1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-10-22 15:59:35 +00:00

build(core/rust): provide a default value for BUILD_DIR

to make it easier to run cargo separately, and support rust-analyzer
without tweaking its config
This commit is contained in:
matejcik 2024-09-25 11:53:27 +02:00 committed by Vít Obrusník
parent 775780cc8b
commit df8be364fb

View File

@ -3,6 +3,7 @@ use std::ffi::OsStr;
use std::{env, path::PathBuf, process::Command};
fn main() {
println!("cargo:rustc-env=BUILD_DIR={}", build_dir());
#[cfg(feature = "micropython")]
generate_qstr_bindings();
#[cfg(feature = "micropython")]
@ -15,7 +16,13 @@ fn main() {
}
fn build_dir() -> String {
env::var("BUILD_DIR").expect("BUILD_DIR not defined")
let build_dir_str = env::var("BUILD_DIR").unwrap_or(String::from("../../build/unix"));
PathBuf::from(build_dir_str)
.canonicalize()
.unwrap()
.to_str()
.unwrap()
.to_string()
}
const DEFAULT_BINDGEN_MACROS_COMMON: &[&str] = &[