[Interest] how to manage app "editions" with dependencies?

Markus Haberlander markus.haberlander.sw at gmail.com
Wed Jun 3 09:34:42 CEST 2020


I had similar issues when I once tried to set up dependencies via Qt
Creator. I believe that using project configurations in Qt creator is just
not the right approach for your use case.

One way to solve the 32/64 bit dependency would be to change the build
output to a location that depends on debug/release, on 32/64 bits and
possibly on the compiler type, and to just include the library from that
fixed location based on the same lookup rules in the other project. I did
that for a while, but e.g. trying out new Qt versions with such a project
structure gets a mess quickly in my opinion. Another possibility (the one I
am using since) would be to use a toplevel subdirs project with the library
and your application inside: That way you can select the kit and
debug/release together for both the library and the applications. This
approach is also heavily used inside Qt's sources. The downside is that one
actually has to compile the library more often, On the other hand, you can
exclude the library in the case that you mentioned that does not need the

The different editions of your project are also something where I would not
use the project configurations in QtC. I would actually first question if
you really need to setup different builds for each or if you can change the
behaviour using e.g. feature flags, license keys or whatever: Working with
the same builds for all use cases drastically reduces maintenace effort in
my opinion. That said, I have one case where I did not manage this and
really needed a seperate build. For this one, I create a symlink to my
toplevel .pro file in the same directory but with a different name, and for
the symlinked version I set a qmake flag in the build configuration. Using
a symlink here has some drawbacks, it's sometimes an issue to get that
under version control and changing two files at once when editing one file
might be unexpected at the beginning.

Hope this helps

Am Di., 2. Juni 2020 um 18:42 Uhr schrieb David M. Cotter <dave at kjams.com>:

> my app ("kJams") has multiple "editions".  consumer, pro, and superpro,
> named "Lite", "Pro", and "2", respectively.  (i know the names are dumb,
> please let's not talk about that part)
> each edition has debug and release configs.  and each config can be 32 or
> 64bit.
> that's 12 unique configs.
> but then they also have a dependency on a library created separately.
>  that lib (called "CFLite", unrelated to the "Lite" edition of the app
> above) comes in debug and release, and 32 and 64bit editions.
> so my app configs look like this:
> my library configs:
> and the dependency for the app looks like this:
> the problem as you can imagine is that if i've recently selected to build
> the 32bit "CFLite" but then switch to my app and select the 64bit version,
> when i go to build, there's no awareness of WHICH EDITION of the library to
> build.
> to wit:
> 09:33:54: Running steps for project CFLite_win...
> 09:33:54: Starting:
> "C:\Users\davec\Developer\Qt\5.15.0\msvc2019\bin\qmake.exe"
> Z:\CF\opencflite-476.17.2\Qt\CFLite\CFLite_win.pro -spec win32-msvc
> "CONFIG+=debug" "TARGET=\"CFLite Debug\""
> Project MESSAGE: ------------------------------
> Project MESSAGE: Windows
> Project MESSAGE: build_type: debug
> Project MESSAGE: target: CFLite Debug (32bit)
> 09:33:58: The process
> "C:\Users\davec\Developer\Qt\5.15.0\msvc2019\bin\qmake.exe" exited normally.
> 09:33:58: Starting:
> "C:\Users\davec\Developer\Qt\Tools\QtCreator\bin\jom.exe" -f
> "Z:/CF/opencflite-476.17.2/Qt/win_32-CFLite Debug/Makefile" qmake_all
> jom 1.1.3 - empower your cores
> 09:33:58: The process
> "C:\Users\davec\Developer\Qt\Tools\QtCreator\bin\jom.exe" exited normally.
> 09:33:58: Starting:
> "C:\Users\davec\Developer\Qt\Tools\QtCreator\bin\jom.exe"
> 09:33:58: The process
> "C:\Users\davec\Developer\Qt\Tools\QtCreator\bin\jom.exe" exited normally.
> 09:33:58: Running steps for project kJams_win...
> 09:33:58: Starting: "C:\Windows\system32\cmd.exe" /c python
> pre_build_kjams_qt.py 64 kJams 2 Debug
> deleting: kJams 2 Debug
> 09:33:59: The process "C:\Windows\system32\cmd.exe" exited normally.
> 09:33:59: Starting:
> "C:\Users\davec\Developer\Qt\5.15.0\msvc2019_64\bin\qmake.exe"
> Z:\kJams\Development\qt\kJams\kJams_win.pro -spec win32-msvc
> "CONFIG+=debug" "TARGET=\"kJams 2 Debug\"" DEFINES+=kDEBUG
> Project MESSAGE: ------------------------------
> Project MESSAGE: build_type: debug
> Project MESSAGE: kJams 2 Debug 64bit
> note above when i went to build "kJams 2" "debug" "64bit" that the
> DEPENDENCY decided to build the 32bit version of the library.
> i filed this bug here:
> https://bugreports.qt.io/browse/QTCREATORBUG-22619?filter=-2
> but they told me "this is too hard.  just change the names of your configs"
> but if you've been paying attention, you know that i CAN'T change the
> config names, because they are critical to getting the results that i need
> (they build very different versions of the app) (lots of build options are
> dependent on the build config name)
> so my Q is:
> what's the point of allowing unlimited number of custom build
> configuration, and also allowing dependencies, if the only ones actually
> supported are ones where have perfectly synced names?
> how can i possibly accomplish what i want?
> -dave
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> https://lists.qt-project.org/listinfo/interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20200603/bbc96034/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: app.png
Type: image/png
Size: 24209 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20200603/bbc96034/attachment-0003.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cflite library.png
Type: image/png
Size: 13227 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20200603/bbc96034/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2019-06-25 at 7.46.44 PM.png
Type: image/png
Size: 15907 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20200603/bbc96034/attachment-0005.png>

More information about the Interest mailing list