qt5base-lts/mkspecs/features/qml_plugin.prf
Thiago Macieira df3631045c Add a new location for QML 2.x imports
This commits adds a -qmldir configuration option for the configures to
allow the user to change the default location (it defaults to
$archdatadir/qml).

It adds a QLibraryInfo::Qml2ImportsPath value for
QLibraryInfo::location, a qmake property of QT_INSTALL_QML and a qt.conf
configure location entry "Qml2Imports".

At the same time, it makes the qmake .prf files dealing with QML plugins
be the QML 2 version. Those files are new in Qt 5, so we have the option
to choose which version we want to use.

Discussed-on: http://lists.qt-project.org/pipermail/development/2012-October/007136.html
Change-Id: I8c1c53e8685a5934ed0a9a42ba5663297b81a677
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2012-11-19 15:25:54 +01:00

81 lines
2.7 KiB
Plaintext

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)
QMLTYPEFILE = $$_PRO_FILE_PWD_/plugins.qmltypes
exists($$QMLTYPEFILE): QML_FILES += $$QMLTYPEFILE
# Install rules
qml1_target {
DESTDIR = $$eval(QT.$${CXX_MODULE}.imports)/$$TARGETPATH
instbase = $$[QT_INSTALL_IMPORTS]
} else {
DESTDIR = $$eval(QT.$${CXX_MODULE}.qml)/$$TARGETPATH
instbase = $$[QT_INSTALL_QML]
}
target.path = $$instbase/$$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)
qml1_target: \
qmlplugindump = qml1plugindump
else: \
qmlplugindump = qmlplugindump
qtPrepareTool(QMLPLUGINDUMP, $$qmlplugindump)
importpath.value =
for(qmod, QMAKEMODULES) {
qmod = $$section(qmod, /, 0, -3)/imports
qml1_target: qmod = $$qmod/QtDeclarative
exists($$qmod): importpath.value += $$shell_path($$qmod)
}
importpath.name = QML_IMPORT_PATH
importpath.value = $$unique(importpath.value)
qtAddToolEnv(QMLPLUGINDUMP, importpath)
TARGETPATHBASE = $$replace(TARGETPATH, \\.\\d+\$, )
qmltypes.target = qmltypes
qmltypes.commands = $$QMLPLUGINDUMP $$replace(TARGETPATHBASE, /, .) $$IMPORT_VERSION > $$QMLTYPEFILE
qmltypes.depends = $$QMAKE_RESOLVED_TARGET
} else {
qmltypes.CONFIG += recursive
}
QMAKE_EXTRA_TARGETS += qmltypes
}
load(qml_module)