[QBS] Copying QML files to build directory

Kandeler Christian Christian.Kandeler at digia.com
Mon Dec 30 16:16:42 CET 2013


the main problem I see here is that you are mixing the concepts of "installation" and "copying to build directory". Either you install all your products or none. If you do the latter, then you need special code in your project files that copies over the resources. In general, I think it's not worth the effort to make a project runnable from the build dir; just install it -- you need that infrastructure anyway for the final deployment.
In your particular case, the problem seems to be that you give the top of the build directory as the installation root. This is asking for trouble. Point it to a place outside or -- even simpler -- leave it at the default. If the installation root matters in any way, there is a problem with your project.

From: qbs-bounces+christian.kandeler=digia.com at qt-project.org [qbs-bounces+christian.kandeler=digia.com at qt-project.org] on behalf of achartier at fastmail.fm [achartier at fastmail.fm]
Sent: 26 December 2013 19:21
To: qbs at qt-project.org
Subject: [QBS] Copying QML files to build directory


I am having some difficulty getting qbs to copy my QML and image
resource files to the output directory. I have followed the directions
as described here
(http://qt-project.org/doc/qbs-1.1/installing-files.html) and have
created a Group element and added the following deploy step to Qt

qbs install --install-root

According to the documentation, the folder I specify for qbs.installDir
should be relative to the folder specified above for the --install-root
argument. This does not seem to be the case. The files are being
installed to
instead. Furthermore, for some reason, only the .png files are being
copied over; no qml files are being copied, even though they are
specified in the Group element's files property.

I have included my project file below. Any help is greatly appreciated.
FYI, I am using Qt Creator 3.0 and Qt 5.2.



import qbs 1.0

Project {
    property string name: 'MyProject'

    Product {
        id: product
        name: project.name
        type: "application"

        Depends { name: "cpp" }
        Depends { name: "Qt.gui" }
        Depends { name: "Qt.qml" }
        Depends { name: "Qt.quick" }

        cpp.cxxFlags: "-std=c++0x"

        files: ['**/*.qml', '**/*.js', '**/*.cpp', '**/*.h',
        excludeFiles: ['**/moc_*.cpp', "test/**/*"]

        // Copy qml files to build dir; does not currently work as
        Group {
            name: "QML Resources"
            files: ["**/*.png", "**/*.qml"]
            qbs.install: true
            qbs.installDir: "qml/MyProject"

    Product {
        id: unitTests
        name: "unitTests"
        type: "application"

        Depends { name: "cpp" }
        Depends { name: "Qt.test" }

        cpp.cxxFlags: "-std=c++0x"

        files: ["test/unit/*.cpp", "test/unit/*.h", "backend/*.cpp",
QBS mailing list
QBS at qt-project.org

More information about the Qbs mailing list