fix building with cargo (dont build the bindings file unless ESP32 env variables are present). ready to merge

This commit is contained in:
franchioping 2026-04-02 16:53:22 +01:00
parent 9d8fccc2e3
commit 90298ad35d
1 changed files with 5 additions and 3 deletions

View File

@ -2,11 +2,13 @@ use std::path::{Path, PathBuf};
use std::{env, time};
fn main() {
if env::var("CARGO_BUILD_TARGET_DIR").is_ok() {
let cargo_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
let target_dir = PathBuf::from(env::var("CARGO_BUILD_TARGET_DIR").unwrap());
run_cbindgen(&cargo_dir, &target_dir);
}
}
fn run_cbindgen(cargo_dir: &Path, target_dir: &Path) {
let out = target_dir.join("drone_controller.h");