[Insight-developers] Faster builds on SGI's

Bill Hoffman bill.hoffman@kitware.com
Thu, 13 Mar 2003 13:39:22 -0500


If you have a multiprocessor SGI, I just found a trick that will
speed up the compiles a bit.

Create a file that looks like this:
------IRIX-fast-build.cmake----
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-J25 -shared -rdata_shared")
SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-J25 -shared -rdata_shared") 
SET(CMAKE_CXX_CREATE_STATIC_LIBRARY
      "<CMAKE_CXX_COMPILER> -J25 -ar -o <TARGET> <OBJECTS>")
SET (CMAKE_EXE_LINKER_FLAGS -J25 ${CMAKE_EXE_LINKER_FLAGS})

--- add this line to your  CMakeCache.txt -----
CMAKE_USER_MAKE_RULES_OVERRIDE:STRING=/home/sci/itk/IRIX-fast-build.cmake

(make sure the path is correct for your machine...)


run cmake
run gmake -j25

The problem is that the prelinker step is by default single threaded, so
the gmake -j25 does not help during the template instantiation step, which
is the long part of ITK.   The above change adds a -J25 to the link of exe,
shared and static libraries.    This causes the prelink step to run 25 in parallel.
The 25 can of course be adjusted based on the number of processors you have.

-Bill