Developing with ENABLE_FINAL build speed

Peter Kümmel syntheticpp at gmx.net
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
KDE4_ENABLE_FINAL flag.

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:

allinone_const.C:

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

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



allinone_touched.C:

// touched files

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


#ifndef kgzipfilter___ASSUME_CONST
#include "kgzipfilter.cpp"
#endif

#ifndef kfilterbase___ASSUME_CONST
#include "kfilterbase.cpp"
#endif



What about adding this after some polishing?

Could be tested with the option -Dmerge_files=1.


Peter



-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: merge_file.patch
Url: http://mail.kde.org/pipermail/kde-buildsystem/attachments/20070327/467ada95/attachment.ksh 


More information about the Kde-buildsystem mailing list