How to build a selection of Qt5 submodules from source? - qt

The Qt download page (http://download.qt.io/official_releases/qt/5.12/5.12.2/) offers multiple source archives that can be used to build Qt5 from source. One contains all sources, which I managed to build successfully, but it takes rather long and contains a lot of stuff that I do not use.
They also offer submodule source packages that can be used to only build a subset of what Qt offers. Howerver I could not find a manual on how to properly build these. I need the QtBase and the QtXmlPatterns packages. I manged to build the QtBase package on its own, but I would like to know how to build multiple of the submodules.
The QtXmlPatterns package can not be build on its own, so I tried to simply copy the sources from the QtXmlPatterns submodule into the QtBase submodule. But that gives me errors when I execute the configure step.
So what is the correct procedure for combining multiple of the submodule source packages into one setup that can be build?
Thank you for your time.
Edit:
Not sure if it is relevant, but I am building Qt5.12.2 on Windows with Visual Studio 2019.

The build flow is a bit different from building the full source package.
configure and build qtbase stand-alone as you have already done it. Use a PREFIX so that you can call make install and install the build results to some location in your file system.
you may want to add the resulting bin folder to your PATH environment variable
extract the other submodule you want to build into a separate folder
run qmake, make and make install on your submodule as if it was a "normal" Qt project. This will install the submodule to the PREFIX location of qtbase.

Related

Swift Package Plugin - Copy Build Artifact

Is it possible to create a build tool plugin that runs after the build and copies build artifacts to another location in the package directory?
For example, say I have an executable target named tool. Each time that I build tool, I'd like to copy the build artifact from .build/release/tool to ./tool so that it's available at the root of the package.
As far as I can tell, this can't be done. But I may be missing something.
(Crosspost: https://forums.swift.org/t/swift-package-plugin-copy-build-artifact/60765)

Source of qt5 cmake Config-file Packages

Trying to build qt5 with buildroot. I need to download the source so that everything is compiled through the cross-compiler.
One of my project relies on the 'Config-file Packages' (CMake helper config file) provided by Qt5 in the binary tarball at this location Qt5.8.0/5.8/gcc_64/lib/cmake.
Problem: I can't find that folder anywhere in the source. When I take one example file (e.g. Qt5Config.cmake), I can't find any git repo hosting it.
Had a look at Ubuntu packages and it is being distributed in qtbase5-dev. When I look at this package documentation, it says it is using qtbase-opensource-src 5.5.1+dfsg-16ubuntu7.4 as the source package. Had a look at the source package for 5.8 but the cmake files are not there.
I could upload those files in an ad-hoc git repo, but that just seems weird that those files are not hosted by the qt repo.
What am I missing?
The cmake files are generated while build. On Linux the results are installed to qt/lib/cmake.

How to force qtcreator use qbs profile?

I'm working with qtcreator 3.5.0 and custom build of QT 5.5.0
I want to build my project both with qbs & qtcreator.
So, I've created qbs profile, as described in qbs manual, and it works well. But I've failed to force qtcreator use this profile. It creates it's own profile, based on mine, but with different name.
e.g. `qtc_Desktop-debug` & `qtc_Desktop_0aa29aa9-debug`
The problem is that build paths includes profile names. And even if I have completed build by qbs, I need to build all the sources again from qtcreator, if I want to use it.
To copy exactly build done by QtCreator just copy command displayed in project configuration details (to make thinks easier you probably want to wrap it in script file):
BTW: QtCreator's QBS profiles are direct copies of your build Kits configuration (set in Tools > Options > Build & Run > Kits) so if you need to tune it you should do it there.

Using Qt Installer Framework to create my Application Installer

I want to create an installer for my Application. So, I have read about Qt Installer Framework and I tested the tutorial example and create the installer and everything work find with the example. But I have a doubt when I try to do the same process for my Application. When I compile the code a folder is created at the same level of my code:
MyApplication (my code)
build-MyApplication-Desktop_Qt_5_4_1_MinGW_32bit-Release (code compiled)
So my questions are:
What files of the compilation do I need to copy into the folder myinstaller/packages/vendor/ recommended by Qt Intaller Framework?
If I have dependencies of Qt like serialport, multimedia, and others, how do I insert these dependecies with Qt Installer Framework?
windeployqt.exe is what you want. Just run that on the command line and give it your executable as the argument. It will automatically copy in all the required Qt libraries and even provide the runtime redistributable installer. Then you can use the binarycreator to generate an installer.
You can put all the dependencies in myinstaller/packages/vendor/data, along with your exe. and eventual additional files. I recommended using i.e. dependency walker for finding all the required dependencies. Some of the binarycreator tutorials on qt are outdated; make sure you use the command
<location-of-ifw>\binarycreator.exe -t <location-of-ifw>\installerbase.exe -p <package_directory> -c <config_directory>\<config_file> <installer_name>
with the appropriate arguments.

Qt when building Qt from source how do I clean old configure configurations?

I'm compiling Qt from source, but I don't want to extract the source each time I want to build it.
How can I clean previous configuration with the configure tool?
For Qt4 and earlier, try this:
nmake confclean
You can then re-configure and re-compile QT.
As noted in the comments, this no longer works in QT 5. This is due to the fact that the Qt project now uses separate sub-modules for different parts. If you have a local clone of the Qt git repos, you can try calling this from the main Qt directory:
git submodule foreach --recursive "git clean -dfx"
As noted here, there may be some problems if you have a downloaded source archive. The link I posted suggests using a shadow build instead so the process of making a clean configuration is as simple as configuring to build at a new shadow build destination.
As of today (Qt 5.9.0 beta2) there is no confclean target in Linux, and you need to manually remove .config.cache file to reconfigure.
Note that make distclean doesn't help at all.
For the latest versions, use a shadow build, then you can just nuke your directory. My batch file for configuring effectively creates a new folder, moves into it, then calls configure.
Then you just go into the shadow directory and run 'jom'.
When you want to make a different configuration, just use a different shadow directory.
This effectively means that your source tree doesn't get filled with build artifacts, which are impossible to remove when you want a different configuration. Trust me, this is the thing to do....
mkdir shadow_dir
cd shadow_dir
%~dp0\src\configure.bat ....
On Ubuntu:
make confclean
BTW, the following text displayed after run configure:
Qt is now configured for building. Just run 'make'.
Once everything is built, you must run 'make install'.
Qt will be installed into /home/ben/qt/qt-everywhere-opensource-4.7.4-debug
To reconfigure, run 'make confclean' and 'configure'.

Resources