diff options
author | Sarah Smith <sarah.j.smith@nokia.com> | 2012-02-29 10:15:01 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-23 06:10:59 +0100 |
commit | 907b9b08026838bd59643a748231aca2069cf930 (patch) | |
tree | 8e060ff73cd741f8f8a093e7ab79370686acbd3e /pkg.pri | |
parent | ef7aa31629b1455a479fc6e3b28d89a9da60ef8f (diff) |
Refactor packaging and deployment.
Updating Qt3D's packaging and deployment: remove some platform specific
packaging references. These can be hidden away in the build scripts for
those platforms and do no need to be in the generic package logic. To
support this approach begin fixing qmlres and the main.cpp's.
Fix and streamline the pkg.pri file, and add some much needed comments.
Note that this change *will* break current packaging scripts - those can
need to be fixed in seperate commits.
Change-Id: I05c2081f61b91bc91673668f6e423a206ac026d5
Reviewed-by: Sarah Jane Smith <sarah.j.smith@nokia.com>
Diffstat (limited to 'pkg.pri')
-rw-r--r-- | pkg.pri | 111 |
1 files changed, 66 insertions, 45 deletions
@@ -1,41 +1,66 @@ -mt { - desktopfile.files = $${TARGET}.qmlproject info.json - desktopfile.path = /opt/mt/applications/$$TARGET - icon.files = $$ICON_FILE - icon.path = /opt/mt/applications/$$TARGET - INSTALLS += desktopfile icon +# This file is an interim measure until deployment becomes more clear for +# the Qt5 SDK and Qt3D. Read this file in conjunction with the logic in +# qmlres.cpp. Once Qt5 is stable and deployment is clear this will be +# removed. Also check the README file. + +package { + # default install path for packaging qml resources - package case + resource_dir = $$[QT_INSTALL_DATA]/qt3d/resources/$$CATEGORY/$${TARGET} +} else { + # if we're not packaging, build all our demos/examples/etc and supporting files + # into $BUILD_DIR/bin + DESTDIR = ../../../bin + + # default install path for packaging qml resources - developer case + resource_dir = $$DESTDIR/resources/$$CATEGORY/$${TARGET} } -!package: DESTDIR = ../../../bin +# package the binary wrapper that launches the QML +package { + macx: resource_dir = $$[QT_INSTALL_DATA]/qt3d/$${TARGET}.app/Contents/Resources + target.path = $$[QT_INSTALL_DATA]/qt3d + INSTALLS += target +} else { + macx: resource_dir = $$DESTDIR/$$QMAKE_BUNDLE/Contents/Resources/qml +} +# The QML_INFRA_FILES and QML_MESHES_FILES are both about QML based +# applications, so we'll install them into QT_INSTALL_DATA instead of +# QT_INSTALL_BINS +# QML_INFRA_FILES is used by our quick3d demos and examples to indicate files +# that are part of the application and should be installed (e.g. qml files, +# images, meshes etc). +# This conditional serves two purposes: +# 1) Set up a qmake extra compiler to copy relevant QML files at build time +# to allow for a normal "change, make, test" developement cycle +# 2) Set up appropriate install paths on the same files to use "make install" +# for building packages !isEmpty(QML_INFRA_FILES) { + # rules to copy files from the *base level* of $$PWD/qml into the right place package { copyqmlinfra_install.files = $$QML_INFRA_FILES - mt { - copyqmlwrap.files = mt.qml - copyqmlwrap.path = /opt/mt/applications/$$TARGET - INSTALLS += copyqmlwrap - copyqmlinfra_install.path = /opt/mt/applications/$$TARGET/qml - } else { - macx { - copyqmlinfra_install.path = $$DESTDIR/$${TARGET}.app/Contents/Resources/qml - } else { - copyqmlinfra_install.path = $$DESTDIR/resources/$$CATEGORY/$${TARGET}/qml - } - } + mt: copyqmlinfra_install.files += info.json mt.qml $$ICON_FILE + copyqmlinfra_install.path = $$resource_dir/qml INSTALLS += copyqmlinfra_install } else { - macx { - target_dir = $$DESTDIR/$${TARGET}.app/Contents/Resources/qml - } else { - target_dir = $$DESTDIR/resources/$$CATEGORY/$${TARGET}/qml - target_dir ~= s,/,$$QMAKE_DIR_SEP, - } + # if we're not packaging, put all our demos/examples and supporting files + # into $BUILD_DIR/bin + target_dir = $$resource_dir/qml + target_dir ~= s,/,$$QMAKE_DIR_SEP, + # create extra qmake compiler to copy files across during build step copyqmlinfra.input = QML_INFRA_FILES copyqmlinfra.output = $$target_dir/${QMAKE_FILE_IN_BASE}${QMAKE_FILE_EXT} - win32: copyqmlinfra.commands = $$QMAKE_CHK_DIR_EXISTS $$target_dir - copyqmlinfra.commands += $(MKDIR) $$target_dir && $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT} + win32: isEmpty(QMAKE_SH) { + # If we are in windows, and not a mingw shell, then the mkdir binary does not handle + # the -p switch, and will fail if the directory already exists, so make it subject to + # an "exists" test. The parens are necessary otherwise the copy won't occur when the + # test fails, since $$QMAKE_CHK_DIR_EXISTS is "IF NOT EXISTS" + copyqmlinfra.commands = ($$QMAKE_CHK_DIR_EXISTS $$target_dir $$QMAKE_MKDIR $$target_dir) && $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT} + } else { + # in mac, linux, and windows-with-mingw $$QMAKE_MKDIR has -p so this will always work + copyqmlinfra.commands = $$QMAKE_MKDIR $$target_dir && $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT} + } copyqmlinfra.CONFIG += no_link_no_clean copyqmlinfra.variable_out = POST_TARGETDEPS QMAKE_EXTRA_COMPILERS += copyqmlinfra @@ -46,28 +71,24 @@ mt { # rules to copy files from the *base level* of $$PWD/qml/meshes into the right place package { copyqmlmeshes_install.files = $$QML_MESHES_FILES - mt { - copyqmlmeshes_install.path = /opt/mt/applications/$$TARGET/qml/meshes - } else { - macx { - copyqmlmeshes_install.path = $$DESTDIR/$${TARGET}.app/Contents/Resources/qml/meshes - } else { - copyqmlmeshes_install.path = $$DESTDIR/resources/$$CATEGORY/$${TARGET}/qml/meshes - } - } + copyqmlmeshes_install.path = $$resource_dir/qml/meshes INSTALLS += copyqmlmeshes_install } else { - macx { - target_dir = $$DESTDIR/$${TARGET}.app/Contents/Resources/qml/meshes - } else { - target_dir = $$DESTDIR/resources/$$CATEGORY/$${TARGET}/qml/meshes - target_dir ~= s,/,$$QMAKE_DIR_SEP, - } + target_dir = $$resource_dir/qml/meshes + target_dir ~= s,/,$$QMAKE_DIR_SEP, copyqmlmeshes.input = QML_MESHES_FILES copyqmlmeshes.output = $$target_dir/${QMAKE_FILE_IN_BASE}${QMAKE_FILE_EXT} - win32: copyqmlmeshes.commands = $$QMAKE_CHK_DIR_EXISTS $$target_dir - copyqmlmeshes.commands += $(MKDIR) $$target_dir && $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT} - copyqmlmeshes.CONFIG += no_link_no_cle:qan + win32: isEmpty(QMAKE_SH) { + # If we are in windows, and not a mingw shell, then the mkdir binary does not handle + # the -p switch, and will fail if the directory already exists, so make it subject to + # an "exists" test. The parens are necessary otherwise the copy won't occur when the + # test fails, since $$QMAKE_CHK_DIR_EXISTS is "IF NOT EXISTS" + copyqmlmeshes.commands = ($$QMAKE_CHK_DIR_EXISTS $$target_dir $$QMAKE_MKDIR $$target_dir) && $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT} + } else { + # in mac, linux, and windows-with-mingw $$QMAKE_MKDIR has -p so this will always work + copyqmlmeshes.commands = $$QMAKE_MKDIR $$target_dir && $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT} + } + copyqmlmeshes.CONFIG += no_link_no_clean copyqmlmeshes.variable_out = POST_TARGETDEPS QMAKE_EXTRA_COMPILERS += copyqmlmeshes } |