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