summaryrefslogtreecommitdiffstats
path: root/mkspecs/features
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2012-07-09 19:17:00 +0200
committerQt by Nokia <qt-info@nokia.com>2012-07-11 02:47:16 +0200
commitfaac4c0a3cfecc7805d3f14480ccbd9fc5c5fc31 (patch)
tree89708a9466003f2ab44fa1e6a83ab811060e468b /mkspecs/features
parent1e469bac11162a1ccb3e6bf2f5b4b6a8bbd235b6 (diff)
add feature file for centralized qml plugin project handling
Change-Id: I7cdce31d7ac458656cf8e8490fd7f7e5c04ca106 Reviewed-by: Alan Alpert <alan.alpert@nokia.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
Diffstat (limited to 'mkspecs/features')
-rw-r--r--mkspecs/features/qml_plugin.prf67
1 files changed, 67 insertions, 0 deletions
diff --git a/mkspecs/features/qml_plugin.prf b/mkspecs/features/qml_plugin.prf
new file mode 100644
index 0000000000..f88e5a3a0c
--- /dev/null
+++ b/mkspecs/features/qml_plugin.prf
@@ -0,0 +1,67 @@
+load(qt_build_config)
+
+TEMPLATE = lib
+CONFIG += plugin
+
+isEmpty(CXX_MODULE) {
+ CXX_MODULE = $$TARGET
+ TARGET = declarative_$${TARGET}
+}
+isEmpty(TARGETPATH): TARGETPATH = $$eval(QT.$${CXX_MODULE}.name)
+DESTDIR = $$eval(QT.$${CXX_MODULE}.imports)/$$TARGETPATH
+isEmpty(VERSION): VERSION = $$eval(QT.$${CXX_MODULE}.VERSION_MAJOR).$$eval(QT.$${CXX_MODULE}.VERSION_MINOR)
+
+QMLDIRFILE = $$_PRO_FILE_PWD_/qmldir
+fq_qml_files = $$QMLDIRFILE
+
+QMLTYPEFILE = $$_PRO_FILE_PWD_/plugins.qmltypes
+exists($$QMLTYPEFILE): fq_qml_files += $$QMLTYPEFILE
+
+for(qmlf, QML_FILES): fq_qml_files += $$absolute_path($$qmlf, $$_PRO_FILE_PWD_)
+
+# 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 {
+ load(resolve_target)
+ qtPrepareTool(QMLPLUGINDUMP, qmlplugindump)
+ qmltypes.target = qmltypes
+ qmltypes.commands = $$QMLPLUGINDUMP $$replace(TARGETPATH, /, .) $$VERSION $$QMAKE_RESOLVED_TARGET > $$QMLTYPEFILE
+ qmltypes.depends = $$QMAKE_RESOLVED_TARGET
+ QMAKE_EXTRA_TARGETS += qmltypes
+}
+
+# Only for Qt Creator's project view
+OTHER_FILES += $$fq_qml_files
+
+# These bizarre rules copy the files to the build directory
+
+qmlfiles2build.input = fq_qml_files
+qmlfiles2build.output = $$DESTDIR/${QMAKE_FILE_BASE}${QMAKE_FILE_EXT}
+!contains(TEMPLATE, vc.*): qmlfiles2build.variable_out = PRE_TARGETDEPS
+qmlfiles2build.commands = $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT}
+qmlfiles2build.name = COPY ${QMAKE_FILE_IN}
+qmlfiles2build.CONFIG = no_link no_clean
+
+QMAKE_EXTRA_COMPILERS += qmlfiles2build
+
+# Install rules
+
+target.path = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH
+
+qmldir.files = $$fq_qml_files
+qmldir.path = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH
+
+INSTALLS += target qmldir
+
+# Some final setup
+
+TARGET = $$qtLibraryTarget($$TARGET)
+contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols
+
+load(qt_targets)