Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Deploying QML app with minimal dependencies



  • Hi guys. I have created a small QML app and I am using the windeployqt.exe tool to collect all the app dependencies.

    In total the dependencies sum to approximately 80 mb so I was wondering if some of the stuff is optional.

    I get the following folders each containing various dlls and files:

    • bearer
    • iconengines
    • imageformats
    • qmltooling
    • QtGraphicalEffects
    • scenegraph
    • styles
    • translations
    • platforms
    • Qt
    • QtQml
    • QtQuick
    • QtQuick.2

    However if I remove all these folders so only the following remain the application still works on a fresh Windows 10 VM with nothing installed:

    • platforms
    • Qt
    • QtQml
    • QtQuick
    • QtQuick.2

    How do I know what I can and can't remove without breaking the application on some machines? Can the windeployqt.exe tool be used to generate just the bare minimum dependencies?

    Cheers, Aaron.


  • Moderators

    @aaronwg said in Deploying QML app with minimal dependencies:

    Can the windeployqt.exe tool be used to generate just the bare minimum dependencies

    it usually does. What were arguments, especially the qml dir one.

    Is this a release or debug build?



  • Yes, windeployqt should be enough. Or you can basically copy all the dependencies to your application path, then change the name of your Qt folder (Ex: C:/Qt5.12.3 -> C:/notQt5.12.13), then run the app, then try to delete everything inside the app folder. File explorer will tell you which files are being used. (If there are sub-folders inside your app-path, you should do the removing for all the sub-folders too)



  • Hi thanks for the quick replies.

    If I can keep the process automated using the windeployqt tool that would be preferable since I'm running it automatically in a CMAKE file.

    Currently I am simply running it using the following:

    ./windeployqt.exe --release --qmldir <folder-containing-qml-files>



  • @closx said in Deploying QML app with minimal dependencies:

    Yes, windeployqt should be enough. Or you can basically copy all the dependencies to your application path, then change the name of your Qt folder (Ex: C:/Qt5.12.3 -> C:/notQt5.12.13), then run the app, then try to delete everything inside the app folder. File explorer will tell you which files are being used. (If there are sub-folders inside your app-path, you should do the removing for all the sub-folders too)

    I tried a similar method by copying the deploy folder to a fresh Windows VM and removing dependencies one by one to see what I could remove without breaking the application. It seemed I could remove quite a lot before it stopped running


  • Moderators

    @aaronwg said in Deploying QML app with minimal dependencies:

    folder-containing-qml-files

    the qml file from your project (the one where main.qml is) or the ones from the QtLibrary ?



  • @J.Hilk said in Deploying QML app with minimal dependencies:

    @aaronwg said in Deploying QML app with minimal dependencies:

    folder-containing-qml-files

    the qml file from your project (the one where main.qml is) or the ones from the QtLibrary ?

    The folder containing all of my applications QML files. It's a small app so all my QML, QRC and C++ source files are in this directory.


  • Moderators

    @aaronwg
    well, then it's as minimal as the tool can make it.

    I'm surprised that the program is still running with so much removed. Did you check every functionality ? Some components are loaded dynamically and not on startup.



  • @aaronwg depending to my experiences, %90 of that dll files are garbage for your app .d Good work!



  • I've been playing with some of the windeployqt flags and these two are interesting:

    --no-angle
    --no-opengl-sw

    omitting the --no-opengl-sw flag will include a dll called opengl32sw.dll
    omitting the --no-angle flag will include two dlls called libGLESV2.dll and libEGL.dll in the dependencies

    opengl32sw.dll is 20.5 MB and the other two DLLs are 3.5 MB.

    If I understand correctly the opengl32sw.dll provides a software implementation of open GL while the other two DLLs provide an open GL interface to Direct X.

    If I was interested in saving the 17 MB of space difference between the two how safe would it be to just use the angle dlls and no opengl32sw.dll? Does Windows 10 always ship with an angle compatible version of direct X? or is it best practice to always distribut apps with opengl32sw.dll to ensure it has something to fall back on?


Log in to reply