Skip to content

Instantly share code, notes, and snippets.

@EndrII
Last active January 6, 2023 17:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EndrII/a96ff2b4d293133067ac2a1f5dad5fe8 to your computer and use it in GitHub Desktop.
Save EndrII/a96ff2b4d293133067ac2a1f5dad5fe8 to your computer and use it in GitHub Desktop.
How to deploy C++/Qt Application

How to deploy C++ Application

Hi my name is Yankovich Andrei and i an maintainer of the CQtDeployer tool.

In this article i describe deploy processes of c++/qt application with cqtdeployer.

Recommendation

If you want maximum stability of your distribution and you want to run your application on different Distributions with a different versions then you need to use Qt from official build.

Case

In this case we deploy Qt GUI Application for Ubuntu 16.04,Ubuntu 18.04 and Ubuntu 20.04 ++.

If you want support all distributions begin from Ubuntu 16.04 you need build and deploy you application on the older distribution (in my case it is 16.04)

Install CQtDeployer

If you want use system qt from your OS then install classic version of the cqtdeployer.

Note

Starting from v1.6 snap version of cqtdeployer also can deploy system qt libs

wget https://github.com/QuasarApp/CQtDeployer/releases/download/v1.6.2277/CQtDeployer_1.6.2277.ecc6eed_Linux_x86_64.run
chmod +x CQtDeployer_1.6.2277.ecc6eed_Linux_x86_64.run
./CQtDeployer_1.6.2277.ecc6eed_Linux_x86_64.run

image

Select latest stable version (1.6)

image

Done.

If You use official qt build then you can use snap version of the cqtdeployer.

sudo snap install cqtdeployer

After install add requirement permissions.

sudo snap connect cqtdeployer:process-control
sudo snap connect cqtdeployer:removable-media
sudo snap connect cqtdeployer:system-backup

Done!!!

Deploy Qt GUI Application

  1. Deploy yor executable file.
cqtdeployer -bin myexecutable

Extra options

If you use extra libraries, just add path for cqtdeployer to used libs.

cqtdeployer -bin myexecutable -libDir /PathToMyExtraLibs 

If you want find libraries recursively from libDir path, just add recursive Depth option.

cqtdeployer -bin myexecutable -libDir /PathToMyExtraLibs -recursiveDepth 5

If you application use qml, just add qmlDir option

cqtdeployer -bin myexecutable -libDir /PathToMyExtraLibs -recursiveDepth 5 -qmlDir /path/to/my/qml/sources

If you want create simple installer for your application just add gif option.

cqtdeployer -bin myexecutable -libDir /PathToMyExtraLibs -recursiveDepth 5 -qmlDir /path/to/my/qml/sources qif

If cqtdeployer not found qmake then add the -qmake option to an invoke command.

cqtdeployer -bin myexecutable -libDir /PathToMyExtraLibs -recursiveDepth 5 -qmlDir /path/to/my/qml/sources qif -qmake /path/to/my/qmake

@robosina
Copy link

robosina commented Jan 6, 2023

Greetings, thanks for the tool. I was wondering how we should proceed if we have multiple QML directories.

@EndrII
Copy link
Author

EndrII commented Jan 6, 2023

Hi, thank you.
You can add your all qml source dirs into qmlDir option

-qmlDir /path/to/my/qml/sources1,/path/to/my/qml/sources2,/path/to/my/qml/sources3

Or only one of your root qmlDir.

-qmlDir /path/to/my/qml/

@robosina
Copy link

robosina commented Jan 6, 2023

Thanks @EndrII

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment