QMake Integration

Qt IVI Generator has been integrated with QMake to generate all or part of projects.

In it's simplest form, QMake can generate all the source code and the project only need to configure what type of project is built.

For complex setups, generated code can be combined with application specific code which can extend and use it.

Example:

CONFIG += ivigenerator

QT_FOR_CONFIG += ivicore
!qtConfig(ivigenerator): error("No ivigenerator available")

QFACE_FORMAT = frontend
QFACE_SOURCES = example.qface
QFACE_MODULE_NAME = myModule
QFACE_OUTPUT_DIR = myOutputDir

Available QMake Variables:

QFACE_FORMATfrontend (default), simulator_backend
QFACE_SOURCESlist of .qface input files
QFACE_MODULE_NAMEThe (optional) name of the module that is using the generated code
QFACE_OUTPUT_DIROutput folder where the generated code will be created. The default is to use the current build folder

See Autogenerator usage for more details on the generator command line arguments.

Note: As the ivigenerator has specific system dependencies, it may not be available in every QtIviCore installation. In this case the ivigenerator qmake feature is also not available and this can result in build errors.

The following code snippet makes sure to stop the build and give a meaningful error message in this case:

QT_FOR_CONFIG += ivicore
!qtConfig(ivigenerator): error("No ivigenerator available")

QtModule support

The Qmake Integration also supports generating code which enables you to compile the generated code as a qt module. As it needs to work more closely with the Qt's module build system, it shouldn't be loaded using the CONFIG variable, but using the load() function instead. The ivigenerator_qt_module feature replaces the load(qt_module) call. The following shows how the integration of the QtIviVehicleFunctions module is done.

TARGET = QtIviVehicleFunctions
QT = core core-private ivicore ivicore-private
CONFIG += c++11 ivigenerator

QT_FOR_CONFIG += ivicore
!qtConfig(ivigenerator): error("No ivigenerator available")

...

QFACE_MODULE_NAME = QtIviVehicleFunctions
QFACE_SOURCES += ivivehiclefunctions.qface

load(ivigenerator_qt_module)

In addition to the project file for the module library also the sync.profile needs to be changed, as this is used to call the syncqt.pl script which generates the forwarding headers. Usually the sync.profile is setup to search for the headers in the source folders. Using $out_basedir it can be extended to also search in the build folder.

...
%modules = ( # path to module name map
    "QtIviVehicleFunctions" => "$basedir/src/ivivehiclefunctions;$out_basedir/src/ivivehiclefunctions"
);
...

© 2018 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.