mirror of
https://github.com/ndarilek/tts-rs.git
synced 2024-11-23 03:59:37 +00:00
Gate Tolk behind use_tolk feature to support compilation on UWP.
This commit is contained in:
parent
6eb03fb1a3
commit
fa216a534e
|
@ -11,6 +11,10 @@ edition = "2018"
|
|||
[lib]
|
||||
crate-type = ["lib", "cdylib", "staticlib"]
|
||||
|
||||
[features]
|
||||
|
||||
use_tolk = ["tolk"]
|
||||
|
||||
[dependencies]
|
||||
lazy_static = "1"
|
||||
log = "0.4"
|
||||
|
@ -20,7 +24,7 @@ thiserror = "1"
|
|||
env_logger = "0.7"
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
tolk = ">= 0.2.1"
|
||||
tolk = { version = ">= 0.2.1", optional = true }
|
||||
winrt = "0.7"
|
||||
tts_winrt_bindings = { version = "0.1", path="winrt_bindings" }
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#[cfg(target_os = "linux")]
|
||||
mod speech_dispatcher;
|
||||
|
||||
#[cfg(windows)]
|
||||
#[cfg(all(windows, feature = "use_tolk"))]
|
||||
mod tolk;
|
||||
|
||||
#[cfg(windows)]
|
||||
|
@ -19,7 +19,7 @@ mod av_foundation;
|
|||
#[cfg(target_os = "linux")]
|
||||
pub(crate) use self::speech_dispatcher::*;
|
||||
|
||||
#[cfg(windows)]
|
||||
#[cfg(all(windows, feature = "use_tolk"))]
|
||||
pub(crate) use self::tolk::*;
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#[cfg(windows)]
|
||||
#[cfg(all(windows, feature = "use_tolk"))]
|
||||
use log::{info, trace};
|
||||
use tolk::Tolk as TolkPtr;
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ pub enum Backends {
|
|||
SpeechDispatcher,
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
Web,
|
||||
#[cfg(windows)]
|
||||
#[cfg(all(windows, feature = "use_tolk"))]
|
||||
Tolk,
|
||||
#[cfg(windows)]
|
||||
WinRT,
|
||||
|
@ -167,7 +167,7 @@ impl TTS {
|
|||
let tts = backends::Web::new()?;
|
||||
Ok(TTS(Box::new(tts)))
|
||||
}
|
||||
#[cfg(windows)]
|
||||
#[cfg(all(windows, feature = "use_tolk"))]
|
||||
Backends::Tolk => {
|
||||
let tts = backends::Tolk::new();
|
||||
if let Some(tts) = tts {
|
||||
|
@ -200,12 +200,14 @@ impl TTS {
|
|||
pub fn default() -> Result<TTS, Error> {
|
||||
#[cfg(target_os = "linux")]
|
||||
let tts = TTS::new(Backends::SpeechDispatcher);
|
||||
#[cfg(windows)]
|
||||
#[cfg(all(windows, feature = "use_tolk"))]
|
||||
let tts = if let Ok(tts) = TTS::new(Backends::Tolk) {
|
||||
Ok(tts)
|
||||
} else {
|
||||
TTS::new(Backends::WinRT)
|
||||
};
|
||||
#[cfg(all(windows, not(feature = "use_tolk")))]
|
||||
let tts = TTS::new(Backends::WinRT);
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
let tts = TTS::new(Backends::Web);
|
||||
#[cfg(target_os = "macos")]
|
||||
|
|
Loading…
Reference in New Issue
Block a user