aboutsummaryrefslogtreecommitdiffstats
path: root/src/ivicore/doc/src/ivigenerator/qmake-integration.qdoc
blob: aa3707018f93e423611766433dd02a567360d810 (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
127
128
129
130
131
132
133
134
135
/****************************************************************************
**
** Copyright (C) 2021 The Qt Company Ltd.
** 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 Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt 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 Use the Generator

Qt IVI Generator is fully integrated in qmake to generate all or part of a project.

In it's simplest form, qmake can generate all the source code and the project only needs to
configure the type of project to build.

For complex setups, you can combine generated code with application specific code to extend
and use the generated code.

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

The following qmake variables are available:
\table
    \row
        \li QFACE_FORMAT
        \li frontend (default), simulator_backend
    \row
        \li QFACE_SOURCES
        \li A single \c .qface input file.
    \row
        \li QFACE_MODULE_NAME
        \li Optional. The name of the module that is using the generated code.
    \row
        \li QFACE_OUTPUT_DIR
        \li The output folder where the generated code is placed. The default location is the
            current build folder.
    \row
        \li QFACE_ANNOTATIONS
        \li A list of additional annotation files in YAML format. For more information, see the
            \l{annotations-option}{Annotations Option}.
    \row
        \li QFACE_IMPORT_PATH
        \li A list of import paths, which are considered when an IDL file uses an import statement.
            For more information, see the \l{import-option}{Import Option}.
\endtable

For more details on the generator's command line arguments, see \l {Use the Generator}.

\quotation
\note Since the \c ivigenerator has specific system dependencies, it may not be available in all
      QtIviCore installation. In this case, the \c ivigenerator qmake feature is also not
      available and this can result in build errors.

In this case, use the following code snippet that makes sure the build stops and provides a
meaningful error message:

\code
QT_FOR_CONFIG += ivicore
!qtConfig(ivigenerator): error("No ivigenerator available")
\endcode
\endquotation

\section1 QtModule Support

The qmake integration also supports generating code that you can subsequently compile into a Qt
module. Since this module needs to work more closely with Qt's module building system, it shouldn't
be loaded using the \c CONFIG variable, but using the \c load() function instead. The
\c ivigenerator_qt_module feature replaces the \c load(qt_module) call.

The following shows how you can integrate the QtIviVehicleFunctions module:

\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, the \c sync.profile also needs to be
changed, as it's used to call the \c syncqt.pl script that generates the forwarding headers.
Usually, the \c sync.profile is setup to search for these headers in the source folders. Using
\c $out_basedir, you can also extend the script to search in the build folder.

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

*/