Jeff Baumes at Kitware recently made this discovery:
Some may already know this, but I found a flag that you can use in
Visual Studio that enables file-level build parallelism within
projects like gmake. By default, Visual Studio only allows project-level
parallelism, which does not always use all your cores, for example if
you are building a project with a relatively small number of large
libraries (like VTK) with deeper dependency trees.
To enable this, add the flag /MP to CMAKE_CXX_FLAGS. I (and others)
noticed significant build time speedup for builds of CMake, ParaView,
and VTK. This is available in Visual Studio 2008, although some online
thread discussions state that this flag is also available as a "hidden
feature" of Visual Studio 2005. But you should probably assume it is
buggy or incomplete in that version.
The only known possible caveat is that having both file and project
parallelism on work independently, so having 8 cores with /MP on a
project with lots of project parallelism could spawn as many as 64
build threads, which will be inefficient. A repository like VXL with
600 projects may fall into this category. You can also play with a
global setting for all projects (in Options, Projects and Solutions,
Build and Run) to limit the number of projects built at once if this
is an issue, or in those cases you can just not use /MP.
Jeff
BTW, this seems to beat gmake -j N on my dual core laptop. CMake build
went from 3m (gmake) to 2m30s VS IDE from the command line.
-Bill
_______________________________________________
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