Debian's Gitlab continous integration (CI) pipeline uses the compiler cache.
ccache depends on the CCACHE_DIR environment variable. As a consequence scons would need to propagate this environment variable. A possible patch could look like the following:
--- a/SConstruct +++ b/SConstruct @@ -201,6 +201,9 @@ opts.Update(defenv) Help(opts.GenerateHelpText(defenv)) +for key in(filter(lambda key: key in os.environ, ['CCACHE_DIR'])): + defenv['ENV'][key] = os.environ[key] + if defenv['TARGET_ARCH'] != 'x86': defenv['UNICODE'] = True
Let's do something simpler like:
I agree. I would appreciate if you could integrate your code.
Have you tried something like
scons CC="CCACHE_DIR=/tmp/whatever ccache"
? Seems to work for me in a very limited test.Your proposal to propagate the CCACHE_DIR environment variable via the command line argument CC="CACHE_DIR=/tmp/whatever ccache" seems to work.
I assume the same has to be done for CXX and for the cross compilers (i686-w64-mingw32-gcc, i686-w64-mingw32-g++).
This feels more like a workaround than a solution.
main.c
SConstruct
Test setting of ${CCACHE_DIR} environment variable
Last edit: f0rt 2020-08-31
SCons doesn't have built-in support for ccache, so it's all workarounds unless there is a proper tool definition. Don't you already need to override
CC
andCXX
with ccache anyway?If we add a tool like the ones in
SCons/Tools
, then it would be an even simplerscons TOOLS=ccache
.Thanks a lot for your explanation. I am going to give the idea of overriding CC adn CXX more thought.
Currently there is no need to override CC and CXX.
scons picks up the installed GNU C and C++ compiler (symbolic link named as the respective compiler pointing to the ccache executable).
For example the following command line is used to build the makensis compiler
and scons is invoked for cross compiling of stubs, plugins and utilities such as: