[ANNOUNCE] automoc4 from kdesupport now supported for building KDE
Alexander Neundorf
neundorf at kde.org
Mon May 19 23:35:03 CEST 2008
On Monday 19 May 2008, Matthias Kretz wrote:
> On Monday 19 May 2008, Alexander Neundorf wrote:
> > On Sunday 18 May 2008, Matthias Kretz wrote:
> > > On Saturday 17 May 2008, Andras Mantia wrote:
> > > > On Sunday 11 May 2008 00:58:38 Alexander Neundorf wrote:
> > > > > If you experience any problems with automoc, please let us know at
> > > > > kde-buildsystem at kde.org (or here).
> > > >
> > > > Here is a problem: kdebase fails to build if there are some older
> > > > include/solid/control/ifaces around.
> > > > The error is:
> > > > cd
> > > > /data/development/build/kde-trunk/kdebase/workspace/solid/networkmana
> > > >ge r- 0. 7 && /opt/kde4/bin/automoc4
> > > > /data/development/build/kde-trunk/kdebase/workspace/solid/networkmana
> > > >ge r- 0. 7/solid_networkmanager07_automoc.cpp
> > > > /data/development/sources/kde-trunk/kdebase/workspace/solid/networkma
> > > >na ge r- 0.7
> > > > /data/development/build/kde-trunk/kdebase/workspace/solid/networkmana
> > > >ge r- 0. 7 /opt/qt4/bin/moc [....]
> > > > Generating
> > > > /data/development/build/kde-trunk/kdebase/workspace/solid/networkmana
> > > >ge r- 0. 7/networkinterface.moc from
> > > > /data/development/sources/kde-trunk/kdebase/workspace/solid/networkma
> > > >na ge r- 0.7/networkinterface.h
> > > > /data/development/sources/kde-trunk/kdebase/workspace/solid/networkma
> > > >na ge r- 0.7/manager.h:35: Error: Undefined interface
> > > > [...]
> > > > automoc4: process
> > > > for
> > > > /data/development/build/kde-trunk/kdebase/workspace/solid/networkmana
> > > >ge r- 0. 7/manager.moc failed: Unknown error
> > > > pid to wait for: 0
> > > > processes in queue: 11
> > > >
> > > >
> > > > The problem is this line in manager.h:
> > > > #include <solid/control/ifaces/networkmanager.h>
> > > >
> > > > This picks up the installed networkmanager.h instead of the one from
> > > > kdebase/workspace/libs/solid/control/ifaces .
> > > >
> > > > I tried to add
> > > > ${CMAKE_SOURCE_DIR}/workspace/libs
> > > > to the include_directories, but seems that this is ignored or
> > > > searched after the system path.
> > > >
> > > > So the solution to build kdebase is to remove your installed version
> > > > and build again.This also does not work if e.g you have KDE 4.0.x
> > > > installed in /usr like it is on openSUSE. So you have to:
> > > > - remove the old files (e.g from /opt/kde4/include if KDE trunk was
> > > > installed there)
> > > > - build AND install kdebase/workspace/libs/solid (so the correct
> > > > headers are installed to /opt/kde4)
> > > > - build now kdebase/workspace/solid
> > > >
> > > > I find this behavior broken, automoc4 should find the header files
> > > > that are in kdebase/workspace/libs/solid/control/ifaces as specified
> > > > by the include_directory command.
> > >
> > > automoc4 uses the include directories as specified by
> > > include_directory. At least that's what I wrote and expect the code to
> > > do. :-)
> > >
> > > Take a look at the generated <target>_automoc.cpp.files file. Its
> > > second line contains all the include directories as they'll get passed
> > > to moc. This line gets generated by the configure_files call in
> > > Automoc4.cmake.
> >
> > CMake sorts the include dirs internally, so that in-project include dirs
> > are always before out-of-project include dirs.
> > (if CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE is true, done in
> > kdelibs/cmake/modules/KDE4Defaults.cmake)
> > Maybe this has to be added for automoc ?
>
> Alex, could you take a look at this please? Automoc4Config.cmake uses
> get_directory_property(_moc_incs INCLUDE_DIRECTORIES)
> as the ordered include paths to pass to moc. Why does this not work? Or why
> does this not work only in kdebase/workspace/solid/ ?
Testcase:
#enable/disable this line and see what happens
set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
include_directories(/opt/qt-copy/include /home/alex/src/tests/incdirtest2)
get_directory_property(incDirs INCLUDE_DIRECTORIES)
message(STATUS "inc: ${incDirs}")
add_executable(hello main.c)
GET_DIRECTORY_PROPERTY() returns the include dirs as they are, if
CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE is on they are ordered later on, but
that result isn't available.
So, automoc should also get ${CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE} and if
it is true, at first put all include dirs which are subdirs of the build dir,
then all include dirs which are subdirs of the source dir and finally all
other include dirs.
Alex
More information about the Kde-buildsystem
mailing list