-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.rs
33 lines (30 loc) · 1.09 KB
/
build.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
extern crate anyhow;
extern crate cbindgen;
#[cfg(feature = "sqlite")]
fn main() -> anyhow::Result<()> {
let target_os = std::env::var("CARGO_CFG_TARGET_OS")?;
if target_os != "macos" && target_os != "windows" && target_os != "linux" {
println!("cargo:rustc-link-lib=static=sqlite3");
if target_os.as_str() == "android" {
println!("cargo:rustc-link-search=native=./sqlite3/obj/local/arm64-v8a");
} else if target_os == "ios" {
println!("cargo:rustc-link-search=native=./sqlite3/obj/local/arm64-ios");
}
cbindgen::Builder::new()
.with_language(cbindgen::Language::C)
.with_src("./src/ffi.rs")
.generate()
.expect("Unable to generate bindings")
.write_to_file("target/include/ssi_man.h");
}
Ok(())
}
#[cfg(not(feature = "sqlite"))]
fn main() {
cbindgen::Builder::new()
.with_language(cbindgen::Language::C)
.with_src("./src/ffi.rs")
.generate()
.expect("Unable to generate bindings")
.write_to_file("target/include/ssi_man.h");
}