[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

qbs building (with qt)



qbs is yat-another build system. From the QT people. Allegedly it is
quite sensible (according to someone familiar with Make, qmake, and
cmake). I am trying to package something that uses it.

Is anyone familiar with this in debian-world? Especially with respect
to selected qt4 or qt5?

Some docs are here: 
http://doc.qt.io/qbs/configuring.html
with some info on selecting qt versions here:
http://doc.qt.io/qbs/qt-versions.html

A typical build seems to look something like this:
qbs-setup-toolchains --detect
qbs-setup-qt /usr/bin/qmake default
qbs build -f <project>.qbs profile:default

except you actually need to add 
qbs config profiles.default.baseProfile gcc
(if both gcc and clang are installed, because the toolchain --detect stage finds both.)

The problem with this is that it detects qt4, and thus fails to build a qt5 project.

using the alternative 
qbs-setup-qt --detect
also chooses qt4 if it is installed. (i.e generates a profile called 'qt-4-8-7')

qbs expects you to be able to point at a different binary path for
qmake(qt4 version) and qmake (qt5 version).

But in debian qmake seems to be a wrapper from the qtchooser
package. I can't see a way to say 'default to qt5 for anything that
asks'. I've not yet followed all the details of how qbs-setup-qt does
its selection, and maybe there is some debian rune for default-setting
that I have missed.

Perhaps what is actually needed is for the debian packaging of qbs to
work together with qtchooser to DTRT?

It doesn't seem to be possible to install just qt5, as installing it
pulls in qt4. And having both installed is quite likely to be needed
in various circumstances, so we need to make it possible to get qbs to
use the right one.

OK, doing 
QT_SELECT=5 qbs-setup-qt /usr/bin/qmake default
generates a 'default' profile which points at qt5. Is the recommended 
way to do it?

QT_SELECT=5 qbs-setup-qt --detect 
makes two profiles:
'qt-5-6-1' and 'qt-4-8-7' (not just the qt5 one for some reason)
I can then use 
qbs build -f <project>.qbs profile:qt-5-6-1
to build with the right stuff, but this is not much use for putting 
in a rules file because that profile name is going to change every 
time qt is updated. 

Also builds leave a directory called <profile>-debug in the source
directory after builds. Is there a standard way to get qbs to tidy up
after itself, or does the rules file have to do that. (rm -rf *-debug
works so long as there is nothing already called that in the
sources...)

Anyway, clues very welcome from anyone familiar with this stuff. I'll
carry on prodding in the meantime to try and grok it all.

OK. I got it to build eventually, but it may not be optimal as described above. 

My rules file looks like this. Assuming this is about right, I guess it
would be good to teach debhelper and dh_make about qbs.

%:
        dh $@

override_dh_auto_configure:
        qbs-setup-toolchains --detect
        QT_SELECT=5 qbs-setup-qt /usr/bin/qmake default
        # choose gcc as if clang is installed too you have to pick one
        qbs config profiles.default.baseProfile gcc

override_dh_auto_build:
        qbs build -f dewalls.qbs profile:default

override_dh_clean:
        # tidy up qbs profile builddirs
        qbs clean profile:default
        rm -r *-debug
        dh_clean


Wookey
-- 
Principal hats:  Linaro, Debian, Wookware, ARM
http://wookware.org/

Attachment: signature.asc
Description: Digital signature


Reply to: