Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. Qt for HarmonyOS
  4. Building Qt6 for HarmonyOS
Qt 6.11 is out! See what's new in the release blog

Building Qt6 for HarmonyOS

Scheduled Pinned Locked Moved Solved Qt for HarmonyOS
1 Posts 1 Posters 633 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Liang Qi
    wrote on last edited by
    #1

    https://wiki.qt.io/Building_Qt6_for_HarmonyOS

    HarmonyOS SDK Version Requirements

    The minimum supported HarmonyOS SDK API level is 23 from HarmonyOS 6.1.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.

    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/dev
    

    Host 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 -j14
    

    Target 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 -j14
    

    Build 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
    $ pwd
    

    Use DevEco Studio to open the above project, sign it and build it and run it.

    Happy Hacking!

    1 Reply Last reply
    2
    • L Liang Qi has marked this topic as solved on

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved