This layer contains recipes and classes for building Slint's C++ API, as well as the Rust based demos.
For a Rust based application using Slint, use meta-rust directly,
For a C++ based application, the recipes in this layer assume that your application is built using CMake and
uses find_package(Slint)
to locate Slint, and then uses slint_target_sources
to compile .slint
files to C++
as well as links against Slint::Slint
. For more details, check out our C++ Getting Started.
When creating a Bitbake recipe for, use this layer, and in your application's recipe inherit from cmake
and slint
.
Meta-slint requires:
meta-openembedded/meta-oe
meta-rust-bin
Check the layer.conf LAYERSERIES_COMPAT_meta for yocto version compatibility
By default, yocto will pick the _git
recipe of slint-cpp
, which means the development version
of Slint will be built. To select a specific Slint version, in your conf/local.conf
, set
set PREFERRED_VERSION_slint-cpp = "x.x.x"
and PREFERRED_VERSION_slint-cpp-native = "x.x.x"
.
For git builds and builds from Slint version 1.3 onwards, certain features are
configurable via PACKAGECONFIG
.
Feature Name | Description | Enabled by Default |
---|---|---|
renderer-skia |
Skia OpenGL renderer | No |
renderer-femtovg |
Lightweight FemtoVG OpenGL renderer | Yes |
backend-linuxkms |
Backend for rendering via KMS/DRM | No |
interpreter |
C++ API for Slint Interpreter | Yes |
Set the PACKAGECONFIG:pn-slint-cpp
variable in your conf/local.conf
to tweak.
For example, to disable the FemtoVG renderer, enable Skia, and the linuxkms
backend, set them like this:
PACKAGECONFIG:append:pn-slint-cpp = " backend-linuxkms renderer-skia "
PACKAGECONFIG:remove:pn-slint-cpp = " renderer-femtovg "
The Skia renderer requires clang to compile. The meta-clang layer provides current versions of clang that work with the recipes in this layer.
With Slint version 1.3 or newer, the nativesdk-slint-cpp
package allows for including Slint in your SDK,
so that CMake based applications that use Slint and the Slint C++ compiler can be used.
Either add the package to your corresponding package groups or add the following to your conf/local.conf
:
TOOLCHAIN_HOST_TASK:append = " nativesdk-slint-cpp"
A regular Yocto SDK should be suitable for building Slint against, out of the box. Make sure to source
your environment-setup
before invoking cmake
on the Slint build, and pass -DRust_CARGO_TARGET=<your triplet>
.
If your build of Slint enables the Skia renderer (SLINT_FEATURE_RENDERER_SKIA
), make sure to include the
meta-clang layer in your project and set CLANGSDK = "1"
in your conf/local.conf
before running the populate_sdk
task on your image.
When building for STM32 MPU OpenSTLinux,
adding this meta-slint
layer to your environment enables an additional st-example-image-slint
image target. In your
conf/local.conf
set DISTRO = "openstlinux-eglfs"
and run bitbake st-example-image-slint
to build an image that ships
various Slint demos in a minimal image. The demos run directly on the framebuffer with the LinuxKMS backend.
(Tested on stm32mp157-disco)
When building for F&S Elektronik meta-fus, adding this meta-slint
layer to your
environment enables an additional fus-image-slint-demos
image target.
Steps:
- Add
meta-slint
- Add meta-clang
- Add meta-rust
- Edit your
conf/local.conf
:- Make sure
DISTRO
is set to"fus-imx-wayland"
- Select the Rust version from
meta-rust
by adding this line (adjust path to layer accordingly):include ../../sources/meta-rust/conf/distro/include/rust_versions.inc
- Make sure
- Run
bitbake fus-image-slint-demos
to build an image that ships various Slint demos in a minimal image. The demos run directly on the framebuffer with the LinuxKMS backend.