mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 18:58:36 +00:00
Rename the backend feature flags
This commit is contained in:
parent
865d663352
commit
8850959a2c
19 changed files with 139 additions and 149 deletions
|
@ -10,8 +10,7 @@ All notable changes to this project are documented in this file.
|
|||
- `mod` now works on any numeric type, not only integers.
|
||||
- Minimum rust version is now 1.60
|
||||
- The "backend-gl-*" Rust crate features for configuring the GL renderer have been
|
||||
split up into "eventloop-winit/x11/wayland" and "renderer-femtovg". The old
|
||||
names are still available for compatibility.
|
||||
changed and split by renderer
|
||||
- `VecModel::remove` now return the removed element
|
||||
|
||||
### Added
|
||||
|
|
|
@ -80,44 +80,36 @@ endfunction()
|
|||
# defaults need to be kept in sync with the Rust bit.
|
||||
define_cargo_feature(interpreter "Enable support for the Slint interpeter to load .slint files at run-time" ON)
|
||||
|
||||
define_cargo_feature(eventloop-winit "Enable support for the winit crate to interaction with all windowing systems." ON)
|
||||
define_cargo_feature(eventloop-winit-x11 "Enable support for the winit create to interact only with the X11 windowing system on Unix. Enable this option and turn off SLINT_FEATURE_EVENTLOOP_WINIT for a smaller build with just X11 support on Unix." OFF)
|
||||
define_cargo_feature(eventloop-winit-wayland "Enable support for the winit create to interact only with the wayland windowing system on Unix. Enable this option and turn off SLINT_FEATURE_EVENTLOOP_WINIT for a smaller build with just wayland support." OFF)
|
||||
define_cargo_feature(backend-winit "Enable support for the winit crate to interaction with all windowing systems." ON)
|
||||
define_cargo_feature(backend-winit-x11 "Enable support for the winit create to interact only with the X11 windowing system on Unix. Enable this option and turn off SLINT_FEATURE_BACKEND_WINIT for a smaller build with just X11 support on Unix." OFF)
|
||||
define_cargo_feature(backend-winit-wayland "Enable support for the winit create to interact only with the wayland windowing system on Unix. Enable this option and turn off SLINT_FEATURE_BACKEND_WINIT for a smaller build with just wayland support." OFF)
|
||||
|
||||
define_cargo_feature(renderer-femtovg "Enable support for the OpenGL ES 2.0 based FemtoVG rendering engine." ON)
|
||||
define_cargo_feature(renderer-skia "Enable support for the Skia based rendering engine." ON)
|
||||
define_cargo_feature(renderer-skia-opengl "Enable support for the Skia based rendering engine with its OpenGL backend." ON)
|
||||
define_cargo_feature(renderer-winit-femtovg "Enable support for the OpenGL ES 2.0 based FemtoVG rendering engine." ON)
|
||||
define_cargo_feature(renderer-winit-skia "Enable support for the Skia based rendering engine." ON)
|
||||
define_cargo_feature(renderer-winit-skia-opengl "Enable support for the Skia based rendering engine with its OpenGL backend." ON)
|
||||
|
||||
define_cargo_feature(backend-qt "Enable Qt based rendering backend" ON)
|
||||
|
||||
# Compat options
|
||||
option(SLINT_FEATURE_BACKEND_GL_ALL "This feature is an alias for SLINT_FEATURE_EVENTLOOP_WINIT and SLINT_FEATURE_RENDERER_FEMTOVG." OFF)
|
||||
option(SLINT_FEATURE_BACKEND_GL_X11 "This feature is an alias for SLINT_FEATURE_EVENTLOOP_WINIT_X11 and SLINT_FEATURE_RENDERER_FEMTOVG." OFF)
|
||||
option(SLINT_FEATURE_BACKEND_GL_WAYLAND "This feature is an alias for SLINT_FEATURE_EVENTLOOP_WINIT_WAYLAND and SLINT_FEATURE_RENDERER_FEMTOVG." OFF)
|
||||
option(SLINT_FEATURE_BACKEND_GL_ALL "This feature is an alias for SLINT_FEATURE_BACKEND_WINIT and SLINT_FEATURE_RENDERER_FEMTOVG." OFF)
|
||||
option(SLINT_FEATURE_BACKEND_GL_X11 "This feature is an alias for SLINT_FEATURE_BACKEND_WINIT_X11 and SLINT_FEATURE_RENDERER_FEMTOVG." OFF)
|
||||
option(SLINT_FEATURE_BACKEND_GL_WAYLAND "This feature is an alias for SLINT_FEATURE_BACKEND_WINIT_WAYLAND and SLINT_FEATURE_RENDERER_FEMTOVG." OFF)
|
||||
|
||||
if(SLINT_FEATURE_BACKEND_GL_ALL)
|
||||
set(SLINT_FEATURE_EVENTLOOP_WINIT ON)
|
||||
set(SLINT_FEATURE_BACKEND_WINIT ON)
|
||||
set(SLINT_FEATURE_RENDERER_FEMTOVG ON)
|
||||
endif()
|
||||
|
||||
if(SLINT_FEATURE_BACKEND_GL_X11)
|
||||
set(SLINT_FEATURE_EVENTLOOP_WINIT_X11 ON)
|
||||
set(SLINT_FEATURE_BACKEND_WINIT_X11 ON)
|
||||
set(SLINT_FEATURE_RENDERER_FEMTOVG ON)
|
||||
endif()
|
||||
|
||||
if(SLINT_FEATURE_BACKEND_GL_WAYLAND)
|
||||
set(SLINT_FEATURE_EVENTLOOP_WINIT_WAYLAND ON)
|
||||
set(SLINT_FEATURE_BACKEND_WINIT_WAYLAND ON)
|
||||
set(SLINT_FEATURE_RENDERER_FEMTOVG ON)
|
||||
endif()
|
||||
|
||||
# Alias
|
||||
define_cargo_feature(renderer-qt "This feature is an alias for SLINT_FEATURE_BACKEND_QT" OFF)
|
||||
define_cargo_feature(eventloop-qt "This feature is an alias for SLINT_FEATURE_BACKEND_QT" OFF)
|
||||
|
||||
if(SLINT_FEATURE_RENDERER_QT OR SLINT_FEATURE_EVENTLOOP_QT)
|
||||
set(SLINT_FEATURE_BACKEND_QT ON)
|
||||
endif()
|
||||
|
||||
set_property(
|
||||
TARGET slint-cpp
|
||||
PROPERTY CORROSION_FEATURES
|
||||
|
|
|
@ -27,14 +27,14 @@ interpreter = ["slint-interpreter"]
|
|||
testing = ["i-slint-backend-testing"] # Enable some function used by the integration tests
|
||||
|
||||
backend-qt = ["i-slint-backend-selector/i-slint-backend-qt"]
|
||||
eventloop-winit = ["i-slint-backend-selector/eventloop-winit"]
|
||||
eventloop-winit-x11 = ["i-slint-backend-selector/eventloop-winit-x11"]
|
||||
eventloop-winit-wayland = ["i-slint-backend-selector/eventloop-winit-wayland"]
|
||||
renderer-femtovg = ["i-slint-backend-selector/renderer-femtovg"]
|
||||
renderer-skia = ["i-slint-backend-selector/renderer-skia"]
|
||||
renderer-skia-opengl = ["i-slint-backend-selector/renderer-skia-opengl"]
|
||||
backend-winit = ["i-slint-backend-selector/backend-winit"]
|
||||
backend-winit-x11 = ["i-slint-backend-selector/backend-winit-x11"]
|
||||
backend-winit-wayland = ["i-slint-backend-selector/backend-winit-wayland"]
|
||||
renderer-winit-femtovg = ["i-slint-backend-selector/renderer-winit-femtovg"]
|
||||
renderer-winit-skia = ["i-slint-backend-selector/renderer-winit-skia"]
|
||||
renderer-winit-skia-opengl = ["i-slint-backend-selector/renderer-winit-skia-opengl"]
|
||||
|
||||
default = ["eventloop-winit", "renderer-femtovg", "backend-qt"]
|
||||
default = ["backend-winit", "renderer-winit-femtovg", "backend-qt"]
|
||||
|
||||
[dependencies]
|
||||
i-slint-backend-selector = { version = "=0.3.0", path="../../internal/backends/selector" }
|
||||
|
|
|
@ -59,10 +59,10 @@ not enabled by default but that is revelant for you, or you may want to disable
|
|||
therefore reduce the size of the resulting library.
|
||||
|
||||
The CMake configure step offers CMake options for various feature that are all prefixed with `SLINT_FEATURE_`. For example
|
||||
you can make a build that exclusively supports Wayland on Linux by enabling the `SLINT_FEATURE_EVENTLOOP_WINIT_WAYLAND` feature and turning
|
||||
off `SLINT_FEATURE_EVENTLOOP_WINIT`. There are different ways of toggling CMake options. For example on the command line using the `-D` parameter:
|
||||
you can make a build that exclusively supports Wayland on Linux by enabling the `SLINT_FEATURE_BACKEND_WINIT_WAYLAND` feature and turning
|
||||
off `SLINT_FEATURE_BACKEND_WINIT`. There are different ways of toggling CMake options. For example on the command line using the `-D` parameter:
|
||||
|
||||
`cmake -DSLINT_FEATURE_EVENTLOOP_WINIT=OFF -DSLINT_FEATURE_EVENTLOOP_WINIT_WAYLAND=ON ...`
|
||||
`cmake -DSLINT_FEATURE_BACKEND_WINIT=OFF -DSLINT_FEATURE_BACKEND_WINIT_WAYLAND=ON ...`
|
||||
|
||||
Alternatively, after the configure step you can use `cmake-gui` or `ccmake` on the build directory for a list of all features
|
||||
and their description.
|
||||
|
|
|
@ -21,8 +21,8 @@ path = "lib.rs"
|
|||
|
||||
default = [
|
||||
"std",
|
||||
"eventloop-winit",
|
||||
"renderer-femtovg",
|
||||
"backend-winit",
|
||||
"renderer-winit-femtovg",
|
||||
"backend-qt",
|
||||
"compat-0.3.0",
|
||||
]
|
||||
|
@ -58,54 +58,58 @@ unsafe-single-threaded = ["i-slint-core/unsafe-single-threaded"]
|
|||
|
||||
#! ### Backends
|
||||
|
||||
#! Slint needs a backend that will do the liaison between Slint and the OS.
|
||||
#! By default, Slint will use the Qt backend, if Qt is installed, otherwise, it
|
||||
#! will use [Winit](https://crates.io/crates/winit) with [Femtovg](https://crates.io/crates/femtovg).
|
||||
#! Both backends are compiled in. If you want to not compile one of these you need
|
||||
#! to disable the default feature and re-enable one backend. It is also possible
|
||||
#! to use Slint without backend if you provide the platform abstraction yourself
|
||||
#! with [`platform::set_platform()`]
|
||||
#!
|
||||
#! If you enable the Winit backend, you need to also include a renderer.
|
||||
#! `renderer-winit-femtovg` is the only stable renderer, the other ones are experimental
|
||||
#!
|
||||
#! It is also possible to change the backend and renderer at runtime when several
|
||||
#! are enabled, using the `SLINT_BACKEND` environment variable.
|
||||
#! * `SLINT_BACKEND=Qt` forces the Qt backend
|
||||
#! * `SLINT_BACKEND=winit` forces the winit backend
|
||||
#! * `SLINT_BACKEND=winit-femtovg` forces the winit backend with the femtovg renderer
|
||||
#! * `SLINT_BACKEND=winit-skia` forces the winit backend with the skia renderer
|
||||
#! * `SLINT_BACKEND=winit-software` forces the winit backend with the software renderer
|
||||
#! If the specified backend is not existing, the default will be used.
|
||||
|
||||
|
||||
## The Qt backend feature uses Qt for the windowing system integration and rendering.
|
||||
## This backend is required to use the `native` style.
|
||||
## This backend also provide the `native` style.
|
||||
## It requires Qt 5.15 or later to be installed. If Qt is not installed, the
|
||||
## backend will not be operational
|
||||
backend-qt = ["i-slint-backend-selector/i-slint-backend-qt", "std"]
|
||||
|
||||
# The following backend-gl-* are just alias for compatibility
|
||||
backend-gl-all = ["eventloop-winit", "renderer-femtovg"]
|
||||
backend-gl-x11 = ["eventloop-winit-x11", "renderer-femtovg"]
|
||||
backend-gl-wayland = ["eventloop-winit-wayland", "renderer-femtovg"]
|
||||
## The [winit](https://crates.io/crates/log) crate is used for the event loop and windowing system integration.
|
||||
## With this feature, both x11 and wayland windowing systems are supported. For a smaller build, omit
|
||||
## this feature and select one of the other specific `backend-winit-XX` features.
|
||||
backend-winit = ["i-slint-backend-selector/backend-winit", "std"]
|
||||
|
||||
## The the `winit` crate is used for the event loop and windowing system integration.
|
||||
## With this feature, all windowing systems are supported. For a smaller build, omit
|
||||
## this feature and select one of the other specific `eventloop-winit-XX` features.
|
||||
eventloop-winit = ["i-slint-backend-selector/eventloop-winit", "std"]
|
||||
|
||||
## Simliar to `eventloop-winit` this enables the winit based event loop but only
|
||||
## Simliar to `backend-winit` this enables the winit based event loop but only
|
||||
## with support for the X Window System on Unix.
|
||||
eventloop-winit-x11 = ["i-slint-backend-selector/eventloop-winit-x11", "std"]
|
||||
backend-winit-x11 = ["i-slint-backend-selector/backend-winit-x11", "std"]
|
||||
|
||||
## Simliar to `eventloop-winit` this enables the winit based event loop but only
|
||||
## Simliar to `backend-winit` this enables the winit based event loop but only
|
||||
## with support for the Wayland window system on Unix.
|
||||
eventloop-winit-wayland = [
|
||||
"i-slint-backend-selector/eventloop-winit-wayland",
|
||||
"std",
|
||||
]
|
||||
backend-winit-wayland = ["i-slint-backend-selector/backend-winit-wayland", "std"]
|
||||
|
||||
## This feature is an alias for `backend-qt`
|
||||
eventloop-qt = ["backend-qt"]
|
||||
## Enable the `winit` backend and make it capable of renderer using the
|
||||
## [femtovg](https://crates.io/crates/femtovg) crate.
|
||||
renderer-winit-femtovg = ["i-slint-backend-selector/renderer-winit-femtovg", "std"]
|
||||
|
||||
## The `femtovg` crate is available for rendering.
|
||||
renderer-femtovg = ["i-slint-backend-selector/renderer-femtovg", "std"]
|
||||
## (Experimental) Enable the `winit` backend and make it capable of renderer using [Skia](https://skia.org/)
|
||||
renderer-winit-skia = ["i-slint-backend-selector/renderer-winit-skia", "std"]
|
||||
|
||||
## The Skia based rendering engine.
|
||||
renderer-skia = ["i-slint-backend-selector/renderer-skia", "std"]
|
||||
## (Experimental) Same as `renderer-winit-skia`, but Skia will always use OpenGL.
|
||||
renderer-winit-skia-opengl = ["i-slint-backend-selector/renderer-winit-skia-opengl", "std"]
|
||||
|
||||
## The Skia based rendering engine that will always use OpenGL.
|
||||
renderer-skia-opengl = ["i-slint-backend-selector/renderer-skia-opengl", "std"]
|
||||
|
||||
## Enabling this feature alongside `eventloop-winit` enables selecting the software
|
||||
## renderer at run-time when running winit, via the `SLINT_BACKEND=software`
|
||||
## environment variable.
|
||||
renderer-software = [
|
||||
"i-slint-backend-selector/renderer-software",
|
||||
]
|
||||
|
||||
## This feature is an alias for `backend-qt`
|
||||
renderer-qt = ["backend-qt"]
|
||||
## (Experimental) Enable the `winit` backend and make it capable of renderer using the software renderer
|
||||
renderer-winit-software = ["i-slint-backend-selector/renderer-winit-software"]
|
||||
|
||||
[dependencies]
|
||||
i-slint-core = { version = "=0.3.0", path = "../../../internal/core", default-features = false }
|
||||
|
@ -132,4 +136,4 @@ rustdoc-args = [
|
|||
"--html-in-header",
|
||||
"docs/resources/slint-docs-highlight.html",
|
||||
]
|
||||
features = ["document-features", "renderer-software"]
|
||||
features = ["document-features", "renderer-winit-software"]
|
||||
|
|
|
@ -16,7 +16,7 @@ homepage = "https://slint-ui.com"
|
|||
crate-type = ["cdylib"]
|
||||
|
||||
[dependencies]
|
||||
slint-interpreter = { path = "../../internal/interpreter", default-features = false, features = ["std", "eventloop-winit", "renderer-femtovg", "compat-0.3.0"] }
|
||||
slint-interpreter = { path = "../../internal/interpreter", default-features = false, features = ["std", "backend-winit", "renderer-winit-femtovg", "compat-0.3.0"] }
|
||||
|
||||
vtable = { version = "0.1.6", path="../../helper_crates/vtable" }
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ A typical line in Cargo.toml looks like that:
|
|||
|
||||
```toml
|
||||
[dependencies]
|
||||
slint = { version = "0.2.6", default-features = false, features = ["compat-0.3.0", "unsafe-single-threaded", "libm", "renderer-software"] }
|
||||
slint = { version = "0.2.6", default-features = false, features = ["compat-0.3.0", "unsafe-single-threaded", "libm", "renderer-winit-software"] }
|
||||
# ... other stuf
|
||||
```
|
||||
|
||||
|
@ -31,7 +31,7 @@ By setting this feature, you promise not to use Slint API from a different threa
|
|||
|
||||
You will also need the `libm` feature to for the math operation that would otherwise be taken care by the std lib.
|
||||
|
||||
And the additional feature you need is `renderer-software` to enable the software renderer we will need to render a Slint scene on MCU.
|
||||
And the additional feature you need is `renderer-winit-software` to enable the software renderer we will need to render a Slint scene on MCU.
|
||||
|
||||
## `build.rs`
|
||||
|
||||
|
|
|
@ -30,6 +30,6 @@ endif()
|
|||
if (SLINT_FEATURE_INTERPRETER)
|
||||
add_subdirectory(iot-dashboard/)
|
||||
endif()
|
||||
if (TARGET Slint::slint-compiler AND OpenGLES2_FOUND AND(SLINT_FEATURE_EVENTLOOP_WINIT OR SLINT_FEATURE_EVENTLOOP_WINIT_WAYLAND OR SLINT_FEATURE_EVENTLOOP_WINIT_X11) AND SLINT_FEATURE_RENDERER_FEMTOVG)
|
||||
if (TARGET Slint::slint-compiler AND OpenGLES2_FOUND AND(SLINT_FEATURE_BACKEND_WINIT OR SLINT_FEATURE_BACKEND_WINIT_WAYLAND OR SLINT_FEATURE_BACKEND_WINIT_X11) AND SLINT_FEATURE_RENDERER_FEMTOVG)
|
||||
add_subdirectory(opengl_underlay)
|
||||
endif()
|
||||
|
|
|
@ -22,7 +22,7 @@ stm32h735g = ["slint/unsafe-single-threaded", "embedded-hal", "cortex-m-rt", "al
|
|||
esp32-s2-kaluga-1 = ["slint/unsafe-single-threaded", "esp32s2-hal", "embedded-hal", "xtensa-lx-rt", "esp-alloc", "esp-println", "display-interface", "display-interface-spi", "st7789", "slint/libm"]
|
||||
|
||||
[dependencies]
|
||||
slint = { version = "=0.3.0", path = "../../api/rs/slint", default-features = false, features = ["compat-0.3.0", "renderer-software"] }
|
||||
slint = { version = "=0.3.0", path = "../../api/rs/slint", default-features = false, features = ["compat-0.3.0", "renderer-winit-software"] }
|
||||
i-slint-core-macros = { version = "=0.3.0", path = "../../internal/core-macros" }
|
||||
|
||||
derive_more = "0.99.5"
|
||||
|
|
|
@ -15,7 +15,7 @@ path = "main.rs"
|
|||
name = "printerdemo_mcu"
|
||||
|
||||
[features]
|
||||
mcu-simulator = ["slint/renderer-software", "slint/eventloop-winit", "slint/std"]
|
||||
mcu-simulator = ["slint/renderer-winit-software", "slint/backend-winit", "slint/std"]
|
||||
mcu-pico-st7789 = ["mcu-board-support/pico-st7789"]
|
||||
|
||||
[dependencies]
|
||||
|
|
|
@ -15,14 +15,14 @@ homepage = "https://slint-ui.com"
|
|||
path = "lib.rs"
|
||||
|
||||
[features]
|
||||
eventloop-winit = ["eventloop-winit-x11", "eventloop-winit-wayland"]
|
||||
eventloop-winit-x11 = ["i-slint-backend-winit/x11"]
|
||||
eventloop-winit-wayland = ["i-slint-backend-winit/wayland"]
|
||||
backend-winit = ["backend-winit-x11", "backend-winit-wayland"]
|
||||
backend-winit-x11 = ["i-slint-backend-winit/x11"]
|
||||
backend-winit-wayland = ["i-slint-backend-winit/wayland"]
|
||||
|
||||
renderer-femtovg = ["i-slint-backend-winit/renderer-femtovg"]
|
||||
renderer-skia = ["i-slint-backend-winit/renderer-skia"]
|
||||
renderer-skia-opengl = ["i-slint-backend-winit/renderer-skia-opengl"]
|
||||
renderer-software = ["i-slint-backend-winit?/renderer-software"]
|
||||
renderer-winit-femtovg = ["i-slint-backend-winit/renderer-winit-femtovg"]
|
||||
renderer-winit-skia = ["i-slint-backend-winit/renderer-winit-skia"]
|
||||
renderer-winit-skia-opengl = ["i-slint-backend-winit/renderer-winit-skia-opengl"]
|
||||
renderer-winit-software = ["i-slint-backend-winit/renderer-winit-software"]
|
||||
|
||||
rtti = ["i-slint-backend-winit?/rtti", "i-slint-backend-qt?/rtti"]
|
||||
|
||||
|
|
|
@ -20,10 +20,10 @@ path = "lib.rs"
|
|||
[features]
|
||||
wayland = ["winit/wayland", "glutin/wayland", "copypasta/wayland"]
|
||||
x11 = ["winit/x11", "glutin/x11", "copypasta/x11"]
|
||||
renderer-femtovg = ["femtovg", "fontdb", "libc", "servo-fontconfig", "winapi", "dwrote", "imgref", "unicode-script", "ttf-parser", "rgb"]
|
||||
renderer-skia = ["skia-safe", "glow", "metal", "objc", "core-graphics-types", "foreign-types", "wio", "winapi/d3d12", "winapi/dxgi", "winapi/dxgi1_2", "winapi/dxgi1_3", "winapi/dxgi1_4", "winapi/d3d12sdklayers", "winapi/synchapi"]
|
||||
renderer-skia-opengl = ["skia-safe/gl", "glow"]
|
||||
renderer-software = ["femtovg", "imgref", "rgb"]
|
||||
renderer-winit-femtovg = ["femtovg", "fontdb", "libc", "servo-fontconfig", "winapi", "dwrote", "imgref", "unicode-script", "ttf-parser", "rgb"]
|
||||
renderer-winit-skia = ["skia-safe", "glow", "metal", "objc", "core-graphics-types", "foreign-types", "wio", "winapi/d3d12", "winapi/dxgi", "winapi/dxgi1_2", "winapi/dxgi1_3", "winapi/dxgi1_4", "winapi/d3d12sdklayers", "winapi/synchapi"]
|
||||
renderer-winit-skia-opengl = ["skia-safe/gl", "glow"]
|
||||
renderer-winit-software = ["femtovg", "imgref", "rgb"]
|
||||
rtti = ["i-slint-core/rtti"]
|
||||
default = []
|
||||
|
||||
|
|
|
@ -6,9 +6,9 @@ use cfg_aliases::cfg_aliases;
|
|||
fn main() {
|
||||
// Setup cfg aliases
|
||||
cfg_aliases! {
|
||||
enable_skia_renderer: { any(feature = "renderer-skia", feature = "renderer-skia-opengl")},
|
||||
skia_backend_opengl: { any(feature = "renderer-skia-opengl", all(feature = "renderer-skia", not(any(target_os = "macos", target_family = "windows", target_arch = "wasm32")))) },
|
||||
skia_backend_metal: { all(target_os = "macos", not(feature = "renderer-skia-opengl")) },
|
||||
skia_backend_d3d: { all(target_family = "windows", not(feature = "renderer-skia-opengl")) },
|
||||
enable_skia_renderer: { any(feature = "renderer-winit-skia", feature = "renderer-winit-skia-opengl")},
|
||||
skia_backend_opengl: { any(feature = "renderer-winit-skia-opengl", all(feature = "renderer-winit-skia", not(any(target_os = "macos", target_family = "windows", target_arch = "wasm32")))) },
|
||||
skia_backend_metal: { all(target_os = "macos", not(feature = "renderer-winit-skia-opengl")) },
|
||||
skia_backend_d3d: { all(target_family = "windows", not(feature = "renderer-winit-skia-opengl")) },
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ impl OpenGLContext {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "renderer-femtovg", enable_skia_renderer))]
|
||||
#[cfg(any(feature = "renderer-winit-femtovg", enable_skia_renderer))]
|
||||
pub fn with_current_context<T>(&self, cb: impl FnOnce(&Self) -> T) -> T {
|
||||
if matches!(self.0.borrow().as_ref().unwrap(), OpenGLContextState::Current { .. }) {
|
||||
cb(self)
|
||||
|
|
|
@ -21,7 +21,7 @@ mod renderer {
|
|||
|
||||
use i_slint_core::window::WindowAdapter;
|
||||
|
||||
#[cfg(any(feature = "renderer-femtovg", enable_skia_renderer))]
|
||||
#[cfg(any(feature = "renderer-winit-femtovg", enable_skia_renderer))]
|
||||
mod boxshadowcache;
|
||||
|
||||
pub(crate) trait WinitCompatibleRenderer: i_slint_core::renderer::Renderer {
|
||||
|
@ -50,12 +50,12 @@ mod renderer {
|
|||
fn html_canvas_element(&self) -> std::cell::Ref<web_sys::HtmlCanvasElement>;
|
||||
}
|
||||
|
||||
#[cfg(feature = "renderer-femtovg")]
|
||||
#[cfg(feature = "renderer-winit-femtovg")]
|
||||
pub(crate) mod femtovg;
|
||||
#[cfg(enable_skia_renderer)]
|
||||
pub(crate) mod skia;
|
||||
|
||||
#[cfg(feature = "renderer-software")]
|
||||
#[cfg(feature = "renderer-winit-software")]
|
||||
pub(crate) mod sw;
|
||||
}
|
||||
|
||||
|
@ -77,14 +77,14 @@ fn window_factory_fn<R: WinitCompatibleRenderer + 'static>() -> Rc<dyn WindowAda
|
|||
}
|
||||
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(feature = "renderer-femtovg")] {
|
||||
if #[cfg(feature = "renderer-winit-femtovg")] {
|
||||
type DefaultRenderer = renderer::femtovg::FemtoVGRenderer;
|
||||
} else if #[cfg(enable_skia_renderer)] {
|
||||
type DefaultRenderer = renderer::skia::SkiaRenderer;
|
||||
} else if #[cfg(feature = "renderer-software")] {
|
||||
} else if #[cfg(feature = "renderer-winit-software")] {
|
||||
type DefaultRenderer = renderer::sw::SoftwareRenderer<0>;
|
||||
} else {
|
||||
compile_error!("Please select a feature to build with the winit event loop: `renderer-femtovg`, `renderer-skia`, `renderer-skia-opengl` or `renderer-software`");
|
||||
compile_error!("Please select a feature to build with the winit backend: `renderer-winit-femtovg`, `renderer-winit-skia`, `renderer-winit-skia-opengl` or `renderer-winit-software`");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -110,11 +110,11 @@ pub struct Backend {
|
|||
impl Backend {
|
||||
pub fn new(renderer_name: Option<&str>) -> Self {
|
||||
let window_factory_fn = match renderer_name {
|
||||
#[cfg(feature = "renderer-femtovg")]
|
||||
#[cfg(feature = "renderer-winit-femtovg")]
|
||||
Some("gl") | Some("femtovg") => window_factory_fn::<renderer::femtovg::FemtoVGRenderer>,
|
||||
#[cfg(enable_skia_renderer)]
|
||||
Some("skia") => window_factory_fn::<renderer::skia::SkiaRenderer>,
|
||||
#[cfg(feature = "renderer-software")]
|
||||
#[cfg(feature = "renderer-winit-software")]
|
||||
Some("sw") | Some("software") => window_factory_fn::<renderer::sw::SoftwareRenderer<0>>,
|
||||
None => window_factory_fn::<DefaultRenderer>,
|
||||
Some(renderer_name) => {
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
|
||||
|
||||
//! This module contains the [`SoftwareRenderer`] and related types.
|
||||
//!
|
||||
//! It is only available with the `renderer-software` feature.
|
||||
|
||||
#![warn(missing_docs)]
|
||||
|
||||
mod draw_functions;
|
||||
|
|
|
@ -19,7 +19,7 @@ path = "lib.rs"
|
|||
|
||||
[features]
|
||||
|
||||
default = ["std", "eventloop-winit", "renderer-femtovg", "backend-qt", "compat-0.3.0"]
|
||||
default = ["std", "backend-winit", "renderer-winit-femtovg", "backend-qt", "compat-0.3.0"]
|
||||
|
||||
## Mandatory feature:
|
||||
## This feature is required to keep the compatibility with Slint 0.3.0
|
||||
|
@ -40,44 +40,40 @@ std = ["i-slint-core/std"]
|
|||
|
||||
#! ### Backends
|
||||
|
||||
#! See the documentation of the [`slint` crate](https://docs.rs/slint/latest/slint/#backends)
|
||||
|
||||
## The Qt backend feature uses Qt for the windowing system integration and rendering.
|
||||
## This backend is required to use the `native` style.
|
||||
## This backend also provide the `native` style.
|
||||
## It requires Qt 5.15 or later to be installed. If Qt is not installed, the
|
||||
## backend will not be operational
|
||||
backend-qt = ["i-slint-backend-selector/i-slint-backend-qt", "std"]
|
||||
|
||||
# The following backend-gl-* are just alias
|
||||
backend-gl-all = ["eventloop-winit", "renderer-femtovg"]
|
||||
backend-gl-x11 = ["eventloop-winit-x11", "renderer-femtovg"]
|
||||
backend-gl-wayland = ["eventloop-winit-wayland", "renderer-femtovg"]
|
||||
## The [winit](https://crates.io/crates/log) crate is used for the event loop and windowing system integration.
|
||||
## With this feature, both x11 and wayland windowing systems are supported. For a smaller build, omit
|
||||
## this feature and select one of the other specific `backend-winit-XX` features.
|
||||
backend-winit = ["i-slint-backend-selector/backend-winit", "std"]
|
||||
|
||||
## The the `winit` crate is used for the event loop and windowing system integration.
|
||||
## With this feature, all windowing systems are supported. For a smaller build, omit
|
||||
## this feature and select one of the other specific `eventloop-winit-XX` features.
|
||||
eventloop-winit = ["i-slint-backend-selector/eventloop-winit", "std"]
|
||||
|
||||
## Simliar to `eventloop-winit` this enables the winit based event loop but only
|
||||
## Simliar to `backend-winit` this enables the winit based event loop but only
|
||||
## with support for the X Window System on Unix.
|
||||
eventloop-winit-x11 = ["i-slint-backend-selector/eventloop-winit-x11", "std"]
|
||||
backend-winit-x11 = ["i-slint-backend-selector/backend-winit-x11", "std"]
|
||||
|
||||
## Simliar to `eventloop-winit` this enables the winit based event loop but only
|
||||
## Simliar to `backend-winit` this enables the winit based event loop but only
|
||||
## with support for the Wayland window system on Unix.
|
||||
eventloop-winit-wayland = ["i-slint-backend-selector/eventloop-winit-wayland", "std"]
|
||||
backend-winit-wayland = ["i-slint-backend-selector/backend-winit-wayland", "std"]
|
||||
|
||||
## This feature is an alias for `backend-qt`
|
||||
eventloop-qt = ["backend-qt"]
|
||||
## Enable the `winit` backend and make it capable of renderer using the
|
||||
## [femtovg](https://crates.io/crates/femtovg) crate.
|
||||
renderer-winit-femtovg = ["i-slint-backend-selector/renderer-winit-femtovg", "std"]
|
||||
|
||||
## The `femtovg` crate is available for rendering.
|
||||
renderer-femtovg = ["i-slint-backend-selector/renderer-femtovg", "std"]
|
||||
## (Experimental) Enable the `winit` backend and make it capable of renderer using [Skia](https://skia.org/)
|
||||
renderer-winit-skia = ["i-slint-backend-selector/renderer-winit-skia", "std"]
|
||||
|
||||
## The Skia based rendering engine.
|
||||
renderer-skia = ["i-slint-backend-selector/renderer-skia", "std"]
|
||||
## (Experimental) Same as `renderer-winit-skia`, but Skia will always use OpenGL.
|
||||
renderer-winit-skia-opengl = ["i-slint-backend-selector/renderer-winit-skia-opengl", "std"]
|
||||
|
||||
## The Skia based rendering engine that will always use OpenGL.
|
||||
renderer-skia-opengl = ["i-slint-backend-selector/renderer-skia-opengl", "std"]
|
||||
## (Experimental) Enable the `winit` backend and make it capable of renderer using the software renderer
|
||||
renderer-winit-software = ["i-slint-backend-selector/renderer-winit-software"]
|
||||
|
||||
## This feature is an alias for `backend-qt`
|
||||
renderer-qt = ["backend-qt"]
|
||||
|
||||
[dependencies]
|
||||
i-slint-compiler = { version = "=0.3.0", path = "../compiler" }
|
||||
|
|
|
@ -34,24 +34,24 @@ name = "slint_lsp_wasm"
|
|||
[features]
|
||||
backend-qt = ["slint-interpreter/backend-qt", "preview"]
|
||||
eventloop-qt = ["backend-qt"]
|
||||
renderer-qt = ["backend-qt"]
|
||||
renderer-winit-qt = ["backend-qt"]
|
||||
|
||||
eventloop-winit = ["slint-interpreter/eventloop-winit", "preview"]
|
||||
eventloop-winit-x11 = ["slint-interpreter/eventloop-winit-x11", "preview"]
|
||||
eventloop-winit-wayland = ["slint-interpreter/eventloop-winit-wayland", "preview"]
|
||||
backend-winit = ["slint-interpreter/backend-winit", "preview"]
|
||||
backend-winit-x11 = ["slint-interpreter/backend-winit-x11", "preview"]
|
||||
backend-winit-wayland = ["slint-interpreter/backend-winit-wayland", "preview"]
|
||||
|
||||
renderer-femtovg = ["slint-interpreter/renderer-femtovg", "preview"]
|
||||
renderer-skia = ["slint-interpreter/renderer-skia", "preview"]
|
||||
renderer-skia-opengl = ["slint-interpreter/renderer-skia-opengl", "preview"]
|
||||
renderer-winit-femtovg = ["slint-interpreter/renderer-winit-femtovg", "preview"]
|
||||
renderer-winit-skia = ["slint-interpreter/renderer-winit-skia", "preview"]
|
||||
renderer-winit-skia-opengl = ["slint-interpreter/renderer-winit-skia-opengl", "preview"]
|
||||
|
||||
# Compat
|
||||
backend-gl-all = ["eventloop-winit", "renderer-femtovg"]
|
||||
backend-gl-wayland = ["eventloop-winit-wayland", "renderer-femtovg"]
|
||||
backend-gl-x11 = ["eventloop-winit-x11", "renderer-femtovg"]
|
||||
backend-gl-all = ["backend-winit", "renderer-winit-femtovg"]
|
||||
backend-gl-wayland = ["backend-winit-wayland", "renderer-winit-femtovg"]
|
||||
backend-gl-x11 = ["backend-winit-x11", "renderer-winit-femtovg"]
|
||||
|
||||
preview = ["slint-interpreter", "i-slint-core", "i-slint-backend-selector"]
|
||||
|
||||
default = ["backend-qt", "eventloop-winit", "renderer-femtovg", "preview"]
|
||||
default = ["backend-qt", "backend-winit", "renderer-winit-femtovg", "preview"]
|
||||
|
||||
[dependencies]
|
||||
i-slint-compiler = { version = "=0.3.0", path = "../../internal/compiler"}
|
||||
|
|
|
@ -16,22 +16,22 @@ keywords = ["viewer", "gui", "ui", "toolkit"]
|
|||
[features]
|
||||
backend-qt = ["slint-interpreter/backend-qt"]
|
||||
eventloop-qt = ["backend-qt"]
|
||||
renderer-qt = ["backend-qt"]
|
||||
renderer-winit-qt = ["backend-qt"]
|
||||
|
||||
eventloop-winit = ["slint-interpreter/eventloop-winit"]
|
||||
eventloop-winit-wayland = ["slint-interpreter/eventloop-winit-wayland"]
|
||||
eventloop-winit-x11 = ["slint-interpreter/eventloop-winit-x11"]
|
||||
backend-winit = ["slint-interpreter/backend-winit"]
|
||||
backend-winit-wayland = ["slint-interpreter/backend-winit-wayland"]
|
||||
backend-winit-x11 = ["slint-interpreter/backend-winit-x11"]
|
||||
|
||||
renderer-femtovg = ["slint-interpreter/renderer-femtovg"]
|
||||
renderer-skia = ["slint-interpreter/renderer-skia"]
|
||||
renderer-skia-opengl = ["slint-interpreter/renderer-skia-opengl"]
|
||||
renderer-winit-femtovg = ["slint-interpreter/renderer-winit-femtovg"]
|
||||
renderer-winit-skia = ["slint-interpreter/renderer-winit-skia"]
|
||||
renderer-winit-skia-opengl = ["slint-interpreter/renderer-winit-skia-opengl"]
|
||||
|
||||
# Compat
|
||||
backend-gl-all = ["eventloop-winit", "renderer-femtovg"]
|
||||
backend-gl-wayland = ["eventloop-winit-wayland", "renderer-femtovg"]
|
||||
backend-gl-x11 = ["eventloop-winit-x11", "renderer-femtovg"]
|
||||
backend-gl-all = ["backend-winit", "renderer-winit-femtovg"]
|
||||
backend-gl-wayland = ["backend-winit-wayland", "renderer-winit-femtovg"]
|
||||
backend-gl-x11 = ["backend-winit-x11", "renderer-winit-femtovg"]
|
||||
|
||||
default = ["backend-qt", "eventloop-winit", "renderer-femtovg"]
|
||||
default = ["backend-qt", "backend-winit", "renderer-winit-femtovg"]
|
||||
|
||||
[dependencies]
|
||||
i-slint-core = { version = "=0.3.0", path="../../internal/core" }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue