mirror of
https://github.com/chatmail/core.git
synced 2026-05-16 13:26:38 +03:00
feat: reorg code, and prepare for c bindings
This commit is contained in:
29
build.rs
29
build.rs
@@ -1,9 +1,5 @@
|
||||
extern crate cc;
|
||||
|
||||
use std::env;
|
||||
|
||||
const VERSION: &'static str = env!("CARGO_PKG_VERSION");
|
||||
|
||||
fn link_dylib(lib: &str) {
|
||||
println!("cargo:rustc-link-lib=dylib={}", lib);
|
||||
}
|
||||
@@ -31,29 +27,6 @@ fn build_tools() {
|
||||
println!("rerun-if-changed=misc.c");
|
||||
}
|
||||
|
||||
fn generate_bindings() {
|
||||
let crate_dir = 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_header(format!("/* deltachat Header Version {} */", VERSION))
|
||||
// .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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
build_tools();
|
||||
|
||||
@@ -74,6 +47,4 @@ fn main() {
|
||||
} else if std::env::var("TARGET").unwrap().contains("linux") {
|
||||
link_dylib("etpan");
|
||||
}
|
||||
|
||||
// generate_bindings();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user