Building Qt6 for HarmonyOS: Difference between revisions
Qt for HarmonyOS merged into dev |
|||
| Line 1: | Line 1: | ||
== HarmonyOS SDK Version Requirements == | == HarmonyOS SDK Version Requirements == | ||
The minimum supported HarmonyOS SDK API level is 20 from HarmonyOS 6.0.0 release. | The minimum supported HarmonyOS SDK API level is 20 from HarmonyOS 6.0.0 release. | ||
| Line 32: | Line 27: | ||
== How to get source code of qtbase == | == How to get source code of qtbase == | ||
About gerrit and etc, details in [[Building Qt for HarmonyOS#Gerrit Introduction]] .<syntaxhighlight lang="shell"> | About gerrit and etc, details in [[Building Qt for HarmonyOS#Gerrit Introduction]] . | ||
<syntaxhighlight lang="shell"> | |||
$ cd ~/qt | $ cd ~/qt | ||
$ git clone git://code.qt.io/qt/qtbase.git | $ git clone git://code.qt.io/qt/qtbase.git | ||
$ cd qtbase | $ cd qtbase | ||
# add gerrit as remote | |||
$ git remote add gerrit https://codereview.qt-project.org/qt/qtbase | $ git remote add gerrit https://codereview.qt-project.org/qt/qtbase | ||
$ git fetch gerrit | $ git fetch gerrit | ||
$ git checkout -b dev gerrit/dev | |||
$ git | |||
</syntaxhighlight> | </syntaxhighlight> | ||
== Host Build == | == Host Build == | ||
Use macOS(Apple Silicon) as example for now.<syntaxhighlight lang="shell"> | Use macOS(Apple Silicon) as example for now. | ||
<syntaxhighlight lang="shell"> | |||
$ cd ~/qt | $ cd ~/qt | ||
$ mkdir qtbase-host-build | $ mkdir qtbase-host-build | ||
Revision as of 16:39, 15 May 2026
HarmonyOS SDK Version Requirements
The minimum supported HarmonyOS SDK API level is 20 from HarmonyOS 6.0.0 release.
HUAWEI DevEco Studio Installation
See also Building Qt for HarmonyOS#HUAWEI DevEco Studio Installation .
DevEco Studio is native IDE, it's available on Windows and macOS.
Note: suggest to download 6.0.0(there is known issue with hvigor in DevEco Studio 6.0.2).
If only for build you can also try Command Line Tools, which is available on Windows, Linux and macOS.
Additional Packages
Qt 6 depends on lots of 3rdparty libraries, but HarmonyOS SDK doesn't provide them. So we have build one set for you - ohos-additional-packages-20260415.zip
Google Drive: https://drive.google.com/file/d/1muyUjBPS8B0CLEoLAhtGgxNY6C6W7TTl/view?usp=share_link
Baidu Netdisk: https://pan.baidu.com/s/1_x4mBtRuvwwO_oWjjH5CoQ?pwd=qtfh
sha1sum: fe3b77744659922977efd926b54a2534ff142f6a
This is only for development.
About how to build additional package, see https://www.qt.io/blog/building-libraries-for-harmonyos-with-vcpkg .
You can put it to ~/.local/opt/ohos/additional-packages .
How to get source code of qtbase
About gerrit and etc, details in Building Qt for HarmonyOS#Gerrit Introduction .
$ cd ~/qt
$ git clone git://code.qt.io/qt/qtbase.git
$ cd qtbase
# add gerrit as remote
$ git remote add gerrit https://codereview.qt-project.org/qt/qtbase
$ git fetch gerrit
$ git checkout -b dev gerrit/devHost Build
Use macOS(Apple Silicon) as example for now.
$ cd ~/qt
$ mkdir qtbase-host-build
$ cd qtbase-host-build
$ ../qtbase/configure -developer-build -opensource -confirm-license -no-framework -nomake examples -nomake tests -verbose
$ cmake --build . --parallel -j14Target Build
With DevEco Studio installed, the sdk should be in /Applications/DevEco-Studio.app/Contents/sdk/default/openharmony/ .
$ cd ~/qt
$ mkdir qtbase-harmonyos-build
$ cd qtbase-harmonyos-build
$ ../qtbase/configure -developer-build -debug -no-dbus -no-use-gold-linker -no-pch -openssl-runtime -ohos-sdk /Applications/DevEco-Studio.app/Contents/sdk/default/openharmony/ -ohos-abis arm64-v8a -qt-host-path ~/qt/qtbase-host-build -- -DCMAKE_FIND_ROOT_PATH=~/.local/opt/ohos/additional-packages
$ cmake --build . --parallel -j14Build HarmonyOS Project for an example
$ cd qtbase-harmonyos-build
$ cmake --build . --parallel -j14 --target gallery
$ cd examples/widgets/gallery
$ ~/qt/qtbase-host-build/bin/harmonydeployqt --verbose --hvigor /Applications/DevEco-Studio.app/Contents/tools/hvigor/bin/hvigorw --input ./gallery-harmony-deployment-settings.json
$ cd libgallery-harmonyos
$ pwdUse DevEco Studio to open the above project, sign it and build it and run it.
Happy Hack!