Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
ToolCCache.py
Go to the documentation of this file.
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
21import os
22from Buildhelper import *
23
24
25def 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 i in os.environ and i not in env:
59 env['ENV'][i] = os.environ[i]
60
61
62
63def exists(env):
64 """ Ensure CCache is available.
65 """
66 return checkCommandOption(env, 'CCACHE', cmdName='ccache')
67
checkCommandOption(env, optID, val=None, cmdName=None)
evaluate and verify an option, which may point at a command.
generate(env)
Modify the environment such as to redirect any C/C++ compiler invocations through CCache,...
Definition ToolCCache.py:25
exists(env)
Ensure CCache is available.
Definition ToolCCache.py:63