SCons User Guide 0.96.1 | ||
---|---|---|
<<< Previous | Next >>> |
On multi-developer software projects, you can sometimes speed up every developer's builds a lot by allowing them to share the derived files that they build. SCons makes this easy, as well as reliable.
To enable sharing of derived files, use the CacheDir function in any SConscript file:
CacheDir('/usr/local/build_cache') |
Note that the directory you specify must already exist and be readable and writable by all developers who will be sharing derived files. It should also be in some central location that all builds will be able to access. In environments where developers are using separate systems (like individual workstations) for builds, this directory would typically be on a shared or NFS-mounted file system.
Here's what happens: When a build has a CacheDir specified, every time a file is built, it is stored in the shared cache directory along with its MD5 build signature. On subsequent builds, before an action is invoked to build a file, SCons will check the shared cache directory to see if a file with the exact same build signature already exists. If so, the derived file will not be built locally, but will be copied into the local build directory from the shared cache directory, like so:
% scons -Q cc -c -o hello.o hello.c cc -o hello hello.o % scons -Q -c Removed hello.o Removed hello % scons -Q Retrieved `hello.o' from cache Retrieved `hello' from cache |
<<< Previous | Home | Next >>> |
Adding Your Own Custom Checks | Keeping Build Output Consistent |