Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "pq-bindings-c-rust"
name = "c_hash_sig_crust"
version = "0.1.0"
edition = "2021"

Expand All @@ -12,5 +12,4 @@ rand = "0.9"
bincode = { version = "2.0.1", features = ["serde"] }

[build-dependencies]
cbindgen = "0.27"

build-helper = { path = "../build-helper" }
26 changes: 1 addition & 25 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,29 +1,5 @@
extern crate cbindgen;

use std::env;
use std::fs;
use std::path::PathBuf;

fn main() {
let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
let package_name = env::var("CARGO_PKG_NAME").unwrap();

// Create include directory in project root
let include_dir = PathBuf::from(&crate_dir).join("include");
fs::create_dir_all(&include_dir).expect("Unable to create include directory");

let output_file = include_dir
.join(format!("{}.h", package_name))
.display()
.to_string();

cbindgen::Builder::new()
.with_crate(crate_dir)
.with_language(cbindgen::Language::C)
.generate()
.expect("Unable to generate bindings")
.write_to_file(&output_file);

println!("cargo:rerun-if-changed=src/lib.rs");
build_helper::run_cbindgen();
}