Flutter Engine
Source of the original repository: https://github.com/flutter/engine
Repository Description
This repository is an extension of the Flutter engine repository. It enables Flutter engine to run on OpenHarmony devices.
How to Build
- Build environment:
- Linux or macOS that support Flutter engine; Windows that supports gen_snapshot.
- Access to the allowed_hosts field in the DEPS_ohos file.
- Build steps:
-
Set up a basic environment. For details, see the official document.
The following libraries need to be installed:
sudo apt install python3 sudo apt install pkg-config sudo apt install ninja-buildFor Windows: Refer to the section "Compiling for Windows" in the official document.
-
Configure the engine development environment by copying one of the
engine/scripts/*.gclientfiles to the flutter_flutter root directory as.gclienta) Googlers: copy
rbe.gclientto enable faster builds with RBEb) Everyone else: copy
standard.gclientc) For ohos: copy
ohos.gclient -
Synchronize the code. In the flutter_flutter directory, execute
gclient sync. The engine source code and packages repository will be synchronized, and the ohos_setup task will be executed. -
After the synchronization is complete, execute the following python commands in the flutter_flutter directory:
Linux: sed -i 's/vpython3/python3/g' ./engine/src/flutter/tools/gn sed -i 's/vpython3/python3/g' ./engine/src/.gn MacOS: sed -i '' 's/vpython3/python3/g' ./engine/src/flutter/tools/gn sed -i '' 's/vpython3/python3/g' ./engine/src/.gncd engine/src python3 ./flutter/tools/pub_get_offline.py -
Start building. In the engine directory, execute
./ohosto start building the Flutter engine that supports ohos devices. Starting from version 3.22.0, the engine compilation will by default compile both thelocal-engineandlocal-host-engine. When the SDK specifies local compiled artifacts, it must specify both of these compiled artifacts. For example:flutter build hap --target-platform ohos-arm64 --release --local-engine=<DIR>/engine/src/out/ohos_release_arm64/ --local-engine-host=<DIR>/engine/src/out/host_release