summaryrefslogtreecommitdiffstats
path: root/mkspecs/features/qml_plugin.prf
blob: 8efc8c99598381f6a5026b30bf72d4155da19ada (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
load(qt_build_config)

TEMPLATE = lib
CONFIG += plugin

if(win32|mac):!macx-xcode {
    contains(QT_CONFIG, debug_and_release):CONFIG += debug_and_release
    contains(QT_CONFIG, build_all):CONFIG += build_all
}
contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols
contains(QT_CONFIG, separate_debug_info):CONFIG += separate_debug_info
contains(QT_CONFIG, separate_debug_info_nocopy):CONFIG += separate_debug_info_nocopy
contains(QT_CONFIG, c++11):CONFIG += c++11

isEmpty(CXX_MODULE) {
    CXX_MODULE = $$TARGET
    TARGET = declarative_$${TARGET}
}
isEmpty(TARGETPATH): TARGETPATH = $$eval(QT.$${CXX_MODULE}.name)
DESTDIR = $$eval(QT.$${CXX_MODULE}.imports)/$$TARGETPATH

QMLTYPEFILE = $$_PRO_FILE_PWD_/plugins.qmltypes
exists($$QMLTYPEFILE): QML_FILES += $$QMLTYPEFILE

# Install rules

target.path = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH
INSTALLS += target

# Some final setup

TARGET = $$qtLibraryTarget($$TARGET)

load(qt_targets)

# plugins.qmltypes is used by Qt Creator for syntax highlighting and the QML code model.  It needs
# to be regenerated whenever the QML elements exported by the plugin change.  This cannot be done
# automatically at compile time because qmlplugindump does not support some QML features and it may
# not be possible when cross-compiling.
#
# To regenerate run 'make qmltypes' which will update the plugins.qmltypes file in the source
# directory.  Then review and commit the changes made to plugins.qmltypes.
#
!cross_compile {
    build_pass|!debug_and_release {
        isEmpty(IMPORT_VERSION): IMPORT_VERSION = $$eval(QT.$${CXX_MODULE}.MAJOR_VERSION).$$eval(QT.$${CXX_MODULE}.MINOR_VERSION)

        load(resolve_target)
        qtPrepareTool(QMLPLUGINDUMP, qmlplugindump)
        qmltypes.target = qmltypes
        qmltypes.commands = $$QMLPLUGINDUMP $$replace(TARGETPATH, /, .) $$IMPORT_VERSION $$QMAKE_RESOLVED_TARGET > $$QMLTYPEFILE
        qmltypes.depends = $$QMAKE_RESOLVED_TARGET
    } else {
        qmltypes.CONFIG += recursive
    }
    QMAKE_EXTRA_TARGETS += qmltypes
}

load(qml_module)