Lumiera
0.pre.03
»edit your freedom«
ToolCCache.py
1
# coding: utf-8
2
5
6
# Copyright (C) Lumiera.org and FreeOrion.org
7
# 2008, Hermann Vosseler <Ichthyostega@web.de>
8
#
9
# **Lumiera** is free software; you can redistribute it and/or modify it
10
# under the terms of the GNU General Public License as published by the
11
# Free Software Foundation; either version 2 of the License, or (at your
12
# option) any later version. See the file COPYING for further details.
13
14
15
# This SCons builder was extracted from http://www.freeorion.org/
16
# FreeOrion is an open-source platform-independent galactic conquest game
17
#
18
# history: 12/2008 adapted for Lumiera build system
19
20
21
import
os
22
from
Buildhelper
import
*
23
24
25
def
generate(env):
26
""" Modify the environment such as to redirect any
27
C/C++ compiler invocations through CCache, while using
28
CCache config variables found in the os.environment.
29
"""
30
if
not
exists(env):
return
31
32
assert
env[
'CCACHE'
]
33
if
not
env[
'CCACHE'
]
in
env[
'CC'
]:
34
env[
'CC'
] = env.subst(
'$CCACHE $CC'
)
35
if
not
env[
'CCACHE'
]
in
env[
'CXX'
]:
36
env[
'CXX'
] = env.subst(
'$CCACHE $CXX'
)
37
print
env.subst(
"* Build using $CCACHE"
)
38
39
for
i
in
[
'HOME'
40
,
'CCACHE_DIR'
41
,
'CCACHE_TEMPDIR'
42
,
'CCACHE_LOGFILE'
43
,
'CCACHE_PATH'
44
,
'CCACHE_CC'
45
,
'CCACHE_CPP2'
46
,
'CCACHE_PREFIX'
47
,
'CCACHE_DISABLE'
48
,
'CCACHE_READONLY'
49
,
'CCACHE_NOSTATS'
50
,
'CCACHE_NLEVELS'
51
,
'CCACHE_HARDLINK'
52
,
'CCACHE_RECACHE'
53
,
'CCACHE_UMASK'
54
,
'CCACHE_HASHDIR'
55
,
'CCACHE_UNIFY'
56
,
'CCACHE_EXTENSION'
57
]:
58
if
os.environ.has_key(i)
and
not
env.has_key(i):
59
env[
'ENV'
][i] = os.environ[i]
60
61
62
63
def
exists(env):
64
""" Ensure CCache is available.
65
"""
66
return
checkCommandOption(env,
'CCACHE'
, cmdName=
'ccache'
)
67
admin
scons
ToolCCache.py
Generated on Fri Dec 13 2024 05:05:36 for Lumiera by
1.8.13