2019-01-23

QT Add a new Kit


Create a new compiler with the binaries

This is the easy part.
ABI is not functional, is just used to sign the compiler and for QT to detect inconsistencies.




Here is where things get hard
QMAKE create a makefile. It uses .pro and a configuration file stored in the mkspec folder of the QT kit to configure everything. You need QMAKE.CONF and QPLATFORMDEFS.H configured properly for everything to works and for the makefile to be done the right way.


QT needs to be built USING the kit compiler in order to generate all the QT dll.
Those .dll are required for the binary to work and have to be bundled with the application.
STATIC:
Creating a static application with QT is a nightmare. In order to do it you need static libs, not dinamic link libraries, and to do so you need to recompile QT the right way with the right compiler to generate them.
After that you need to configure the kit to make a static compilation.









TOOLCHAIN

“Shadow built” is used to output in a folder different from the source project
“qmake” is the command line that is effectively being executed to create the makefile
“make” is used to call the compiler with all dependencies and generate the binaries
“Build environment” is used to add the paths required to build, like the compiler include and lib folders, the compiler binaries, etc...
The hardest thing to do is to configure QMAKE to generate the makefile the right way with all dependencies.

KITS

This is the final thing that ties all together
“File System Name” is useless
“Sysroot” is used to specify the system libraries. Works without but results in the binary duplicating some dependency/library.
“Compiler” is the one specified in the compiler slide
“QT Version” specifies the binaries and QT dll to use. If you target arm you need the QT dll compiled for arm to bundle with the binary for it to work
Qt mkspec is where the configuration file used by qmake to generate the makefile lay

DEPLOY

To deploy an application so that it can be executed without the QT toolchain you need to bundle in all the .dll dependencies.
The easiest way to do so is to execute and bring in the .dll that causes trouble.
Take care to bundle the right .dll. One compiled for another architecture, or with the right architecture but the wrong compiler won't work. You can find the .dll of QT here:
Each kit in the /bin folder has all the .dll compiled with the kit. You need to bundle them with the executable of your project or setup a system variable to tell where to find them.

No comments: