Cmake build system for esp32 #1
|
|
@ -0,0 +1 @@
|
|||
target/
|
||||
File diff suppressed because it is too large
Load Diff
31
Cargo.toml
31
Cargo.toml
|
|
@ -1,7 +1,16 @@
|
|||
|
||||
[package]
|
||||
name = "drone_controller"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
edition = "2018"
|
||||
|
||||
[lib]
|
||||
crate-type = ["staticlib"]
|
||||
|
||||
[build-dependencies]
|
||||
bindgen = "0.58"
|
||||
cbindgen = "0.19"
|
||||
|
||||
|
||||
[dependencies]
|
||||
|
||||
|
|
@ -14,8 +23,20 @@ serde_json = "1.0.149"
|
|||
|
||||
clap = { version = "4", features = ["derive"] }
|
||||
|
||||
[lib]
|
||||
crate-type = ["lib", "cdylib"]
|
||||
[features]
|
||||
std = []
|
||||
|
||||
[build-dependencies]
|
||||
cbindgen = "0.29"
|
||||
[profile.dev]
|
||||
# Optimization level 1 is similar to "g" in gcc/clang, although for some reason
|
||||
# Cargo doesn't support that flag.
|
||||
#opt-level = 1
|
||||
opt-level = "s"
|
||||
|
||||
[profile.release]
|
||||
debug = true
|
||||
opt-level = "z"
|
||||
#debug = true
|
||||
#lto = true
|
||||
#opt-level = "z"
|
||||
#codegen-units = 1
|
||||
#panic = "abort"
|
||||
|
|
|
|||
23
build.rs
23
build.rs
|
|
@ -1,11 +1,22 @@
|
|||
extern crate cbindgen;
|
||||
|
||||
use std::env;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
fn main() {
|
||||
let crate_dir = 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 _ = cbindgen::generate(crate_dir)
|
||||
.unwrap()
|
||||
.write_to_file("bindings.h");
|
||||
run_cbindgen(&cargo_dir, &target_dir);
|
||||
}
|
||||
|
||||
fn run_cbindgen(cargo_dir: &Path, target_dir: &Path) {
|
||||
let out = target_dir.join("drone_controller.h");
|
||||
|
||||
cbindgen::Builder::new()
|
||||
.with_crate(cargo_dir)
|
||||
.with_language(cbindgen::Language::C)
|
||||
.generate()
|
||||
.expect("Unable to generate bindings")
|
||||
.write_to_file(&out);
|
||||
|
||||
println!("cargo:rerun-if-changed={}", out.display());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,36 +0,0 @@
|
|||
# This is a template cbindgen.toml file with all of the default values.
|
||||
# Some values are commented out because their absence is the real default.
|
||||
#
|
||||
# See https://github.com/mozilla/cbindgen/blob/main/docs.md#cbindgentoml
|
||||
# for detailed documentation of every option here.
|
||||
|
||||
|
||||
language = "C++"
|
||||
|
||||
|
||||
include_guard = "my_bindings_h"
|
||||
autogen_warning = "/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */"
|
||||
include_version = true
|
||||
|
||||
|
||||
braces = "SameLine"
|
||||
line_length = 100
|
||||
tab_width = 2
|
||||
documentation = true
|
||||
documentation_style = "auto"
|
||||
documentation_length = "full"
|
||||
line_endings = "LF"
|
||||
|
||||
namespace = "dcont"
|
||||
|
||||
|
||||
style = "both"
|
||||
sort_by = "Name"
|
||||
usize_is_size_t = true
|
||||
|
||||
[export]
|
||||
include = []
|
||||
exclude = []
|
||||
# prefix = "DCONT_"
|
||||
item_types = []
|
||||
renaming_overrides_prefixing = false
|
||||
Loading…
Reference in New Issue