C
Installation
This topic explains how to install the new platform port and use it in Qt Creator. So far you have been doing a developer build throughout this porting guide. This is practical if the port is still being developed, as it helps you test changes quickly against an application. To be able to use it with QtCreator and start developing applications, install the platform port to a self-contained location.
Installed build
To install a platform build, use the CMAKE_INSTALL_PREFIX
option, in addition to the CMake options for the developer build. In the following CMake command, set the CMAKE_INSTALL_PREFIX
to the path where you want to install the port.
The host tools are not part of this custom built installation. In order to get a fully usable package you have to copy the existing Qt Quick Ultralite installation to your custom install location ahead of time.
The values for CMAKE_TOOLCHAIN_FILE
and QUL_TARGET_TOOLCHAIN_DIR
stay the same as the developer build.
cmake $QUL_ROOT -G "Ninja" -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=$QUL_TOOLCHAIN_FILE -DQUL_TARGET_TOOLCHAIN_DIR=/path/to/the/toolchain -DQUL_GENERATORS=$QUL_ROOT/lib/cmake/Qul/QulGenerators.cmake -DQUL_PLATFORM=example-baremetal -DCMAKE_INSTALL_PREFIX=~/dev/qul-example-platform cmake --build . cmake --build . --target install
cmake %QUL_ROOT% -G "Ninja" -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=%QUL_TOOLCHAIN_FILE% -DQUL_TARGET_TOOLCHAIN_DIR=c:\path\to\the\toolchain -DQUL_GENERATORS=%QUL_ROOT%\lib\cmake\Qul\QulGenerators.cmake -DQUL_PLATFORM=example-baremetal -DCMAKE_INSTALL_PREFIX=C:\dev\qul-example-platform cmake --build . cmake --build . --target install
Qt Creator integration
To let Qt Creator create Kits used for building, create a Qt Creator Kit file before continuing.
Set up your Qt Creator development environment with the MCU plugin as described in the Qt Creator Manual > Connecting MCUs topic.
Note: Qt Creator does not support custom toolchains yet, so for Qt Creator support one of the toolchains shipped with Qt Quick Ultralite in lib\cmake\Qul\toolchain
must be used.
To build the platform port for Qt Creator integration, set these two environment variables:
CMAKE_INSTALL_PREFIX
to Qt for MCUs install directory. It should match the Qt for MCUs version set in the Edit > Preferences > Devices > MCU option in Qt Creator.QUL_VERSION
to the corresponding version number. For example, if Qt Creator is configured to useC:\Qt\QtMCUs\<VERSION>
, where<VERSION>
is the directory containing the Qt Quick Ultralite version you are using (for example 2.9.0).
After setting these variables, use the following commands to configure and install the platform port:
export QUL_VERSION=<VERSION> cmake $QUL_ROOT -G "Ninja" -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=$QUL_TOOLCHAIN_FILE -DQUL_TARGET_TOOLCHAIN_DIR=/path/to/the/toolchain -DQUL_GENERATORS=$QUL_ROOT/lib/cmake/Qul/QulGenerators.cmake -DQUL_PLATFORM=example-baremetal -DCMAKE_INSTALL_PREFIX=~/dev/qul-example-platform -DQUL_VERSION=$QUL_VERSION -DQUL_BUILD_DEMOS=off -DQUL_BUILD_EXAMPLES=off cmake --build . cmake --build . --target install
set QUL_VERSION=<VERSION> cmake %QUL_ROOT% -G "Ninja" -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=%QUL_TOOLCHAIN_FILE% -DQUL_TARGET_TOOLCHAIN_DIR=c:\path\to\the\toolchain -DQUL_GENERATORS=%QUL_ROOT%\lib\cmake\Qul\QulGenerators.cmake -DQUL_PLATFORM=example-baremetal -DCMAKE_INSTALL_PREFIX=C:\dev\qul-example-platform -DQUL_VERSION=%QUL_VERSION% -DQUL_BUILD_DEMOS=off -DQUL_BUILD_EXAMPLES=off cmake --build . cmake --build . --target install
You can disable building of demos and examples, as they are not needed for the Qt Creator integration.
Add the following CMake options to the earlier command, if you are using Qt for MCUs evaluation version or don't want to rebuild the framework:
-DQul_ROOT=$QUL_ROOT -DQUL_BUILD_FRAMEWORK=OFF
-DQul_ROOT=%QUL_ROOT% -DQUL_BUILD_FRAMEWORK=OFF
Once the installation is complete, create a kit for your platform port using the Edit > Preferences > Devices > MCU option in Qt Creator. If a kit is already configured for the target, remove it before creating the new one.
Finally, the kit for your platform is ready for use in Qt Creator. If you created an Mcu Support Application project, use the new kit to build and link the Qt Quick Ultralite application against your platform library.
Assuming that you have set up the flash targets as described in Creating flash targets, run the application on the target hardware by pressing the Run button in Qt Creator.
Available under certain Qt licenses.
Find out more.