Distribuir aplicación Qt-5 en Windows

Luego de haber creado nuestra aplicación Qt 5 para Windows la pregunta es, como la distribuimos, es decir que necesitamos hacer para que nuestra aplicación se ejecute en los ordenadores de los usuarios, para esta tarea el Framework Qt nos provee de una herramienta de línea de comandos llamada windeployqt, es este tutorial vamos a ver su uso.

Asumimos que ya tenemos nuestra aplicación compilada correctamente y ya hemos generado el ejecutable al que para este ejemplo llamaremos test-deploy.exe, ubicamos este archivo y lo copiamos a una carpeta de nuestra preferencia para nosotros "C:\Developer\miapp\test-deploy.exe".

Lo siguiente es agregar windeployqt al PATH si aun no lo hemos hecho disponemos del script
qtenv2.bat para esta tarea el mismo se puede encontrar en la carpeta de instalación de Qt en mi caso "C:\Developer\qt-5.12.3\5.12.3\mingw73_32\bin\qtenv2.bat" abrimos una ventana de comandos y ejecutamos este script.

Para finalizar solo debemos ejecutar en la misma ventana CMD el comando: windeployqt aplicacion.exe.

Para comprobar que todo funciona correctamente puedes llevar la carpeta que contiene la aplicación y todos los archivos que se acaban de crear a una pc que no tenga instalado Qt y ejecutar la aplicación.

Podemos usar una o varias de las siguientes opciones de configuración para cambiar el resultado de nuestro deploy, por ejemplo: windeployqt --no-angle aplicacion.exe en donde --no-angle deshabilita el despliegue de ANGLE, estas son las posibles opciones:

-?, -h, --help           Displays this help.
-v, --version            Displays version information.
--dir <directory>        Use directory instead of binary directory.
--libdir <path>          Copy libraries to path.
--plugindir <path>       Copy plugins to path.
--debug                  Assume debug binaries.
--release                Assume release binaries.
--pdb                    Deploy .pdb files (MSVC).
--force                  Force updating files.
--dry-run                Simulation mode. Behave normally, but do not copy/update any files.
--no-patchqt             Do not patch the Qt5Core library.
--no-plugins             Skip plugin deployment.
--no-libraries           Skip library deployment.
--qmldir <directory>     Scan for QML-imports starting from directory.
--no-quick-import        Skip deployment of Qt Quick imports.
--no-translations        Skip deployment of translations.
--no-system-d3d-compiler Skip deployment of the system D3D compiler.
--compiler-runtime       Deploy compiler runtime (Desktop only).
--no-compiler-runtime    Do not deploy compiler runtime (Desktop only).
--webkit2                Deployment of WebKit2 (web process).
--no-webkit2             Skip deployment of WebKit2.
--json                   Print to stdout in JSON format.
--angle                  Force deployment of ANGLE.
--no-angle               Disable deployment of ANGLE.
--no-opengl-sw           Do not deploy the software rasterizer library.
--list <option>          Print only the names of the files copied.
  Available options:
    source:   absolute path of the source files
    target:   absolute path of the target files
    relative: paths of the target files, relative to the target directory
    mapping:  outputs the source and the relative target, suitable for use within an Appx mapping file
--verbose <level>        Verbose level (0-2).

Sí tu aplicación utiliza Qt WebEngine debes tomar algunas medidas extras: Qt deploy QtWebEngine

Comentarios

Temas relacionados

Entradas populares de este blog

tkinter Grid

tkinter Canvas

Conectar SQL Server con Java

Histogramas OpenCV Python