Added support for ccache and distcc.

This commit is contained in:
Sergey Popov 2008-06-27 11:52:19 +00:00
parent a4df332ae4
commit 897a453d55
3 changed files with 63 additions and 1 deletions

View file

@ -77,6 +77,8 @@ opts.AddOptions(
('boost_suffix', 'Suffix of boost libraries.'),
PathOption('gettextdir', 'Root directory of Gettext\'s installation.', "", OptionalPath),
('host', 'Cross-compile host.', ''),
BoolOption('distcc', "Use distcc", False),
BoolOption('ccache', "Use ccache", False),
('cxxtool', 'Set c++ compiler command if not using standard compiler.'),
BoolOption("fast", "Make scons faster at cost of less precise dependency tracking.", False)
)
@ -101,6 +103,10 @@ if env.get('cxxtool',""):
env['CXX'] = env['cxxtool']
env['ENV']['HOME'] = os.environ['HOME']
if env['distcc']: env.Tool('distcc')
if env['ccache']: env.Tool('ccache')
Help("""Arguments may be a mixture of switches and targets an any order.
Switches apply to the entire build regrdless of where they are in the order.
Important switches include:
@ -150,7 +156,7 @@ If you set CXXFLAGS and/or LDFLAGS in the environment, the values will
be appended to the appropriate variables within scons.
""" + opts.GenerateHelpText(env))
if env["cachedir"]:
if env["cachedir"] and not env['ccache']:
CacheDir(env["cachedir"])
if env["fast"]:

32
scons/ccache.py Normal file
View file

@ -0,0 +1,32 @@
# vi: syntax=python:et:ts=4
# Shamelessly stolen from FreeOrion's SConstruct
# http://freeorion.svn.sourceforge.net/viewvc/freeorion/trunk/FreeOrion/SConstruct?revision=2478&view=markup
import os
def exists():
return True
def generate(env):
env['CC'] = 'ccache %s' % env['CC']
env['CXX'] = 'ccache %s' % env['CXX']
for i in ['HOME',
'CCACHE_DIR',
'CCACHE_TEMPDIR',
'CCACHE_LOGFILE',
'CCACHE_PATH',
'CCACHE_CC',
'CCACHE_PREFIX',
'CCACHE_DISABLE',
'CCACHE_READONLY',
'CCACHE_CPP2',
'CCACHE_NOSTATS',
'CCACHE_NLEVELS',
'CCACHE_HARDLINK',
'CCACHE_RECACHE',
'CCACHE_UMASK',
'CCACHE_HASHDIR',
'CCACHE_UNIFY',
'CCACHE_EXTENSION']:
if os.environ.has_key(i) and not env.has_key(i):
env['ENV'][i] = os.environ[i]

24
scons/distcc.py Normal file
View file

@ -0,0 +1,24 @@
# vi: syntax=python:et:ts=4
# Shamelessly stolen from FreeOrion's SConstruct
# http://freeorion.svn.sourceforge.net/viewvc/freeorion/trunk/FreeOrion/SConstruct?revision=2478&view=markup
import os
def exists():
return True
def generate(env):
env['CC'] = 'distcc %s' % env['CC']
env['CXX'] = 'distcc %s' % env['CXX']
for i in ['HOME',
'DISTCC_HOSTS',
'DISTCC_VERBOSE',
'DISTCC_LOG',
'DISTCC_FALLBACK',
'DISTCC_MMAP',
'DISTCC_SAVE_TEMPS',
'DISTCC_TCP_CORK',
'DISTCC_SSH'
]:
if os.environ.has_key(i) and not env.has_key(i):
env['ENV'][i] = os.environ[i]