mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-22 14:28:07 +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:
parent
775780cc8b
commit
df8be364fb
@ -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] = &[
|
||||
|
Loading…
Reference in New Issue
Block a user