[Development] Getting defines from pkg-config for Qt modules

Jeandet Alexis alexis.jeandet at member.fsf.org
Thu Oct 26 22:12:28 CEST 2017


Hello Konstantin,

Thank you for your answer.

I've never used waf, I might have a closer look into it.
After a quick check, it seems that by default it uses also pkg-config,
build/config.log from waf qt5 demo:

------------------------------------------
Checking for 'Qt5Scxml'
['/usr/bin/pkg-config', '--cflags', '--libs', 'Qt5Scxml']
out: -I/usr/include/qt5/QtScxml -I/usr/include/qt5
-I/usr/include/qt5/QtCore -I/usr/include/qt5/QtQml
-I/usr/include/qt5/QtNetwork -lQt5Scxml -lQt5Qml -lQt5Network
-lQt5Core 

yes
------------------------------------------

Then from its own tests:

------------------------------------------
See if Qt files compile with -fPIC
==>
#include <QApplication>
int main(int argc, char **argv) {return 0;}

<==
[1/1] Compiling
build/.conf_check_95021cb6c5c41f7db87608502781c73b/test.cpp

['/usr/lib64/ccache/g++', '-fPIC', '-I/usr/include/qt5/QtCore', '-
I/usr/include/qt5', '-I/usr/include/qt5/QtWidgets', '-
I/usr/include/qt5/QtGui', '-DHAVE_QT5X11EXTRAS=1', '-DHA
VE_QT5TEST=1', '-DHAVE_QT53DRENDER=1', '-DHAVE_QT53DEXTRAS=1', '-
DHAVE_QT5OPENGL=1', '-DHAVE_QT53DQUICKRENDER=1', '-DHAVE_QT5SQL=1', '-
DHAVE_QT5XMLPATTERNS=1', '-DHAVE_QT5WEBEN
GINECORE=1', '-DHAVE_QT5POSITIONING=1', '-
DHAVE_QT5MULTIMEDIAWIDGETS=1', '-DHAVE_QT5QML=1', '-DHAVE_QT5QUICK=1',
'-DHAVE_QT5BLUETOOTH=1', '-DHAVE_QT5CORE=1', '-DHAVE_QT5SCRIPTT
OOLS=1', '-DHAVE_QT5WEBKITWIDGETS=1', '-DHAVE_QT5DATAVISUALIZATION=1',
'-DHAVE_QT5PRINTSUPPORT=1', '-DHAVE_QT5MULTIMEDIA=1', '-
DHAVE_QT5HELP=1', '-DHAVE_QT5XML=1', '-DHAVE_QT5S
VG=1', '-DHAVE_QT5WIDGETS=1', '-DHAVE_QT5GSTREAMERQUICK_1_0=1', '-
DHAVE_QT5CONCURRENT=1', '-DHAVE_QT5LOCATION=1', '-DHAVE_QT5DBUS=1', '-
DHAVE_QT5DESIGNER=1', '-DHAVE_QT5WEBSOCK
ETS=1', '-DHAVE_QT5WEBCHANNEL=1', '-DHAVE_QT5WEBKIT=1', '-
DHAVE_QT5SERIALPORT=1', '-DHAVE_QT5GSTREAMERUI_1_0=1', '-
DHAVE_QT53DLOGIC=1', '-DHAVE_QT5NFC=1', '-DHAVE_QT5GSTREAMERU
TILS_1_0=1', '-DHAVE_QT5WEBVIEW=1', '-DHAVE_QT5NETWORK=1', '-
DHAVE_QT5WAYLANDCOMPOSITOR=1', '-DHAVE_QT5GUI=1', '-
DHAVE_QT5GLIB_2_0=1', '-DHAVE_QT5SCRIPT=1', '-DHAVE_QT5QUICKCON
TROLS2=1', '-DHAVE_QT53DCORE=1', '-DHAVE_QT5GSTREAMER_1_0=1', '-
DHAVE_QT5QUICKWIDGETS=1', '-DHAVE_QT53DQUICKEXTRAS=1', '-
DHAVE_QT5GAMEPAD=1', '-DHAVE_QT5SENSORS=1', '-DHAVE_QT5
SERIALBUS=1', '-DHAVE_QT53DINPUT=1', '-DHAVE_QT53DQUICKINPUT=1', '-
DHAVE_QT5WAYLANDCLIENT=1', '-DHAVE_QT5SCXML=1', '-
DHAVE_QT5WEBENGINEWIDGETS=1', '-DHAVE_QT5CHARTS=1', '-DHAVE
_QT5QUICKTEST=1', '-DHAVE_QT5WEBENGINE=1', '-DHAVE_QT53DQUICK=1',
'../test.cpp', '-c', '-
o/home/jeandet/Documents/prog/waf/demos/qt5/build/.conf_check_95021cb6c
5c41f7db87608502
781c73b/testbuild/test.cpp.1.o']
yes
------------------------------------------

So at least by default it seems to behave like meson(no 
-DQT_CORE_LIB). But as you pointed out pkg-config isn't available on
all systems so improving it will only solve 50% of the problem.
This lead me to the conclusion that it would be nice to get be able to
query cflags from qmake (unless I missed something ans its already
possible)


Alexis.
Le jeudi 26 octobre 2017 à 21:37 +0300, Konstantin Tokarev a écrit :
> 
> 26.10.2017, 20:20, "Jeandet Alexis" <alexis.jeandet at member.fsf.org>:
> > Hello,
> > 
> > I already asked this on IRC but I got no answer.
> > On Fedora and Ubuntu I can say that "pkg-config --cflags Qt5[any
> > module]" does only provides include flags and no defines such as
> > -DQT_CORE_LIB or -DQT_GUI_LIB.
> > 
> > As an example "pkg-config --cflags panelw" gives "-D_GNU_SOURCE
> > -D_DEFAULT_SOURCE "
> > 
> > So my questions are:
> > 1) Is this normal/expected?
> > 2) Why not providing this flags?
> 
> I think it would be correct to say that pkg-config support if a 3rd
> class citizen in Qt, after qmake and cmake
> It's not even supported on all platforms, e.g. on Windows with MSVC,
> or macOS when frameworks are built (default mode).
> 
> > 3) Does a patch to provides this flags would be accepted?
> 
> Sure, if it is implemented in a way that Ossi approves.
> 
> > 
> > This would help to improve Qt support in Meson and I guess others
> > build systems using pkgconfig.
> 
> It might be a better idea to support Qt without relying on pkg-
> config. Some 3rd party build systems do this, e.g. waf
> 
> > 
> > Best regards,
> > Alexis.
> > 
> > ,
> > 
> > _______________________________________________
> > Development mailing list
> > Development at qt-project.org
> > http://lists.qt-project.org/mailman/listinfo/development
> 
> 
> -- 
> Regards,
> Konstantin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20171026/05e04a75/attachment.html>


More information about the Development mailing list