mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-02 22:54:36 +00:00
By default, enable the GL backend also on desktop
So it can be chosen with an env variable or if Qt is not available
This commit is contained in:
parent
58904f1858
commit
46dbb1ee9e
4 changed files with 17 additions and 1 deletions
|
@ -14,6 +14,9 @@ path = "lib.rs"
|
||||||
[features]
|
[features]
|
||||||
x11 = ["sixtyfps-rendering-backend-default/x11"]
|
x11 = ["sixtyfps-rendering-backend-default/x11"]
|
||||||
wayland = ["sixtyfps-rendering-backend-default/wayland"]
|
wayland = ["sixtyfps-rendering-backend-default/wayland"]
|
||||||
|
backend-gl = ["sixtyfps-rendering-backend-default/sixtyfps-rendering-backend-gl"]
|
||||||
|
backend-qt = ["sixtyfps-rendering-backend-default/sixtyfps-rendering-backend-qt"]
|
||||||
|
default = ["backend-gl", "backend-qt"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
once_cell = "1.5"
|
once_cell = "1.5"
|
||||||
|
|
|
@ -13,7 +13,7 @@ path = "lib.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
sixtyfps-corelib = { version = "=0.0.4", path = "../corelib", features = ["rtti"] }
|
sixtyfps-corelib = { version = "=0.0.4", path = "../corelib", features = ["rtti"] }
|
||||||
sixtyfps-rendering-backend-default = { version = "=0.0.4", path = "../../sixtyfps_runtime/rendering_backends/default" }
|
sixtyfps-rendering-backend-default = { version = "=0.0.4", path = "../../sixtyfps_runtime/rendering_backends/default", features = ["sixtyfps-rendering-backend-gl"] }
|
||||||
vtable = { version = "0.1.1", path="../../helper_crates/vtable" }
|
vtable = { version = "0.1.1", path="../../helper_crates/vtable" }
|
||||||
sixtyfps-compilerlib = { version = "=0.0.4", path = "../../sixtyfps_compiler" }
|
sixtyfps-compilerlib = { version = "=0.0.4", path = "../../sixtyfps_compiler" }
|
||||||
lyon = { version = "0.16" }
|
lyon = { version = "0.16" }
|
||||||
|
|
|
@ -7,6 +7,13 @@
|
||||||
This file is also available under commercial licensing terms.
|
This file is also available under commercial licensing terms.
|
||||||
Please contact info@sixtyfps.io for more information.
|
Please contact info@sixtyfps.io for more information.
|
||||||
LICENSE END */
|
LICENSE END */
|
||||||
|
/*!
|
||||||
|
The purpose of this crate is to select the default backend for [SixtyFPS](https://sixtyfps.io)
|
||||||
|
|
||||||
|
The backend can either be a runtime or a build time decision. The runtime decision is decided
|
||||||
|
by the `SIXTYFPS_BACKEND` environment variable. The built time default depends on the platform.
|
||||||
|
In order for the crate to be available at runtime, they need to be added as feature
|
||||||
|
*/
|
||||||
|
|
||||||
use sixtyfps_corelib::window::ComponentWindow;
|
use sixtyfps_corelib::window::ComponentWindow;
|
||||||
|
|
||||||
|
@ -42,6 +49,10 @@ pub fn create_window() -> ComponentWindow {
|
||||||
eprintln!("Could not load rendering backend {}, fallback to default", backend_config)
|
eprintln!("Could not load rendering backend {}, fallback to default", backend_config)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "sixtyfps-rendering-backend-qt")]
|
||||||
|
if sixtyfps_rendering_backend_qt::IS_AVAILABLE {
|
||||||
|
return sixtyfps_rendering_backend_qt::create_window();
|
||||||
|
}
|
||||||
default_backend::create_window()
|
default_backend::create_window()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,6 +84,8 @@ pub type NativeWidgets = ();
|
||||||
pub type NativeGlobals = ();
|
pub type NativeGlobals = ();
|
||||||
|
|
||||||
pub const HAS_NATIVE_STYLE: bool = cfg!(not(no_qt));
|
pub const HAS_NATIVE_STYLE: bool = cfg!(not(no_qt));
|
||||||
|
/// False if the backend was compiled without Qt so it wouldn't do anything
|
||||||
|
pub const IS_AVAILABLE: bool = cfg!(not(no_qt));
|
||||||
|
|
||||||
pub fn create_window() -> ComponentWindow {
|
pub fn create_window() -> ComponentWindow {
|
||||||
#[cfg(no_qt)]
|
#[cfg(no_qt)]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue