Deploy directory containing qml files for WinRT application



  • I'm currently trying to deploy an application for WinRT.

    I use Qt 5.10.0 and VS 2017

    The project consists of a plugin and the actual app. The plugin is only available locally in the project. The project structure looks like this:

    ApplicationDirectory
     |- plugin
     | | plugin.pro
     | | {... other files ...}
     |- app
     | | app.pro
     | | {... other files ...}
     | Application.pro
    

    Application.pro:

    TEMPLATE = subdirs
    
    SUBDIRS += plugin app
    

    app.pro:

    TEMPLATE = app
    
    # .....
    
    # Additional import path used to resolve QML modules in Qt Creator's code model
    # The qml files from the plugin are copied there while building
    QML_IMPORT_PATH = "$$OUT_PWD/../plugin/qml"
    
    # .....
    
    winrt {
        # copy qml files to same folder like the executable so the application sees the qml files
        copydata.commands = $(COPY_DIR) $$shell_path($$OUT_PWD/../plugin/qml/*) $$shell_path($$DESTDIR)
        first.depends = $(first) copydata
        export(first.depends)
        export(copydata.commands)
        QMAKE_EXTRA_TARGETS += first copydata
    }
    

    As you can see I manually copy the qml files from the plugin to the build directory so the application sees them.

    After building everything I run qmake -tp vc with my app.pro (not the Application.pro (...see structure)) file with the build directory as base directory.

    A VS Project is created which can be opened and build without any problem using VS 2017. When the apps starts it complains that the plugin is missing:

    main.qml:6: module "MyPlugin.Utils" is not installed
    

    If I manually copy the qml directory from the plugin into the directory where VS build the application to it works fine.
    Normally windeployqt copied all dependencies where they shoul be which works for every other dependency. I guess this is correct as my plugin is nowhere installed but just part of my project. Manually copying the qml files works only if I start the application with VS but if I create an actual application package using VS it ofcourse does not copy the qml directory from the plugin and the final application won't work.

    So is there any way to actually tell qmake to create the VS project with the qml directory of the plugin as dependant?

    For iOS you can use QMAKE_BUNDLE_DATA to bundle additional directories into the final app. Is there something like this for WinRT too?

    If you need more information I will try to provide them.

    Cheers


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.