[CMake] Possiblity to speedup the build by compiling multiple files in one compiler invocation

Yuri Timenkov yuri at timenkov.ru
Wed Apr 27 02:10:14 EDT 2011


However, it is well-known technique called Unity Build and has some side,
effects both useful (more room for optimizer) and not (always full rebuild).
You may google a bit more about it.

On Apr 27, 2011 12:01 AM, "Alexander Neundorf" <a.neundorf-work at gmx.net>
wrote:
> On Tuesday 26 April 2011, Martin Nielsen wrote:
>> Hi,
>>
>> I have been asked to look into the possibilities of compiling multiple
>> files in one invocation of the compiler like:
>>
>> armcc.exe ... file1.c file2.c ... fileN.c -o mylib.lib
>>
>> The cross compiler we are using requires a license in order to compile
the
>> file. It is a network floating license mechanism and the majority of the
>> time it take to build the code is spent on acquiring the license.
Parallel
>> build is sadly not an option either since it just requests multiple
>> licenses and we quickly run out.
>>
>> I was wondering if CMake could be directed to somehow do this? or it
would
>> break some dependency between the source files and the generation of the
>> library.
>>
>> I suspect it isn't possible but would like to confirm this or explore
other
>> ideas on how to get around this problem.
>
> In KDE we have an option KDE4_ENABLE_FINAL.
> If this is set to TRUE, then for each binary a cpp-file is generated,
which
> has #include "file.cpp" statements for each of the original source files,
and
> then this one file, which then contains basically the whole source code,
is
> compiled at once.
>
> You can search for "enable_final" e.g. here:
>
http://websvn.kde.org/branches/KDE/4.5/kdelibs/cmake/modules/KDE4Macros.cmake?revision=1143427&view=markup
>
> This is transparent for the user.
> If he uses kde4_add_executable(foo a.cpp b.cpp main.cpp)
> and turns the option on, then the all-in-one file is created automatically
and
> built.
>
> Alex
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110427/c4ea0e25/attachment.htm>


More information about the CMake mailing list