fix building with cargo (dont build the bindings file unless ESP32 env variables are present). ready to merge
This commit is contained in:
parent
9d8fccc2e3
commit
90298ad35d
2
build.rs
2
build.rs
|
|
@ -2,11 +2,13 @@ use std::path::{Path, PathBuf};
|
||||||
use std::{env, time};
|
use std::{env, time};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
if env::var("CARGO_BUILD_TARGET_DIR").is_ok() {
|
||||||
let cargo_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
|
let cargo_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
|
||||||
let target_dir = PathBuf::from(env::var("CARGO_BUILD_TARGET_DIR").unwrap());
|
let target_dir = PathBuf::from(env::var("CARGO_BUILD_TARGET_DIR").unwrap());
|
||||||
|
|
||||||
run_cbindgen(&cargo_dir, &target_dir);
|
run_cbindgen(&cargo_dir, &target_dir);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn run_cbindgen(cargo_dir: &Path, target_dir: &Path) {
|
fn run_cbindgen(cargo_dir: &Path, target_dir: &Path) {
|
||||||
let out = target_dir.join("drone_controller.h");
|
let out = target_dir.join("drone_controller.h");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue