Get the App
SLTechnology News&Howtos  ›  Development  › 

How to implement Qt Project Packaging

Shulou Source: shulou.com Published: 2022-05-31 16:39:54 09月12日 Update

This article mainly introduces the relevant knowledge of how to achieve Qt project packaging, the content is detailed and easy to understand, the operation is simple and fast, and has a certain reference value. I believe you will gain something after reading this article on how to achieve Qt project packaging. Let's take a look.

Prepare project files

In essence, it is to put the dependent dynamic libraries in the folder you specify; so that when running on other computers, there is no need to install the qt development environment.

Compiling with Release in qt creator

Then open the qt command line tool, and note that it is not the command line tool that comes with windows, as follows

Switch to Release path. The example is as follows:

Cd / d D:/xxx/xxx/release

Enter the following command on the qt command line and replace xxx with your own exe name:

Windeployqt xxx.exe

If it is a qt quick project, you also need to enter the following command, and the path needs to be replaced with the qml path of your own pc:

Windeployqt xxx.exe-qmldir C:\ Qt\ Qt5.14.2\ 5.14.2\ mingw73_32\ qml

After the above steps, the release folder contains the running environment needed for the qt project; if there is a third-party dll, manual copy may be required, and in some cases, some dll included with qml also need manual copy

Use InstallShield

Suitable for making installation packages for Windows platform

Create a new basic project, Basic MSI Project

Then use this project to make the installation package.

Just follow the six steps in the figure above.

Solve the problem of automatically starting cmd window after packaging

When we write dome or work on a project, sometimes we don't want to run the console when we have a UI interface. The best way is not to choose Console when we start the project. What is the way to deal with it later?

A two-step process is needed.

1. Right-click on the project to be started-> Properties-> system-> choose windows in the subsystem. Here, console should be the default.

two。 Enter mainCRTStartup at the entry point of right-click-> Properties-> Advanced-> entry point of the project to be launched.

This is the end of the article on "how to achieve Qt Project Packaging". Thank you for reading! I believe that everyone has a certain understanding of the knowledge of "how to achieve Qt project packaging". If you want to learn more knowledge, you are welcome to follow the industry information channel.

Tags: Project command file knowledge path input run content that is properties tools situation manual folder step environment article production processing selection Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS OPPO Reno MariaDB Docker Microsoft