Problem using Vc with CMake 3.0 and kf5
Boudewijn Rempt
boud at valdyas.org
Sat May 23 09:51:55 UTC 2015
Sorry for the extensive cross-posting in advance, please when replying, do
a reply-all.
Just so everyone is on the same page: Vc is a template library that makes
it easy to build vectorized code using a single source file. Krita uses Vc
to optimize blending colors, creating masks and much more. Krita uses the
most recent Vc release, 0.7.4:
http://code.compeng.uni-frankfurt.de/news/27
We're currently porting Krita to Qt5 and KF5 and the way KF5 and Vc handle
include directories is a big roadblock for us:
https://git.reviewboard.kde.org/r/123179/ .
In a nutshell: Vc builds many different object files from single cpp file.
It does this by creating a custom command for each target vectorization
extension. To do that, it needs to access the contents of
INCLUDE_DIRECTORIES, like this (in VcMacros.cmake:
http://code.compeng.uni-frankfurt.de/projects/vc/repository/entry/cmake/VcMacros.cmake?rev=0.7)
get_directory_property(_inc INCLUDE_DIRECTORIES)
foreach(_i ${_inc})
list(APPEND _flags "-I${_i}")
endforeach()
In the end the command is generated like this:
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_out}
COMMAND ${CMAKE_CXX_COMPILER} ${_flags} ${_extra_flags}
-DVC_IMPL=${_impl}
${_outfile_flag}${_out}
${CMAKE_CURRENT_SOURCE_DIR}/${_vc_compile_src}
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/${_vc_compile_src}
IMPLICIT_DEPENDS CXX
${CMAKE_CURRENT_SOURCE_DIR}/${_vc_compile_src}
COMMENT "Building CXX object ${_out}"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
VERBATIM
)
KF5 uses cmake generator expressions to derive the include
directories from the target_link_libraries lines. This means that when we
try to build our per-extensions object files we get this:
[ 0%] Building CXX object
KoOptimizedCompositeOpFactoryPerArch_AVX.cpp.o
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
-D__GNUC_UBUNTU_VERSION__=0xf040a -Wabi -fabi-version=0 -ffp-contract=fast
-mtune=core2 -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/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/include -mavx -DVC_IMPL=AVX
-c -oKoOptimizedCompositeOpFactoryPerArch_AVX.cpp.o
/home/boud/kde/src/calligra/libs/pigment/compositeops/KoOptimizedCompositeOpFactoryPerArch.cpp
/home/boud/kde/src/calligra/libs/pigment/compositeops/KoOptimizedCompositeOpFactoryPerArch.cpp:22:19:
fatal error: QString: No such file or directory
#include <QString>
^
compilation terminated.
libs/pigment/CMakeFiles/pigmentcms.dir/build.make:72: recipe for
target 'libs/pigment/KoOptimizedCompositeOpFactoryPerArch_AVX.cpp.o'
failed
On other words, INCLUDE_DIRECTORIES is empty, there's no Qt5, no Kf5 to be
found.
If we manually set include directories like this:
if (HAVE_VC)
message(".>>>>>>>>>>>>" ${KDE4_INCLUDES})
include_directories(${KDE4_INCLUDES} ${Qt5Core_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS} ${Qt5Xml_INCLUDE_DIRS} ${PIGMENT_INCLUDES} ${Boost_INCLUDE_DIR})
endif()
We end up with the entire include line for the contents of KDE4_INCLUDES
($<TARGET_PROPERTY:KF5::KDELibs4Support,INTERFACE_INCLUDE_DIRECTORIES>)
expanded to a string with quotes around it:
[ 0%] Building CXX object
KoOptimizedCompositeOpFactoryPerArch_AVX.cpp.o
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
-D__GNUC_UBUNTU_VERSION__=0xf040a -Wabi -fabi-version=0 -ffp-contract=fast
-mtune=core2 -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/x86_64-linux-gnu/qt5/;/usr/include/x86_64-linux-gnu/qt5/QtWidgets;/usr/include/x86_64-linux-gnu/qt5/;/usr/include/x86_64-linux-gnu/qt5/QtGui;/usr/include/x86_64-linux-gnu/qt5/;/usr/include/x86_64-linux-gnu/qt5/QtCore;/usr/lib/x86_64-linux-gnu/qt5//mkspecs/linux-g++-64;/usr/include/x86_64-linux-gnu/qt5/;/usr/include/x86_64-linux-gnu/qt5/QtDBus;/usr/include/x86_64-linux-gnu/qt5/;/usr/include/x86_64-linux-gnu/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/x86_64-linux-gnu/qt5/;/usr/include/x86_64-linux-gnu/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/x86_64-linux-gnu/qt5/;/usr/include/x86_64-linux-gnu/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/x86_64-linux-gnu/qt5
-I/usr/include/x86_64-linux-gnu/qt5/QtCore
-I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64
-I/usr/include/x86_64-linux-gnu/qt5
-I/usr/include/x86_64-linux-gnu/qt5/QtGui
-I/usr/include/x86_64-linux-gnu/qt5/QtCore
-I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64
-I/usr/include/x86_64-linux-gnu/qt5
-I/usr/include/x86_64-linux-gnu/qt5/QtXml
-I/usr/include/x86_64-linux-gnu/qt5/QtCore
-I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64
-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/include -mavx -DVC_IMPL=AVX
-c -oKoOptimizedCompositeOpFactoryPerArch_AVX.cpp.o
/home/boud/kde/src/calligra/libs/pigment/compositeops/KoOptimizedCompositeOpFactoryPerArch.cpp
In file included from
/home/boud/kde/src/calligra/libs/pigment/DebugPigment.h:23:0,
from
/home/boud/kde/src/calligra/libs/pigment/compositeops/KoOptimizedCompositeOpFactoryPerArch.cpp:23:
/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.
libs/pigment/CMakeFiles/pigmentcms.dir/build.make:72: recipe for
target 'libs/pigment/KoOptimizedCompositeOpFactoryPerArch_AVX.cpp.o'
failed
And that's where I'm totally stuck. It seems the cmake 3.0/kf5/e-c-m (I
don't know where this system came from) is incompatible with a key libary
that I have to use. We can't drop using Vc, we cannot move to a newer
release of Vc and I can't see a way to replicate the functionality of
vc_compile_for_all_implementations in our own cmake code either, so please
help!
Boudewijn
More information about the Kde-buildsystem
mailing list