How would I go about automating compiling a project multiple times with different options? Preferably with QMake?
For example, compiling a "trial" version that literally excludes the pro features in the binary.
Now the toolchain is setup to output code archive, portable-zip and installer. Ideally I want the same again, but to a different name with other defines active.
This is on windows.
Related
I am trying to setup a CMake project which consists of multiple static libraries and one main executable which has dependencies on QT. I would like to be able to select either a MinGW or a MSVC build when I run the cmake build.
I recently learned that the QT specific parts of CMake will find the installed library binaries for QT automatically if QTDIR is set as an environment variable and if QTDIR/bin is in the PATH.
Now I am wondering how I can set this information dynamically depending on the compiler that I am using. Since I would need to point cmake to either one of C:\Qt\5.3\mingw482_32 or C:\Qt\5.3\msvc2013_64, or possibly others if I extend the list of targets in the future.
Note that I do not need to build both compiler targets at the same time, I would usually select on target in my IDE and build that one, but I would like to be able to switch between both targets.
The solution should be in such a way, that on Linux the CMake build will still find the libraries which are installed through the package manager automatically.
Can I easily achieve this with CMake?
As a side note, in the future I might also need to select the QT version on demand? So an extensible solution would be nice.
I am writing a markdown editor in Qt. I have an OS X laptop, a Windows laptop, and a Linux desktop and I would like for the application to work on all three. This means custom dependencies must be compiled at build time, and I don't know how to do this.
I am using the Discount markdown engine to process the markdown to HTML and highlight.js for syntax highlighting in <code> blocks. Obviously the JavaScript will not be a problem but Discount might be. Discount will compile in all three of my target operating systems, but I don't know how to include the library without compiling it.
The Include Internal Library Window Looks Like this
But the "Library" field will not accept anything other than a compiled library or a project directory based on QMake .pro files. Because Discount uses GNU Autotools and not QMake, this poses a difficulty for me - especially because I am not very familiar with either M4 syntax or QMake syntax. What should I do?
Having some issues with the online installers, I would like to use the offline installers to create an installation with multiple Kits and versions. I would like to be able to switch between MinGW, Visual Studio and mobile targets just by switching between the Kits, and I would like to have the latest two Qt versions (5.4 and 5.5) available for choosing.
However, there are some issues with this:
The offline installers are only available with a single Kit. Installing the same version twice with different Kits to the same directory seems to mix up Qt Creator's available Kits, and the installation seems to replace the previous one in Windows' list of installed software.
Every single setup comes with its own Qt creator instance, and only there the Kits are available as desired. So when installing in seperate directories, a lot of duplicate stuff is installed.
I tried copying together kits from a few installations, but running a big installation, copying part of it and then patching the kit with the installer again seems to be a bit weird ...
Isn't there an easier way to get a consistent installation on Windows with the offline installers?
First of all, I believe this issue is not as big as I thought: Even the multiple Qt Creator installations that come with every offline installer do not create any bigger conflicts. The only thing that might happen with these: When starting different versions of Creator after each other, one might see conflicts with the settings files of QtCreator which are always stored in %APPDATA%/QtProject: Using an older version can corrupt the newer one.
That said, I believe the simplest way to work with different Qt Versions is to use a new installation folder for every Qt version, and to use a separate installation of QtCreator. Then one of course has to set up debuggers, Qt Versions and Kits manually for each new installation. The benefit of this is that one can also simply remove any version one doesn't need anymore - without risking to remove the used Qt Creator.
Qt creator automatically seems to detect and select appropriate help files + examples from the installed Qt versions.
Compared to using the online installer, the installation needs more space for the multiple Qt Creators, however installations are really separate from each other, so there is no risk in messing up anything by using the online installers again when a new version comes: the online installer only gives the latest two major versions with their latest minor version, and when changing from one minor version to another, one might want to compare results between these.
I am looking for a way to create a minimal static build of Qt 5.1. By minimal, I mean a build with only the basic set of widget classes available (including 2D graphics acceleration through an OpenGL canvas/widget). I am aiming for a static build on Windows 7 32-bit using MinGW-builds GCC 4.8.1 as well as their bundle of MSYS and tools.
I have downloaded the entire source tree, and have met some problems with compiling due to the dependency of packages such as OpenSSL and ICU (the latest OpenSSL did not compile). I wanted to see, if I could avoid dependencies of these packages and, at the same time, achieve a minimal static build of Qt 5.1 so my final executable is not gigantic in size.
I took a look at this list:
http://download.qt-project.org/official_releases/qt/5.1/5.1.0/submodules/.
Q1: Which of these modules, do I need to select to have a basic Qt build without all the fancy stuff?
Q2: Are these modules interdependent on each other in some way (I assume they are all dependent on "qtbase")?
Q3: Do I use the names from that list, (for example: "qtxmlpatterns", "qtx11extras", "qtwebkit", etc.), to deselect them in the configuration of my Qt build?
It would also be nice, with an explanation of the various submodules of Qt 5? If someone could point to any links or docs with illuminating words on this subject, that would also be great.
I shared this same goal. I wanted to "minify" Qt, building only a small subset of the libraries/DLL(s) and omitting the rest.
I did succeed, at least on Mac OS X. I assume that this approach will work on other platforms, too.
I thought that the trick would be to find some kind of exclusion flags for the "configure" script, but that turned out not to be the case.
Here is what I did:
Download the source distribution (in my case, qt-everywhere-opensource-src-5.1.1). of course, extract it all.
Edit the following three "pro" files. these files are in a qt-specific format (but plain text). They are platform-independent project files that Qt (via qmake) uses to generate makefiles.
qtbase/src/src.pro
qtbase/src/plugins/plugins.pro
qtbase/examples/examples.pro
All the changes that I made to the "pro" files were deletions. I deleted references to: dbus, ipc, network, qtconcurrent, sql, xml, sqldrivers, qdbusxml2cpp, qdbuscpp2xml, src_dbus, src_concurrent, src_sql, src_network.
That last part may sound scary. It really wasn't.
The pro files contain a list of module names, plugin names, and directory names. It seemed fairly straightforward how to delete (for example) all SQL-related lines.
Step 3.
The usual configure/make/install. However, note the "module-qtbase" argument passed to make:
./configure -prefix ~/my_test_dir/
make -j2 module-qtbase
make -j2 module-qtbase-install_subtargets
Success. This built and installed only the essentials (QtCore, QtGui, QtOpenGL, QtWidgets) and skipped all the supporting dylibs like QtConcurrent, QtMultimedia, QtSql, and QtWebKit.
ICU can link statically, and you can customize it (see docs) to reduce size. By default the data is also large, I don't know how much data you need. You could include only enough data to run in one language.
Only part of an answer.
There's no need to disable Qt modules. Each application that uses Qt decides what modules it uses and links with. A basic console-only application may use the core module only. That's what you'd use when creating, say, a web service in Qt.
I have a simple question - what is Shadow Building? I've seen it in Qt in Target Setup dialog, but don't know what it does or if I should use it.
It's also present in Projects tab, under General group.
Shadow building is a technique used to build different Qt builds of the same version for different platforms/compilers/etc. Your compiled build is in a different directory, separate from the original Qt source directory.
I've created a shadow build for my MSVS2010 compiler. If I wanted to, I could create a new build for MinGW in a different build directory.
See the definition here, and more information about configuring your build here.
Additional information for Mateen's answer.
By default, Qt Creator builds projects in a separate directory from the source directory, as shadow builds. This keeps the files generated for each build and run kit separate. If you only build and run with a single kit, you can deselect the Shadow build checkbox.
https://doc.qt.io/qtcreator/creator-build-settings.html#qmake-build-configuration