diff --git a/Cargo.toml b/Cargo.toml index cf9bfd7..c4fe5ad 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,11 +1,16 @@ [package] -name = "pq-bindings-c-rust" +name = "c_hash_sig_crust" version = "0.1.0" edition = "2021" [lib] +name = "c_hash_sig_crust" crate-type = ["cdylib", "staticlib"] +[features] +# Feature flag to enable kagome-crates integration +kagome-crates = ["build-helper"] + [dependencies] hashsig = { git = "https://github.com/b-wagn/hash-sig" } rand = "0.9" @@ -13,4 +18,4 @@ bincode = { version = "2.0.1", features = ["serde"] } [build-dependencies] cbindgen = "0.27" - +build-helper = { path = "../build-helper", optional = true } diff --git a/build.rs b/build.rs index 2142c4a..31e3682 100644 --- a/build.rs +++ b/build.rs @@ -1,10 +1,14 @@ -extern crate cbindgen; - -use std::env; -use std::fs; -use std::path::PathBuf; +#[cfg(feature = "kagome-crates")] +fn main() { + build_helper::run_cbindgen(); +} +#[cfg(not(feature = "kagome-crates"))] fn main() { + use std::env; + use std::fs; + use std::path::PathBuf; + let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap(); let package_name = env::var("CARGO_PKG_NAME").unwrap(); @@ -26,4 +30,3 @@ fn main() { println!("cargo:rerun-if-changed=src/lib.rs"); } -