QT Deployment I – C Qt Deployer Tool to Deploy Qt Applications

Installing

Should I quote a description or not? Whenever you build your project if you copy and paste your binary to another machine, it probably fails. It’s not a big surprise because of binary cannot link itself with the libraries and other dependencies that needs for to run.

C QT Deployer, is an opensource project to take our pain away. It extract all dependencies, pack it up for us. It is cross platform supports most popular architectures (x86, x86-64, ARM and ARM64 -what do you need more?)

Linux users can get it from Snap Store, but I’m strongly against this. Snap version cannot link system libraries, eventually you will need them for packaging. Latest releases are available from it’s GitHub releases page. Download offline installer. If you choose Qt Installer Framework option in installation steps, it gives opportunity to create a nice installer (like a .run file) Qt projects.

Usage of C QT Deployer

Deployment project file structure

Now, it’s installed and we’re ready to deploy our applications. At First I’m creating a QT Quick Project with CMake. Now there is a working simple project. It is time for deployment. I’m also about to create a .json file to keep my all parameters and call C QT Deployer with this file to make it manageable, I ‘ll also use this file for next chapters for automation purposes. It’s time to talk about available options and which options are taking my interest.

Options

  • clear: clears previous deployment session, sounds catch. If I do made some changes in my project then, it’s important to me a lot!
  • noCheckRPATH: I prefer this to not use automatic system path search. I like to pack everything up.
  • deploySystem: Deploys all libraries even from /usr/lib (This is why I don’t install tool from snap!)
  • extractPlugins: This flag retrieve dependencies of plugins. If client PC is not compatible with dependencies, it is a must. For every case I’m turning it on.
  • bin: path of executable binary of application (that means you have to build it first)
  • confFile: It will be used when we call the tool for .json 🙂
  • qmlDir: qml files directory (it can be multiple in an array for complex projects, tested working great!)
  • qmake: path for qmake (it’s an obligation)
  • libDir: If you are using 3rd party libraries you can give this path to deploy
  • targetDir: it’s optional to me you just name of your target directory.
  • qif: Uses Qt’s Installer Framework to make an installer

This options are primitive and essential options to me to use the tool. Let’s prepare one deployment.json file to make a run package.

{
    "clear": true,
    "deploySystem": true,
    "extractPlugins": true,
    "noCheckRPATH": true,
    "qif": true,
    "bin": "../build-DeploymentProject-Desktop_Qt_5_15_0_GCC_64bit-Debug/DeploymentProject",
    "qmlDir": ".",
    "qmake": "/home/muhammet/Qt/5.15.0/gcc_64/bin/qmake",
    "targetDir" : "../DeploymentPackage"
}

Deployment

So It’s time to call C QT Deployer from terminal to deploy our package. Time to type “cqtdeployer -confFile deployment.json” as an output it’ll generate a .run file. Installation of run file it can be called from Launchpad by typing project’s name. It is possible to rename and give it an icon with options, but I wanted to keep it simple for now.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *