C

Qt Quick Ultralite Platform Exporter

The Qt Quick Ultralite Platform Exporter exports the platform-specific code into a separate folder to enable importing and building.

Qt Quick Ultralite libraries are configured to use link-time optimization by default. This requires using the exact same compiler version that was used to build the Qt Quick Ultralite libraries.

Exporting a prebuilt platform

<QUL_DIR>/bin/platformexporter.exe \
    --infile <QUL_DIR>/QulPlatformTargets_<PLATFORM_NAME>-export.json \
    --outdir <DESTINATION_FOLDER> \
    --qulSourceTree <QUL_DIR> \
    --builddir <QUL_DIR>

Exporting platform sources

Create an empty file in the build directory <BUILD_DIR>/.cmake/api/v1/query/codemodel-v2, and reconfigure and rebuild the tree to let CMake produce a metadata file (PlatformExport CMake target is enough). The metadata file is located in the build directory at, <BUILD_DIR>/QulPlatformTargets_<PLATFORM_NAME>-export.json For example, the metadata file for the STM32F469 platform would be: QulPlatformTargets_stm32f469i-discovery-baremetal_24bpp_Linux_armgcc-export.json

<QUL_DIR>/bin/platformexporter.exe \
    --infile <BUILD_DIR>/QulPlatformTargets_<PLATFORM_NAME>-export.json \
    --outdir <DESTINATION_FOLDER> \
    --qulSourceTree <QUL_DIR> \
    --builddir <BUILD_DIR>

Exporting a QML application

<HOST_BUILD>/bin/qmlprojectexporter \
    --include-dirs <QUL_SOURCE>,<BUILD_DIR>/include \
    --boarddefaults <QUL_SOURCE>/platform/boards/<SOME_BOARD>/cmake/BoardDefaults.qmlproject \
    --outdir my_app \
    --toolchain <IAR|GCC> \
    <QUL_SOURCE>/examples/minimal/minimal.qmlproject

This is an example main.cpp to show the code that is required to be integrated in your own project.

#include "minimal.h"

#include <qul/application.h>
#include <qul/qul.h>

int main()
{
    Qul::initHardware();
    Qul::initPlatform();
    Qul::Application _qul_app;
    static struct ::minimal _qul_item;
    _qul_app.setRootItem(&_qul_item);
#ifdef APP_DEFAULT_UILANGUAGE
    _qul_app.setUiLanguage(APP_DEFAULT_UILANGUAGE);
#endif
    _qul_app.exec();
    return 0;
}

IDE settings

  1. Add the exported platform and application source files to your project in the IDE.
  2. Add assembly source files to the sources list of your project. Passing --toolchain GNU to the qmlprojectexporter enables generates binary files (incbin) for resources. In that case, qul_font_files_loader.S and qul_assets.S needs to be added to the sources. This option only applies to GNU GCC compiler. For other compilers, resources are generated as C++ arrays.
  3. Add board files which includes pin muxing, clock configuration, and hardware initialization code.

    You can add these files using one of the following options:

    • Custom board files can be generated with MCU vendor tools such as STM32 CubeMX or NXP MCUXPresso config tools.
    • Use --includeIDEgeneratedHWCode with the platform exporter to export board files provided by Qt for MCUs for the reference boards. You can also specify a target directory using the --IDEsourcesdir <folderpath> option.

    For example:

    $QUL_SOURCE/platform/export/export.py \
        --infile $BUILD_DIR/QulPlatformTargets_<PLATFORM_NAME>-export.json \
        --outdir $PLATFORM_EXPORTER_DIR \
        --repo $QUL_SOURCE \
        --builddir $BUILD_DIR \
        --IDEsourcesdir $IDE_PROJECT_ROOT_DIR/board \
        --includeIDEgeneratedHWCode
  4. Add include paths, pre-defines, and toolchain flags.

    The <PLATFORM_EXPORT_DIR>/IDE-Import-Instructions.txt file lists all the required compiler and linker settings for the project. This includes architecture flags, include paths, and preprocessor defines for toolchain in use.

  5. Add path to the exported linker script in the project linker settings.

    Linker scripts for the Qt Quick Ultralite application requires custom sections to be defined for resource data and caches. The exported linker scripts from the Platform Exporter tool can be used directly in the IDE.

    For ARMGCC: <QUL_EXPORT_FOLDER>/platform/boards/nxp/<board>/cmake/armgcc/<linker_file>.ld For IAR: <QUL_EXPORT_FOLDER>/platform/boards/nxp/<board>/cmake/iar/<linker_file>.icf

  6. Add the following prebuilt Qt Quick Ultralite libraries to the linker settings:
    • <BUILD_DIR>/libQulCore_<ARCHITECTURE>-<COMPILER>-<BUILD_TYPE>.a
    • <BUILD_DIR>/libQulControls_<ARCHITECTURE>-<COMPILER>-<BUILD_TYPE>.a
    • <BUILD_DIR>/libQulPNGDecoderLodePNG_<ARCHITECTURE>-<COMPILER>-<BUILD_TYPE>.a
    • <BUILD_DIR>/libQulPNGDecoderNull_<ARCHITECTURE>-<COMPILER>-<BUILD_TYPE>.a
    • <BUILD_DIR>/libQulShapes_<ARCHITECTURE>-<COMPILER>-<BUILD_TYPE>.a
    • <BUILD_DIR>/libQulControlsTemplates_<ARCHITECTURE>-<COMPILER>-<BUILD_TYPE>.a
    • <BUILD_DIR>/libQulTimeline_<ARCHITECTURE>-<COMPILER>-<BUILD_TYPE>.a
    • <BUILD_DIR>/libQulMonotypeUnicodeEngineShaperDisabled_<ARCHITECTURE>-<COMPILER>-<BUILD_TYPE>.a
    • <BUILD_DIR>/libMonotypeUnicode_<ARCHITECTURE>-<COMPILER>-<BUILD_TYPE>.a

Additional information

QUL_STD_STRING_SUPPORT CMake option

The architecture requires using the QUL_STD_STRING_SUPPORT CMake option while configuring your project, if the core library was built with it. Otherwise the application crashes.

Available under certain Qt licenses.
Find out more.