mirror of
https://github.com/slint-ui/slint.git
synced 2025-11-03 13:23:00 +00:00
Disable all backends on android
This commit is contained in:
parent
d63ff9c4c6
commit
cf9f9a4f15
2 changed files with 11 additions and 8 deletions
|
|
@ -33,13 +33,14 @@ accessibility = ["i-slint-backend-winit?/accessibility"]
|
||||||
default = []
|
default = []
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
cfg-if = "1"
|
||||||
i-slint-core = { workspace = true }
|
i-slint-core = { workspace = true }
|
||||||
|
|
||||||
|
[target.'cfg(not(target_os = "android"))'.dependencies]
|
||||||
i-slint-backend-winit = { workspace = true, features = ["default"], optional = true }
|
i-slint-backend-winit = { workspace = true, features = ["default"], optional = true }
|
||||||
i-slint-backend-qt = { workspace = true, features = ["default"], optional = true }
|
i-slint-backend-qt = { workspace = true, features = ["default"], optional = true }
|
||||||
i-slint-backend-linuxkms = { workspace = true, features = ["default"], optional = true }
|
i-slint-backend-linuxkms = { workspace = true, features = ["default"], optional = true }
|
||||||
i-slint-renderer-skia = { workspace = true, optional = true }
|
i-slint-renderer-skia = { workspace = true, optional = true }
|
||||||
|
|
||||||
cfg-if = "1"
|
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
i-slint-common = { workspace = true }
|
i-slint-common = { workspace = true }
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
)),
|
)),
|
||||||
no_std
|
no_std
|
||||||
)]
|
)]
|
||||||
|
#![allow(unused)]
|
||||||
|
|
||||||
extern crate alloc;
|
extern crate alloc;
|
||||||
|
|
||||||
|
|
@ -18,23 +19,24 @@ use alloc::boxed::Box;
|
||||||
use i_slint_core::platform::Platform;
|
use i_slint_core::platform::Platform;
|
||||||
use i_slint_core::platform::PlatformError;
|
use i_slint_core::platform::PlatformError;
|
||||||
|
|
||||||
#[cfg(all(feature = "i-slint-backend-qt", not(no_qt)))]
|
#[cfg(all(feature = "i-slint-backend-qt", not(no_qt), not(target_os = "android")))]
|
||||||
fn create_qt_backend() -> Result<Box<dyn Platform + 'static>, PlatformError> {
|
fn create_qt_backend() -> Result<Box<dyn Platform + 'static>, PlatformError> {
|
||||||
Ok(Box::new(default_backend::Backend::new()))
|
Ok(Box::new(default_backend::Backend::new()))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "i-slint-backend-winit")]
|
#[cfg(all(feature = "i-slint-backend-winit", not(target_os = "android")))]
|
||||||
fn create_winit_backend() -> Result<Box<dyn Platform + 'static>, PlatformError> {
|
fn create_winit_backend() -> Result<Box<dyn Platform + 'static>, PlatformError> {
|
||||||
Ok(Box::new(i_slint_backend_winit::Backend::new()?))
|
Ok(Box::new(i_slint_backend_winit::Backend::new()?))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "i-slint-backend-linuxkms")]
|
#[cfg(all(feature = "i-slint-backend-linuxkms", not(target_os = "android")))]
|
||||||
fn create_linuxkms_backend() -> Result<Box<dyn Platform + 'static>, PlatformError> {
|
fn create_linuxkms_backend() -> Result<Box<dyn Platform + 'static>, PlatformError> {
|
||||||
Ok(Box::new(i_slint_backend_linuxkms::Backend::new()?))
|
Ok(Box::new(i_slint_backend_linuxkms::Backend::new()?))
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg_if::cfg_if! {
|
cfg_if::cfg_if! {
|
||||||
if #[cfg(all(feature = "i-slint-backend-qt", not(no_qt)))] {
|
if #[cfg(target_os = "android")] {
|
||||||
|
} else if #[cfg(all(feature = "i-slint-backend-qt", not(no_qt)))] {
|
||||||
use i_slint_backend_qt as default_backend;
|
use i_slint_backend_qt as default_backend;
|
||||||
} else if #[cfg(feature = "i-slint-backend-winit")] {
|
} else if #[cfg(feature = "i-slint-backend-winit")] {
|
||||||
use i_slint_backend_winit as default_backend;
|
use i_slint_backend_winit as default_backend;
|
||||||
|
|
@ -46,11 +48,11 @@ cfg_if::cfg_if! {
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg_if::cfg_if! {
|
cfg_if::cfg_if! {
|
||||||
if #[cfg(any(
|
if #[cfg(all(not(target_os = "android"), any(
|
||||||
all(feature = "i-slint-backend-qt", not(no_qt)),
|
all(feature = "i-slint-backend-qt", not(no_qt)),
|
||||||
feature = "i-slint-backend-winit",
|
feature = "i-slint-backend-winit",
|
||||||
feature = "i-slint-backend-linuxkms"
|
feature = "i-slint-backend-linuxkms"
|
||||||
))] {
|
)))] {
|
||||||
fn create_default_backend() -> Result<Box<dyn Platform + 'static>, PlatformError> {
|
fn create_default_backend() -> Result<Box<dyn Platform + 'static>, PlatformError> {
|
||||||
use alloc::borrow::Cow;
|
use alloc::borrow::Cow;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue