summaryrefslogtreecommitdiff
path: root/src/ivicore/doc/src/ivigenerator/qmake-integration.qdoc
blob: cf1b01fdac1df0687a11b122d27abdf890c30bc3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/****************************************************************************
**
** Copyright (C) 2019 Luxoft Sweden AB
** Copyright (C) 2018 Pelagicore AG
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the QtIvi module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL-QTAS$
** Commercial License Usage
** Licensees holding valid commercial Qt Automotive Suite licenses may use
** this file in accordance with the commercial license agreement provided
** with the Software or, alternatively, in accordance with the terms
** contained in a written agreement between you and The Qt Company.  For
** licensing terms and conditions see https://www.qt.io/terms-conditions.
** For further information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\page qmake-integration.html
\title QMake Integration
\previouspage Autogenerator usage

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:
\code
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
QFACE_ANNOTATIONS = annotation.yaml
\endcode

Available QMake Variables:
\table
    \row
        \li QFACE_FORMAT
        \li frontend (default), simulator_backend
    \row
        \li QFACE_SOURCES
        \li list of .qface input files
    \row
        \li QFACE_MODULE_NAME
        \li The (optional) name of the module that is using the generated code
    \row
        \li QFACE_OUTPUT_DIR
        \li Output folder where the generated code will be created. The default
            is to use the current build folder
    \row
        \li QFACE_ANNOTATIONS
        \li list of additional annotation YAML files.
\endtable


See \l {Autogenerator usage} for more details on the generator command line arguments.

\quotation
\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:
\code
QT_FOR_CONFIG += ivicore
!qtConfig(ivigenerator): error("No ivigenerator available")
\endcode
\endquotation

\section1 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 \e CONFIG variable, but using the \e load() function instead. The \e
ivigenerator_qt_module feature replaces the \e load(qt_module) call. The following shows how the
integration of the QtIviVehicleFunctions module is done.

\badcode
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)
\endcode

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

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

*/