mirror of
https://github.com/ndarilek/tts-rs.git
synced 2024-11-25 14:59:36 +00:00
FFI: Automatically generate bindings when building with ffi feature.
This commit is contained in:
parent
060a057c0f
commit
0644f03f34
|
@ -25,6 +25,9 @@ thiserror = "1"
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
env_logger = "0.8"
|
env_logger = "0.8"
|
||||||
|
|
||||||
|
[build-dependencies]
|
||||||
|
cbindgen = "0.18.0"
|
||||||
|
|
||||||
[target.'cfg(windows)'.dependencies]
|
[target.'cfg(windows)'.dependencies]
|
||||||
tolk = { version = "0.3", optional = true }
|
tolk = { version = "0.3", optional = true }
|
||||||
windows = "0.2"
|
windows = "0.2"
|
||||||
|
|
14
build.rs
14
build.rs
|
@ -8,4 +8,18 @@ fn main() {
|
||||||
println!("cargo:rustc-link-lib=framework=AppKit");
|
println!("cargo:rustc-link-lib=framework=AppKit");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "ffi")]
|
||||||
|
generate_c_bindings();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "ffi")]
|
||||||
|
fn generate_c_bindings() {
|
||||||
|
use std::path::PathBuf;
|
||||||
|
let crate_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap();
|
||||||
|
let mut header_path: PathBuf = std::env::var("OUT_DIR").unwrap().into();
|
||||||
|
header_path.push("tts.h");
|
||||||
|
cbindgen::generate(crate_dir)
|
||||||
|
.unwrap()
|
||||||
|
.write_to_file(header_path);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user