Developing with ENABLE_FINAL build speed

Peter Kümmel syntheticpp at
Tue Mar 27 07:45:10 CEST 2007

When working on KDE one mostly does not work
on all projects and files at the same time,
which means these files will not be touched,
and they could be build with the

The problem using KDE4_ENABLE_FINAL is that
the projects with the touched files have to
rebuild completely on each change.
(With KDE4_ENABLE_FINAL a file is generated
which includes all cpp files.)

The idea of attached patch is to manually
exclude some files from the generated
all-in-one file.

So it is possible to a build with a speedup
of factor 3 to 4 and to work on some files
without waiting ages on each change, best
of both worlds.

How it works:
the new macro KDE4_CREATE_MERGED_FILES creates
two files, one file which contains all untouched
files and one all touched. By default the file
with the touched files is 'empty', no code is
included (like using KDE4_ENABLE_FINAL).

Moving one file from the const to the touched file
works by commenting out a macro definition and a
include (because the dependency scan of cmake is
macro insensible, or I'm wrong?).

For instance, kgzipfilter.cpp is a untouched file and
kfilterbase.cpp is a touched file:


#define kgzipfilter___ASSUME_CONST
#if defined(kgzipfilter___ASSUME_CONST) && !defined(DONT_INCLUDE_CONST_FILES)
#include "kgzipfilter.cpp"

//#define kfilterbase___ASSUME_CONST
#if defined(kfilterbase___ASSUME_CONST) && !defined(DONT_INCLUDE_CONST_FILES)
//#include "kfilterbase.cpp"


// touched files

// look for non-const files
#include "kdecore_allinone_const.C"

#ifndef kgzipfilter___ASSUME_CONST
#include "kgzipfilter.cpp"

#ifndef kfilterbase___ASSUME_CONST
#include "kfilterbase.cpp"

What about adding this after some polishing?

Could be tested with the option -Dmerge_files=1.


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: merge_file.patch

More information about the Kde-buildsystem mailing list