C

Deploying Qt Projects with Boot to Qt

After you have flashed the Boot to Qt software stack to your target device, you can deploy all kinds of Qt applications into your device via Qt Creator. Deploying is done when you run the application. See Tutorial: Deploying Your First Project with Boot to Qt for detailed steps that are related to deploying applications via Qt Creator.

The following sections provide general information about deploying with the Boot to Qt software stack:

Target Path of Deployed Application

Qt Creator deploys the application binaries and resources to the /opt/$${TARGET}/bin directory. Therefore, the path variable for the INSTALLS target needs to be adjusted accordingly in an application's project (.pro) file.

When you create a new Qt Quick application project with Qt's project wizard, the generated project automatically contains a path variable for INSTALLS targets. Thus you can deploy the generated Qt Quick project without any further modifications.

In the following situations, you must manually add the path variable for the INSTALLS target to a .pro file:

  • You create a new widget project with Qt's project wizard.
  • You create a new console project with Qt's project wizard.
  • You want to deploy an existing project that does not yet set the path variable for the INSTALLS target.

Setting Path Variable for INSTALLS Target

If you need to manually update your application's .pro file with the path variable for the INSTALLS target, add the following lines to the .pro file:

target.path = /opt/$${TARGET}/bin
INSTALLS   += target

Above, $$TARGET expands to the application target (executable) name.

Deploying Application Resources

The QML files, images, and other resource files used by an application can be stored into the application executable using the Qt resource system. This way, simply deploying the application binary is all that is required for deploying also the resources.

Alternatively, you can list the files in an application's .pro file as follows:

appFiles.files = \
    image1.png \
    image2.png \
    qml
appFiles.path = /data/user/qt/$$TARGET
INSTALLS += appFiles

Above, two PNG images from the application source directory, and the entire qml subdirectory are included in the deployment.

Note: From Qt Creator 4.2.0 onwards, wildcards are not supported.

Custom Deployment Steps

Qt Creator allows you to execute custom commands on the embedded device connected to the development host. You can add the custom commands to the deployment phase of your project.

To add a custom step to be executed during deployment:

  1. In Qt Creator, go to Projects > Run for the Boot to Qt version you want to customize.
  2. Click Add Deploy Step and select Run custom remote command.
  3. Enter the command to be executed.

Available under certain Qt licenses.
Find out more.