Reputation: 199
I developped an application in C++ using Qt for the graphic interface and now I would like to release it for linux and for Windows. I've been looking through documentation, forums and tutorials but I can't really understand what need to be done...
I'm pretty confused between the different terms used : what is the difference between releasing and deploying ? when do you need an installer and if needed, how to create one ?
What are the different steps to create the .exe of Windows ? and its equivalent for the different versions of Linux (Debian, Ubuntu, Ubuntu Mate)?
I am currently on Ubuntu and used Qt Creator to code the application.
As far as I know, I need to deploy Shared Libraries.
Any help, answer, guide or documentation for beginner would be of great help and very welcome :)
Upvotes: 6
Views: 15879
Reputation: 2035
Another approach is:
Open your project in Qt.
Select projects
from left.
In Buils Steps
select Add Build Step
Complete the form as below:
Command
: C:\Qt\Qt5.12.12\5.12.12\mingw73_64\bin\windeployqt.exe
Argument
: C:\path\to\your\project\release\folder\yourapp.exe
Example: consider the projet name is TestApp and its address is C:\TestApp. The argument should be like:
C:\build-TestApp-Desktop_Qt_5_12_12_MinGW_64_bit-release\release\TestApp.exe
Wrking Directory
: %{buildDir}
Doing this way, every time that you build your project, related libraries would be copied to your release folder.
Upvotes: 0
Reputation: 2534
There are several ways to deploy your application
1. Deploy your application with windeployqt/linuxdeployqt
This is the easiest way, windeployqt or linuxdeployqt is an application that will copy all required dependencies to your executable folder. Ready to run on another computer.
The steps are simple:
Note: linuxdeployqt is third-party.
2. Static build
Static build will be a single binary at the end that includes all Qt code. You can ship your single binary to someone, no additional libraries are required to run it. The executable is larger since all the Qt code is linked inside your executable.
The steps are as following:
Switch to the folder and type
./configure -static -static-runtime
nmake
or make
to build Qt statically.qmake.exe
or qmake
from your source-code folder.3. Offline/Online Installer
This step requires some reading and fine tuning. Qt comes with an IFW (Installer Framework) where you can create online and offline installers. The installer will contain a .7z
file of your executable and all dependencies. The installer is more comfortable for the user. It can create shortcuts, check available disk space, etc.
IIRC you need build the installer statically for MSVC or you have to ship the runtime libraries. If build with MingW you probably will not need any runtime libraries.
It is up to you which method you choose. If you own the commerical license you can ship all your closed source as static builds, but in general it's better to ship it as a dynamic build especially if you use OpenSSL where users can quickly exchange vulnerable libraries themself if required.
Upvotes: 8
Reputation: 1
As far as I know, I need to deploy Shared Libraries.
Probably not. First, notice that you don't release for Linux (in general), but for a particular Linux distribution. Details matter and are different on Ubuntu 15, Ubuntu 16, Debian 9, Fedora ... etc.
(I guess it could be the same on Windows: the version of Windows could matter, so Windows 7 not the same as Windows 10)
You should prefer to use the installed Qt on the target Linux distribution (its minor version would be different from one distro to another).
You probably want to make a software package, for the package manager of your target Linux distribution. On Debian or Ubuntu, that would be some .deb
package.
(you can't be sure that your .deb
for Ubuntu would work for Debian, but that is usually the case)
A package manager handles dependencies. So if your user would install a correct .deb
provided by you, the package manager would either fail or (more often) download and install all the required dependencies (e.g. Qt).
(Or you could distribute the source code - perhaps as free software -, and leave the task of compiling it to your users or to distribution makers)
How to make a Linux package is well documented by the particular distribution you are targetting, and is a different question. For Debian see here.
Upvotes: 0