-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a3248c7
commit b96b417
Showing
3 changed files
with
9 additions
and
14 deletions.
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
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 |
---|---|---|
@@ -1,19 +1,14 @@ | ||
extern crate cbindgen; | ||
|
||
use std::env; | ||
#[cfg(feature = "cbindgen")] | ||
fn main() { | ||
use std::env; | ||
|
||
fn write_headers() { | ||
let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap(); | ||
let config = cbindgen::Config::from_file("cbindgen.toml").unwrap(); | ||
|
||
let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap(); | ||
cbindgen::generate_with_config(&crate_dir, config) | ||
.expect("Unable to generate bindings") | ||
.write_to_file("include/header.h"); | ||
} | ||
|
||
fn main() { | ||
let headers_enabled = env::var_os("CARGO_FEATURE_HEADERS").is_some(); | ||
if headers_enabled { | ||
write_headers(); | ||
} | ||
} | ||
#[cfg(not(feature = "cbindgen"))] | ||
fn main() { } |
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