1 | # Copyright © SixtyFPS GmbH <info@slint.dev> |
2 | # SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.1 OR LicenseRef-Slint-commercial |
3 | |
4 | [package] |
5 | name = "slint" |
6 | description = "GUI toolkit to efficiently develop fluid graphical user interfaces for embedded devices and desktop applications" |
7 | authors.workspace = true |
8 | documentation.workspace = true |
9 | edition.workspace = true |
10 | homepage = "https://slint.rs" |
11 | keywords.workspace = true |
12 | license.workspace = true |
13 | repository.workspace = true |
14 | rust-version.workspace = true |
15 | version.workspace = true |
16 | categories = ["gui" , "rendering::engine" , "no-std" ] |
17 | |
18 | [lib] |
19 | path = "lib.rs" |
20 | |
21 | [features] |
22 | |
23 | default = [ |
24 | "std" , |
25 | "backend-default" , |
26 | "renderer-femtovg" , |
27 | "renderer-software" , |
28 | "accessibility" , |
29 | "compat-1-2" , |
30 | ] |
31 | |
32 | ## Mandatory feature: |
33 | ## This feature is required to keep the compatibility with Slint 1.2 |
34 | ## Newer patch version may put current functionality behind a new feature |
35 | ## that would be enabled by default only if this feature was added. |
36 | ## [More info in this blog post](https://slint.dev/blog/rust-adding-default-cargo-feature.html) |
37 | "compat-1-2" = [] |
38 | "compat-1-0" = ["compat-1-2" , "renderer-software" ] |
39 | |
40 | ## Enable use of the Rust standard library. |
41 | std = ["i-slint-core/std" ] |
42 | |
43 | ## Enable the translations using [gettext](https://www.gnu.org/software/gettext/gettext) |
44 | ## |
45 | ## the `@tr(...)` code from .slint files will be transformed into call to `dgettext` |
46 | ## with the crate name as domain name |
47 | ## |
48 | ## translations must be enabled with the [`init_translations!`] macro |
49 | gettext = ["i-slint-core/gettext-rs" ] |
50 | |
51 | ## This feature enables floating point arithmetic emulation using the [libm](https://crates.io/crates/libm) crate. Use this |
52 | ## in MCU environments where the processor does not support floating point arithmetic. |
53 | libm = ["i-slint-core/libm" ] |
54 | |
55 | ## If enabled, calls of `debug()` in `.slint` files use to the [`log::debug!()`] macro |
56 | ## of the [log](https://crates.io/crates/log) crate instead of just `println!()`. |
57 | log = ["dep:log" ] |
58 | |
59 | ## Implement the `serde::Serialize` and `serde::Deserialize` for some of the base types |
60 | ## such as `SharedString` and `SharedVector`. |
61 | serde = ["i-slint-core/serde" ] |
62 | |
63 | ## This feature enables the software renderer to pick up fonts from the operating system for text rendering. |
64 | software-renderer-systemfonts = ["renderer-software" , "i-slint-core/software-renderer-systemfonts" ] |
65 | |
66 | ## Slint uses internally some `thread_local` state. |
67 | ## |
68 | ## When the `std` feature is enabled, Slint can use [`std::thread_local!`], but when in a `#![no_std]` |
69 | ## environment, we need a replacement. Using this feature, Slint will just use static variable |
70 | ## disregarding Rust's Send and Sync safety |
71 | ## |
72 | ## **Safety** : You must ensure that there is only one single thread that call into the Slint API |
73 | unsafe-single-threaded = ["i-slint-core/unsafe-single-threaded" ] |
74 | |
75 | ## Enable integration with operating system provided accessibility APIs |
76 | ## |
77 | ## Enabling this feature will try to expose the tree of UI elements to OS provided accessibility |
78 | ## APIs to support screen readers and other assistive technologies. |
79 | accessibility = ["i-slint-backend-selector/accessibility" ] |
80 | |
81 | #! ### Backends |
82 | |
83 | #! Slint needs a backend that will act as liaison between Slint and the OS. |
84 | #! By default, Slint will use the Qt backend, if Qt is installed, otherwise, it |
85 | #! will use [Winit](https://crates.io/crates/winit) with [FemtoVG](https://crates.io/crates/femtovg). |
86 | #! Both backends are compiled in. If you want to not compile one of these you need |
87 | #! to disable the default feature and re-enable one backend. It is also possible |
88 | #! to use Slint without backend if you provide the platform abstraction yourself |
89 | #! with [`platform::set_platform()`]. |
90 | #! |
91 | #! If you enable the Winit backend, you need to also include a renderer. |
92 | #! `renderer-femtovg` is the only stable renderer, the other ones are experimental |
93 | #! |
94 | #! It is also possible to select the backend and renderer at runtime when several |
95 | #! are enabled, using the `SLINT_BACKEND` environment variable. |
96 | #! * `SLINT_BACKEND=Qt` selects the Qt backend |
97 | #! * `SLINT_BACKEND=winit` selects the winit backend |
98 | #! * `SLINT_BACKEND=winit-femtovg` selects the winit backend with the FemtoVG renderer |
99 | #! * `SLINT_BACKEND=winit-skia` selects the winit backend with the skia renderer |
100 | #! * `SLINT_BACKEND=winit-software` selects the winit backend with the software renderer |
101 | #! |
102 | #! If the selected backend is not available, the default will be used. |
103 | #! |
104 | #! Here are the cargo features controlling the backend: |
105 | |
106 | ## The Qt backend feature uses Qt for the windowing system integration and rendering. |
107 | ## This backend also provides the `native` style. |
108 | ## It requires Qt 5.15 or later to be installed. If Qt is not installed, the |
109 | ## backend will not be operational |
110 | backend-qt = ["i-slint-backend-selector/backend-qt" , "std" , "i-slint-backend-qt" ] |
111 | |
112 | ## The [winit](https://crates.io/crates/winit) crate is used for the event loop and windowing system integration. |
113 | ## It supports Windows, macOS, web browsers, X11 and Wayland. X11 and wayland are only available when |
114 | ## compiling for Linux or other Unix-like operating systems. With this feature, both X11 and Wayland are supported. |
115 | ## For a smaller build, omit this feature and select one of the other specific `backend-winit-XX` features. |
116 | backend-winit = ["i-slint-backend-selector/backend-winit" , "std" ] |
117 | |
118 | ## Simliar to `backend-winit` this enables the winit based event loop but only |
119 | ## with support for the X Window System on Unix. |
120 | backend-winit-x11 = ["i-slint-backend-selector/backend-winit-x11" , "std" ] |
121 | |
122 | ## Simliar to `backend-winit` this enables the winit based event loop but only |
123 | ## with support for the Wayland window system on Unix. |
124 | backend-winit-wayland = ["i-slint-backend-selector/backend-winit-wayland" , "std" ] |
125 | |
126 | ## Alias to a backend and renderer that depends on the platform. |
127 | ## Will select the Qt backend on linux if present, and the winit otherwise |
128 | backend-default = ["i-slint-backend-selector/default" , "i-slint-backend-qt" ] |
129 | |
130 | # deprecated aliases |
131 | renderer-winit-femtovg = ["renderer-femtovg" ] |
132 | renderer-winit-skia = ["renderer-skia" ] |
133 | renderer-winit-skia-opengl= ["renderer-skia-opengl" ] |
134 | renderer-winit-skia-vulkan= ["renderer-skia-vulkan" ] |
135 | renderer-winit-software = ["renderer-software" ] |
136 | |
137 | ## Render using the [FemtoVG](https://crates.io/crates/femtovg) crate. |
138 | renderer-femtovg = ["i-slint-backend-selector/renderer-femtovg" , "dep:i-slint-renderer-femtovg" , "std" ] |
139 | |
140 | ## Render using [Skia](https://skia.org/). |
141 | renderer-skia = ["i-slint-backend-selector/renderer-skia" , "std" ] |
142 | |
143 | ## Same as `renderer-skia`, but Skia will always use OpenGL. |
144 | renderer-skia-opengl = ["i-slint-backend-selector/renderer-skia-opengl" , "std" ] |
145 | |
146 | ## Same as `renderer-skia`, but Skia will always use Vulkan. |
147 | renderer-skia-vulkan = ["i-slint-backend-selector/renderer-skia-vulkan" , "std" ] |
148 | |
149 | ## Render using the software renderer. |
150 | renderer-software = ["i-slint-backend-selector/renderer-software" , "i-slint-core/software-renderer" ] |
151 | |
152 | ## KMS with Vulkan or EGL and libinput on Linux are used to render the application in full screen mode, without any |
153 | ## windowing system. Requires libseat. If you don't have libseat, select `backend-linuxkms-noseat` instead. (Experimental) |
154 | backend-linuxkms = ["i-slint-backend-selector/backend-linuxkms" , "std" ] |
155 | |
156 | ## KMS with Vulkan or EGL and libinput on Linux are used to render the application in full screen mode, without any |
157 | ## windowing system. (Experimental) |
158 | backend-linuxkms-noseat = ["i-slint-backend-selector/backend-linuxkms-noseat" , "std" ] |
159 | |
160 | ## Use the backend based on the [android-activity](https://docs.rs/android-activity) crate. (Using it's native activity feature) |
161 | backend-android-activity-05 = ["i-slint-backend-android-activity/native-activity" ] |
162 | |
163 | [dependencies] |
164 | i-slint-core = { workspace = true } |
165 | slint-macros = { workspace = true } |
166 | i-slint-backend-selector = { workspace = true } |
167 | |
168 | const-field-offset = { version = "0.1.2" , path = "../../../helper_crates/const-field-offset" } |
169 | document-features = { version = "0.2.0" , optional = true } |
170 | vtable = { workspace = true } |
171 | |
172 | once_cell = { version = "1.5" , default-features = false, features = ["alloc" ] } |
173 | pin-weak = { version = "1.1" , default-features = false } |
174 | num-traits = { version = "0.2" , default-features = false } |
175 | |
176 | log = { version = "0.4.17" , optional = true } |
177 | |
178 | [target.'cfg(not(target_os = "android"))'.dependencies] |
179 | # FemtoVG is disabled on android because it doesn't compile without setting RUST_FONTCONFIG_DLOPEN=on |
180 | # end even then wouldn't work because it can't load fonts |
181 | i-slint-renderer-femtovg = { workspace = true, optional = true } |
182 | |
183 | [target.'cfg(target_os = "android")'.dependencies] |
184 | i-slint-backend-android-activity = { workspace = true, optional = true } |
185 | |
186 | [dev-dependencies] |
187 | slint-build = { path = "../build" } |
188 | i-slint-backend-testing = { path = "../../../internal/backends/testing" } |
189 | serde_json = "1.0.96" |
190 | serde = { version = "1.0.163" , features = ["derive" ] } |
191 | |
192 | [target.'cfg(target_os = "linux")'.dependencies] |
193 | # this line is there to add the "enable" feature by default, but only on linux |
194 | i-slint-backend-qt = { workspace = true, features = [ "enable" ], optional = true } |
195 | |
196 | [package.metadata.docs.rs] |
197 | rustdoc-args = [ |
198 | # "--html-in-header", |
199 | # "docs/resources/slint-docs-preview.html", |
200 | "--html-in-header" , |
201 | "docs/resources/slint-docs-highlight.html" , |
202 | ] |
203 | features = ["document-features" , "log" , "gettext" , "renderer-software" , "renderer-femtovg" ] |
204 | |