1
0
mirror of https://github.com/ndarilek/tts-rs.git synced 2024-11-25 13:29:38 +00:00
tts-rs/build.rs

36 lines
1.3 KiB
Rust
Raw Normal View History

fn main() {
2021-03-11 19:41:03 +00:00
#[cfg(windows)]
if std::env::var("TARGET").unwrap().contains("windows") {
windows::build!(
Windows::Foundation::{EventRegistrationToken, IAsyncOperation, TypedEventHandler},
Windows::Media::Core::MediaSource,
Windows::Media::Playback::{MediaPlaybackSession, MediaPlaybackState, MediaPlayer, MediaPlayerAudioCategory},
Windows::Media::SpeechSynthesis::{SpeechSynthesisStream, SpeechSynthesizer, SpeechSynthesizerOptions},
Windows::Storage::Streams::IRandomAccessStream,
);
2021-03-11 19:41:03 +00:00
}
if std::env::var("TARGET").unwrap().contains("-apple") {
println!("cargo:rustc-link-lib=framework=AVFoundation");
2020-11-17 22:36:33 +00:00
if !std::env::var("CARGO_CFG_TARGET_OS")
.unwrap()
.contains("ios")
{
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);
}