gtk3 include handling - Improving IDE support
m.weghorn at posteo.de
Sat Dec 15 21:42:18 UTC 2018
one issue with the existing Qt Creator integration for LibreOffice,
provided by the 'qtcreator-ide-integration' make target, is that gtk3
includes cannot be found in Qt Creator (leading to incorrect
code-completion, error detection, ...).
As far as I understand, the following is basically what happens (with
steps 1 and 2 being part of the "normal" build process, steps 3 and 4
specific to building the IDE integration):
1) 'configure.ac': the gtk3-related compiler flags are determined using
'PKG_CHECK_MODULES' and exported as 'GTK3_CFLAGS'.
2) 'vcl/Library_vclplug_gtk3.mk': 'gb_Library_add_cxxflags' is called to
set the flags, using the 'GTK3_CFLAGS' variable set in step 1
3) 'gbuildtojson' writes the JSON file
'workdir/GbuildToJson/Library/libvclplug_gtk3lo.so', based on the
information set among others in step 2
4) 'bin/gbuild-to-ide' reads that JSON file and generates IDE-specific
config files (e.g. '.pro' files in the case of Qt Creator)
Looking at the JSON file generated in step 3, one can see that the
'-isystem' compiler flags end up in the 'CXXFLAGS' section, while only
the 'INCLUDE' section is taken into account for includes when generating
the '.pro' file for Qt Creator in step 4, thus eventually causing the
problem that included files are not found by Qt Creator.
2 potential approaches to improve this came to my mind:
1) make sure the include-related compiler flags actually end up in the
'INCLUDE' section in the generated JSON file
As far as I can see, 'gb_Library_set_include' is the way to set the
'-I'/'-isystem' compiler flags in gbuild, and that approach is used for
pretty much all other libraries.
https://gerrit.libreoffice.org/#/c/65207 demonstrates this approach.
2) adapt gbuild-to-ide to detect include-related compiler flags even if
set via 'gb_Library_add_cxxflags'
https://gerrit.libreoffice.org/#/c/65206 demonstrates a way to do this
for Qt Creator.
To me, approach 1 seems cleaner, but since I'm far from being a gbuild
expert, I'm unable to assess all the implications and would be very
thankful for any opinions on this, either here or in the corresponding
PS: Another approach might be to have the IDE use *all* compiler flags,
but at least for qtcreator, that would at least require splitting up the
project into more '.pro' files (one per library/executable, if not even
further). Currently, one '.pro' file is generated per top-level directory.
PPS: While I just encountered this for 'vclplug_gtk3' so far, the same
might be the case for other targets.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 833 bytes
Desc: OpenPGP digital signature
More information about the LibreOffice