Lumiera
0.pre.03
»edit your freedom«
ToolCCache.py
1
# -*- python -*-
2
5
6
# Copyright (C) Lumiera.org and FreeOrion.org
7
# 2008, Hermann Vosseler <Ichthyostega@web.de>
8
#
9
# This program is free software; you can redistribute it and/or
10
# modify it under the terms of the GNU General Public License as
11
# published by the Free Software Foundation; either version 2 of
12
# the License, or (at your option) any later version.
13
#
14
# This program is distributed in the hope that it will be useful,
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
# GNU General Public License for more details.
18
#
19
# You should have received a copy of the GNU General Public License
20
# along with this program; if not, write to the Free Software
21
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22
23
24
# This SCons builder was extracted from http://www.freeorion.org/
25
# FreeOrion is an open-source platform-independent galactic conquest game
26
#
27
# history: 12/2008 adapted for Lumiera build system
28
29
30
import
os
31
from
Buildhelper
import
*
32
33
34
def
generate(env):
35
""" Modify the environment such as to redirect any
36
C/C++ compiler invocations through CCache, while using
37
CCache config variables found in the os.environment.
38
"""
39
if
not
exists(env):
return
40
41
assert
env[
'CCACHE'
]
42
if
not
env[
'CCACHE'
]
in
env[
'CC'
]:
43
env[
'CC'
] = env.subst(
'$CCACHE $CC'
)
44
if
not
env[
'CCACHE'
]
in
env[
'CXX'
]:
45
env[
'CXX'
] = env.subst(
'$CCACHE $CXX'
)
46
print
env.subst(
"* Build using $CCACHE"
)
47
48
for
i
in
[
'HOME'
49
,
'CCACHE_DIR'
50
,
'CCACHE_TEMPDIR'
51
,
'CCACHE_LOGFILE'
52
,
'CCACHE_PATH'
53
,
'CCACHE_CC'
54
,
'CCACHE_CPP2'
55
,
'CCACHE_PREFIX'
56
,
'CCACHE_DISABLE'
57
,
'CCACHE_READONLY'
58
,
'CCACHE_NOSTATS'
59
,
'CCACHE_NLEVELS'
60
,
'CCACHE_HARDLINK'
61
,
'CCACHE_RECACHE'
62
,
'CCACHE_UMASK'
63
,
'CCACHE_HASHDIR'
64
,
'CCACHE_UNIFY'
65
,
'CCACHE_EXTENSION'
66
]:
67
if
os.environ.has_key(i)
and
not
env.has_key(i):
68
env[
'ENV'
][i] = os.environ[i]
69
70
71
72
def
exists(env):
73
""" Ensure CCache is available.
74
"""
75
return
checkCommandOption(env,
'CCACHE'
, cmdName=
'ccache'
)
76
admin
scons
ToolCCache.py
Generated on Sat Apr 20 2024 02:03:42 for Lumiera by
1.8.13