From c0980c740022e025fb6c089092f03992ac8a90ba Mon Sep 17 00:00:00 2001 From: Matthias Kretz Date: Mon, 9 Jul 2007 15:27:27 +0000 Subject: As posted to kde-buildsystem: I replaced kde4automoc.cmake with a C++/QtCore based program that can run more efficient. Instead of creating a .automoc file that is added to the target I create a _automoc.cpp file now that is compiled and linked into the target. This file #includes all moc files that are not included by other source files. This way the automoc can, at make-time, decide what mocs need to be compiled explicitly and linked into the target. E.g. the following is possible now: foo.h: class A : public QObject { Q_OBJECT ... }; foo.cpp does not #include "foo.moc" run make - everything compiles and links fine (without mentioning the header in KDE4_MOC_HEADERS either since the new automoc looks at all corresponding header files from the .cpp files by itself) now change foo.cpp to #include "foo.moc" running make now will just work, even with the /fast target. Next change I did was to create a _automoc.cpp.files file to pass the moc includes and the source files that belong to the target to the automoc. I could have kept it on the command line but I got a report that the command line was already too long for Windows' cmd.exe. Implementation details: - The messages of the automoc are written using cmake -E cmake_echo_color, so the automoc correctly colorizes its messages now. - The moc QProcesses are started in parallel (up to 10). svn path=/trunk/KDE/kdelibs/; revision=685719 --- modules/FindKDE4Internal.cmake | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'modules/FindKDE4Internal.cmake') diff --git a/modules/FindKDE4Internal.cmake b/modules/FindKDE4Internal.cmake index ac7c6e43..24803eab 100644 --- a/modules/FindKDE4Internal.cmake +++ b/modules/FindKDE4Internal.cmake @@ -16,6 +16,7 @@ # compile KDE software: # # KDE4_KCFGC_EXECUTABLE - the kconfig_compiler executable +# KDE4_AUTOMOC_EXECUTABLE - the kde4automoc executable # KDE4_MEINPROC_EXECUTABLE - the meinproc4 executable # KDE4_MAKEKDEWIDGETS_EXECUTABLE - the makekdewidgets executable # @@ -389,11 +390,13 @@ if (_kdeBootStrapping) set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH} ) # CMAKE_CFG_INTDIR is the output subdirectory created e.g. by XCode and MSVC set(KDE4_KCFGC_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/kconfig_compiler ) + set(KDE4_AUTOMOC_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/kde4automoc ) set(KDE4_MEINPROC_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/meinproc4 ) set(KDE4_MAKEKDEWIDGETS_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/makekdewidgets ) else (WIN32) set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib ) set(KDE4_KCFGC_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/kconfig_compiler.shell ) + set(KDE4_AUTOMOC_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/kde4automoc.shell ) set(KDE4_MEINPROC_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/meinproc4.shell ) set(KDE4_MAKEKDEWIDGETS_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/makekdewidgets.shell ) endif (WIN32) @@ -402,6 +405,7 @@ if (_kdeBootStrapping) # when building kdelibs, make the kcfg rules depend on the binaries... set( _KDE4_KCONFIG_COMPILER_DEP kconfig_compiler) + set( _KDE4_AUTOMOC_EXECUTABLE_DEP kde4automoc) set( _KDE4_MAKEKDEWIDGETS_DEP makekdewidgets) set( _KDE4_MEINPROC_EXECUTABLE_DEP meinproc4) @@ -411,6 +415,7 @@ else (_kdeBootStrapping) # ... but NOT otherwise set( _KDE4_KCONFIG_COMPILER_DEP) + set( _KDE4_AUTOMOC_EXECUTABLE_DEP) set( _KDE4_MAKEKDEWIDGETS_DEP) set( _KDE4_MEINPROC_EXECUTABLE_DEP) @@ -530,6 +535,9 @@ else (_kdeBootStrapping) find_program(KDE4_KCFGC_EXECUTABLE NAME kconfig_compiler PATHS ${KDE4_BIN_INSTALL_DIR} NO_DEFAULT_PATH ) find_program(KDE4_KCFGC_EXECUTABLE NAME kconfig_compiler ) + find_program(KDE4_AUTOMOC_EXECUTABLE NAME kde4automoc PATHS ${KDE4_BIN_INSTALL_DIR} NO_DEFAULT_PATH ) + find_program(KDE4_AUTOMOC_EXECUTABLE NAME kde4automoc ) + find_program(KDE4_MEINPROC_EXECUTABLE NAME meinproc4 PATHS ${KDE4_BIN_INSTALL_DIR} NO_DEFAULT_PATH ) find_program(KDE4_MEINPROC_EXECUTABLE NAME meinproc4 ) @@ -864,6 +872,12 @@ macro (KDE4_PRINT_RESULTS) else(KDE4_KCFGC_EXECUTABLE) message(STATUS "Didn't find the KDE4 kconfig_compiler preprocessor") endif(KDE4_KCFGC_EXECUTABLE) + + if(KDE4_AUTOMOC_EXECUTABLE) + message(STATUS "Found KDE4 automoc: ${KDE4_AUTOMOC_EXECUTABLE}") + else(KDE4_AUTOMOC_EXECUTABLE) + message(STATUS "Didn't find the KDE4 automoc") + endif(KDE4_AUTOMOC_EXECUTABLE) endmacro (KDE4_PRINT_RESULTS) -- cgit v1.2.1