DevHeads.net

Getting the real include directories for frameworks?

I've got a problem porting calligra to kf5 that I don't know how to solve.

We use a 3rd party library called Vc, which does vectorization for us. It
takes a certain object file and builds it for different processor
architecturres. In order to do that, it generates a new gcc line for every
architecture, using the value of INCLUDE_DIRECTORIES, like this:

get_directory_property(_inc INCLUDE_DIRECTORIES)
foreach(_i ${_inc})
list(APPEND _flags "-I${_i}")
endforeach()

With kf5, the value of ${Kf5_INCLUDES} is set to

$<TARGET_PROPERTY:KF5::KDELibs4Support,INTERFACE_INCLUDE_DIRECTORIES>

And that means, of course, that the final build command looks like:

cd /home/boud/kde/build/calligra/libs/pigment && /usr/bin/c++ -std=c++0x
-fno-exceptions -Wall -Wextra -Wcast-align -Wchar-subscripts
-Wformat-security -Wno-long-long -Wpointer-arith -Wundef
-Wnon-virtual-dtor -Woverloaded-virtual -Werror=return-type -Wabi
-fabi-version=0 -ffp-contract=fast -mtune=core-avx-i -fPIC
-I/home/boud/kde/src/calligra/interfaces -I/home/boud/kde/build/calligra
-I/home/boud/kde/src/calligra -I/home/boud/kde/src/calligra/libs/version
-I/home/boud/kde/build/calligra/libs/version
"-I/usr/include/KF5/KDELibs4Support;/usr/include/KF5/KDELibs4Support/KDE;/usr/include/KF5;/usr/include/qt5/;/usr/include/qt5/QtWidgets;/usr/include/qt5/;/usr/include/qt5/QtGui;/usr/include/qt5/;/usr/include/qt5/QtCore;/usr/lib64/qt5//mkspecs/linux-g++;/usr/include/qt5/;/usr/include/qt5/QtDBus;/usr/include/qt5/;/usr/include/qt5/QtPrintSupport;/usr/include/KF5/KCoreAddons;/usr/include/KF5;/usr/include/KF5/KCrash;/usr/include/KF5;/usr/include/KF5/KWidgetsAddons;/usr/include/KF5;/usr/include/KF5/KConfigCore;/usr/include/KF5;/usr/include/KF5/KConfigWidgets;/usr/include/KF5;/usr/include/KF5/KCodecs;/usr/include/KF5;/usr/include/KF5/KConfigGui;/usr/include/KF5;/usr/include/qt5/;/usr/include/qt5/QtXml;/usr/include/KF5/KAuth;/usr/include/KF5;/usr/include/KF5/KIOCore;/usr/include/KF5;/usr/include/KF5/KService;/usr/include/KF5;/usr/include/KF5/KIOFileWidgets;/usr/include/KF5;/usr/include/KF5/KIOWidgets;/usr/include/KF5;/usr/include/KF5/KJobWidgets;/usr/include/KF5;/usr/include/qt5/;/usr
/include/qt5/QtNetwork;/usr/include/KF5/KCompletion;/usr/include/KF5;/usr/include/KF5/KBookmarks;/usr/include/KF5;/usr/include/KF5/KItemViews;/usr/include/KF5;/usr/include/KF5/KXmlGui;/usr/include/KF5;/usr/include/KF5/Solid;/usr/include/KF5;/usr/include/KF5/KI18n;/usr/include/KF5;/usr/include/KF5/KNotifications;/usr/include/KF5;/usr/include/KF5/KIconThemes;/usr/include/KF5;/usr/include/KF5/KWindowSystem;/usr/include;/usr/include;/usr/include/KF5;/usr/include/KF5;/usr/include/KF5/KGuiAddons;/usr/include/KF5;/usr/include/KF5/KUnitConversion;/usr/include/KF5;/usr/include/KF5/KTextWidgets;/usr/include/KF5;/usr/include/KF5/SonnetUi;/usr/include/KF5;/usr/include/KF5/KParts;/usr/include/KF5"
-I/usr/include/qt5 -I/usr/include/qt5/QtCore
-I/usr/lib64/qt5/mkspecs/linux-g++ -I/usr/include/qt5
-I/usr/include/qt5/QtGui -I/usr/include/qt5/QtCore
-I/usr/lib64/qt5/mkspecs/linux-g++ -I/usr/include/qt5
-I/usr/include/qt5/QtXml -I/usr/include/qt5/QtCore
-I/usr/lib64/qt5/mkspecs/linux-g++
-I/home/boud/kde/src/calligra/libs/koplugin
-I/home/boud/kde/src/calligra/libs/version
-I/home/boud/kde/build/calligra/libs/version
-I/home/boud/kde/src/calligra/libs/pigment
-I/home/boud/kde/src/calligra/libs/pigment/compositeops
-I/home/boud/kde/src/calligra/libs/pigment/resources -I/usr/include
-I/usr/include -I/usr/include/OpenEXR -I/usr/local/include -mavx
-DVC_IMPL=AVX -c -oKoOptimizedCompositeOpFactoryPerArch_AVX.cpp.o
/home/boud/kde/src/calligra/libs/pigment/compositeops/KoOptimizedCompositeOpFactoryPerArch.cpp

And that doesn't work:

/home/boud/kde/src/calligra/libs/pigment/pigment_export.h:24:23: fatal
error: kdemacros.h: No such file or directory
#include <kdemacros.h>
^
compilation terminated.

I guess that the line

"-I/usr/include/KF5/KDELibs4Support;/usr/include/KF5/KDELibs4Support/KDE;/..."

Must somehow bew broken up into proper -I/usr/include/KF5/KDELibs4Support
-I/usr/include/KF5/KDELibs4Support/KDE -- the question is, how do I do
that? How do I expand this list, parse it and add the contents of this
string to include_directories?

Boudewijn

Comments

Re: Getting the real include directories for frameworks?

By Alexander Richardson at 04/03/2015 - 05:50

2015-04-03 10:08 GMT+02:00 Boudewijn Rempt < ... at valdyas dot org>:
I haven't tested this, but according to the CMake documentation
(<a href="http://www.cmake.org/cmake/help/v3.2/manual/cmake-generator-expressions.7.html" title="http://www.cmake.org/cmake/help/v3.2/manual/cmake-generator-expressions.7.html">http://www.cmake.org/cmake/help/v3.2/manual/cmake-generator-expressions....</a>)
this strange construction will probably work:

list(APPEND _flags "$<$<BOOL:${_i}>:-I$<JOIN:${_i}, -I>>")

Alex

Re: Getting the real include directories for frameworks?

By Boudewijn Rempt at 04/03/2015 - 05:57

I'll give that a try -- since Vc is a 3rd party library I'll have to do
that in our own code, of course.

Boudewijn

Re: Getting the real include directories for frameworks?

By Boudewijn Rempt at 04/03/2015 - 07:22

Weird, I must be doing something wrong because even if I use that in the
vc macro (which I shouldn't of course), it doesn't seem to make any
difference. And even after reading the documentation page, I'm completely
unsure about _why_ we'd need such expressions here.

Boudewijn