-
Notifications
You must be signed in to change notification settings - Fork 128
Building Embedded Linux embedding for Flutter
There are several build ways, so please use the one you like.
$ mkdir build
$ cd build
$ cmake -DUSER_PROJECT_PATH=examples/flutter-wayland-client -DCMAKE_BUILD_TYPE=Release ..
$ cmake --build .
$ mkdir build
$ cd build
$ cmake -DUSER_PROJECT_PATH=examples/flutter-drm-gbm-backend -DCMAKE_BUILD_TYPE=Release ..
$ cmake --build .
$ mkdir build
$ cd build
$ cmake -DUSER_PROJECT_PATH=examples/flutter-drm-eglstream-backend -DCMAKE_BUILD_TYPE=Release ..
$ cmake --build .
Basically, the x11 backend is just only for debugging and developing Flutter apps on desktops. And it's still being implemented now.
$ mkdir build
$ cd build
$ cmake -DUSER_PROJECT_PATH=examples/flutter-x11-client -DCMAKE_BUILD_TYPE=Release ..
$ cmake --build .
Build shared library for flutter-elinux
See also: Release building options for flutter-elinux
$ cmake -DBUILD_ELINUX_SO=ON -DBACKEND_TYPE=WAYLAND -DCMAKE_BUILD_TYPE=Release \
-DENABLE_ELINUX_EMBEDDER_LOG=ON -DFLUTTER_RELEASE=OFF ..
$ cmake -DBUILD_ELINUX_SO=ON -DBACKEND_TYPE=WAYLAND -DCMAKE_BUILD_TYPE=Release \
-DENABLE_ELINUX_EMBEDDER_LOG=OFF -DFLUTTER_RELEASE=ON ..
You need to create a toolchain file to cross compile using the Yocto SDK for aarch64 on x64 hosts. cross-toolchain-aarch64-template.cmake is the templete file for aarch64 toolchain. Also, you need to modify <path_to_user_target_sysroot> appropriately for your environment if you want to use the template file.
$ cmake -DUSER_PROJECT_PATH=<path_to_user_project> -DCMAKE_TOOLCHAIN_FILE=<toolchain-template-file> ..
If you want to build using Yocto, see: meta-flutter
You need to build the embedder with CMAKE_BUILD_TYPE=Debug
option if you want to debug the embedder. Using this option, you can get gather logs and debug them with debuggers such as gdb / lldb.
$ cmake -DUSER_PROJECT_PATH=<path_to_user_project> -DCMAKE_BUILD_TYPE=Debug ..
Please edit cmake/user_config.cmake
file.
Option | Description | Default |
---|---|---|
BACKEND_TYPE | Select WAYLAND, DRM-GBM, DRM-EGLSTREAM, or X11 as the display backend type | WAYLAND |
USE_GLES3 | Use OpenGLES3 instead of OpenGLES2 | OFF |
ENABLE_EGL_ALPHA_COMPONENT_OF_COLOR_BUFFER | Use alpha component of the EGL color buffor | ON |
ENABLE_VSYNC | Enable embedder vsync | OFF |
Option | Description | Default |
---|---|---|
BUILD_ELINUX_SO | Build .so file of elinux embedder | OFF |
ENABLE_ELINUX_EMBEDDER_LOG | Enable logger of eLinux embedder | ON |
FLUTTER_RELEASE | Build Flutter Engine with release mode | OFF |