[SOLVED] How to copy all QML files to QML Plugin install folder
-
Hi everyone!
I never needed this, but today I faced with necessary to copy my QML files of Plugin library to installation folder. This is how looks my '*.pro' file of plugin.
@
TEMPLATE = lib
TARGET = Msl
QT += qml quick
CONFIG += qt pluginDESTDIR = com/shav/msl
OBJECTS_DIR = tmp/objects
MOC_DIR = tmp/mocsTARGET = $$qtLibraryTarget($$TARGET)
uri = com.shav.mslInput
SOURCES +=
msl_plugin.cpp
mslmanager.cpp
msltexture.cpp
mslshadow.cpp
mslgradient.cpp
msleventcode.cpp
mslevent.cpp
mslelement.cpp
mslcallback.cpp
mslanimation.cpp
msl.cpp
mslinfo.cpp
mslanimationframe.cpp
mslcontroller.cpp
mslstyle.cpp
mslappearanceinfo.cpp
msltextattribute.cpp
mslnsmutableparagraphstyle.cpp
mslremoterequest.cpp
msllistmodel.cpp
mslhelpers.cpp
mslviewitem.cpp
mslcontrolleritem.cppHEADERS +=
msl_plugin.h
mslmanager.h
msltexture.h
mslshadow.h
mslgradient.h
msleventcode.h
mslevent.h
mslelement.h
mslconstants.h
mslcallback.h
mslanimation.h
msl.h
mslinfo.h
mslanimationframe.h
mslcontroller.h
mslstyle.h
mslappearanceinfo.h
msltextattribute.h
mslnsmutableparagraphstyle.h
mslremoterequest.h
msllistmodel.h
mslhelpers.h
mslviewitem.h
mslcontrolleritem.hOTHER_FILES = qmldir
MslQmlControllerItem.qml!equals(PRO_FILE_PWD, $$OUT_PWD) {
copy_qmldir.target = $$OUT_PWD/$$DESTDIR/qmldir
copy_qmldir.depends = $$PRO_FILE_PWD/qmldir
copy_qmldir.commands = $(COPY_FILE) "$$replace(copy_qmldir.depends, /, $$QMAKE_DIR_SEP)" "$$replace(copy_qmldir.target, /, $$QMAKE_DIR_SEP)"
QMAKE_EXTRA_TARGETS += copy_qmldir
PRE_TARGETDEPS += $$copy_qmldir.target
}qmldir.files = qmldir
unix {
installPath = $$[QT_INSTALL_IMPORTS]/$$replace(uri, \., /)
qmldir.path = $$installPath
target.path = $$installPath
INSTALLS += target qmldir
}HEADERS +=
mslerrorobject.hSOURCES +=
mslerrorobject.cpp
@I need to copy file 'MslQmlControllerItem.qml' to the target folder. What I must add to the "*.pro" file to copy all qml files.
Thanks for the any help!
-
Creating a Qt Quick Application project can give you some hints.
qtquick2applicationviewer.pri do what you want
-
[quote author="Vincent007" date="1391524644"]Creating a Qt Quick Application project can give you some hints.
qtquick2applicationviewer.pri do what you want[/quote]
Thanks for the reply! I found solution:
@
!equals(PRO_FILE_PWD, $$OUT_PWD) {
copy_qmldir.target = $$OUT_PWD/$$DESTDIR/qmldir
copy_qmldir.depends = $$PRO_FILE_PWD/qmldir
copy_qmldir.commands = $(COPY_FILE) "$$replace(copy_qmldir.depends, /, $$QMAKE_DIR_SEP)" "$$replace(copy_qmldir.target, /, $$QMAKE_DIR_SEP)"sourceQmlFilesPath = $$_PRO_FILE_PWD_/MslQmlControllerItem.qml targetQmlFilesPath = $$OUT_PWD/$$DESTDIR/MslQmlControllerItem.qml copy_qmldir.commands += && $(COPY_FILE) \"$$replace(sourceQmlFilesPath, /, $$QMAKE_DIR_SEP)\" \"$$replace(targetQmlFilesPath, /, $$QMAKE_DIR_SEP)\" QMAKE_EXTRA_TARGETS += copy_qmldir PRE_TARGETDEPS += $$copy_qmldir.target
}
@