mirror of
https://github.com/chatmail/core.git
synced 2026-05-22 16:26:31 +03:00
feat: reorg code, and prepare for c bindings
This commit is contained in:
23
deltachat-ffi/build.rs
Normal file
23
deltachat-ffi/build.rs
Normal file
@@ -0,0 +1,23 @@
|
||||
fn main() {
|
||||
let crate_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap();
|
||||
|
||||
let cfg = cbindgen::Config::from_root_or_default(std::path::Path::new(&crate_dir));
|
||||
|
||||
let c = cbindgen::Builder::new()
|
||||
.with_config(cfg)
|
||||
.with_crate(crate_dir)
|
||||
.with_language(cbindgen::Language::C)
|
||||
.generate();
|
||||
|
||||
// This is needed to ensure we don't panic if there are errors in the crates code
|
||||
// but rather just tell the rest of the system we can't proceed.
|
||||
match c {
|
||||
Ok(res) => {
|
||||
res.write_to_file("deltachat.h");
|
||||
}
|
||||
Err(err) => {
|
||||
eprintln!("unable to generate bindings: {:#?}", err);
|
||||
std::process::exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user