forked from filecoin-project/sapling-crypto
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automatically generate C header from Rust API (zcash#97)
* generate C header file on build using cbindgen * add newlines
- Loading branch information
Showing
4 changed files
with
25 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
**/*.rs.bk | ||
Cargo.lock | ||
.criterion | ||
**/libproofs.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
extern crate cbindgen; | ||
|
||
const VERSION: &'static str = env!("CARGO_PKG_VERSION"); | ||
|
||
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)); | ||
|
||
cbindgen::Builder::new() | ||
.with_config(cfg) | ||
.with_crate(crate_dir) | ||
.with_header(format!("/* libproofs Header Version {} */", VERSION)) | ||
.with_language(cbindgen::Language::C) | ||
.generate() | ||
.expect("Unable to generate bindings") | ||
.write_to_file("libproofs.h"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[export] | ||
# A list of symbols to not include in the generated bindings | ||
exclude = ["MerkleTree"] |