Use ccache if available.
If ccache is availble, use it. It can improve a lot the compilation time. We do not change the meson_cross_file.txt as, for now, meson doesn't support ccache when cross-compiling.
This commit is contained in:
parent
7b293575de
commit
cff9642c23
|
@ -358,7 +358,14 @@ class BuildEnv:
|
|||
if env['PKG_CONFIG_PATH']
|
||||
else pkgconfig_path
|
||||
)
|
||||
env['PATH'] = ':'.join([pj(self.install_dir, 'bin'), env['PATH']])
|
||||
# Add ccache path
|
||||
for p in ('/usr/lib/ccache', '/usr/lib64/ccache'):
|
||||
if os.path.isdir(p):
|
||||
ccache_path=[p]
|
||||
break
|
||||
else:
|
||||
ccache_path = []
|
||||
env['PATH'] = ':'.join([pj(self.install_dir, 'bin')] + ccache_path + [env['PATH']])
|
||||
ld_library_path = ':'.join([
|
||||
pj(self.install_dir, 'lib'),
|
||||
pj(self.install_dir, 'lib64')
|
||||
|
|
|
@ -10,9 +10,18 @@ PATH="{root_path}/bin:$PATH_ORIG"; export PATH;
|
|||
HOST_CC=gcc; export HOST_CC;
|
||||
unset PKG_CONFIG_PATH;
|
||||
|
||||
CC={which:{binaries[c]}}; export CC
|
||||
ccache=`which ccache`
|
||||
|
||||
CC={which:{binaries[c]}}
|
||||
CXX={which:{binaries[cpp]}}
|
||||
if [ "x$ccache" != "x" ] ; then
|
||||
CC="ccache $CC"
|
||||
CXX="ccache $CXX"
|
||||
fi
|
||||
export CC
|
||||
export CXX
|
||||
|
||||
AR={which:{binaries[ar]}}; export AR
|
||||
CXX={which:{binaries[cpp]}}; export CXX
|
||||
STRIP={which:{binaries[strip]}}; export STRIP
|
||||
CFLAGS=" -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4"; export CFLAGS;
|
||||
CXXFLAGS=" -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4"; export CXXFLAGS;
|
||||
|
|
|
@ -2,12 +2,18 @@ SET(CMAKE_SYSTEM_NAME Windows)
|
|||
SET(CMAKE_SYSTEM_PROCESSOR x86)
|
||||
|
||||
# specify the cross compiler
|
||||
SET(CMAKE_C_COMPILER {which:{binaries[c]}})
|
||||
SET(CMAKE_CXX_COMPILER {which:{binaries[cpp]}})
|
||||
SET(CMAKE_C_COMPILER "{which:{binaries[c]}}")
|
||||
SET(CMAKE_CXX_COMPILER "{which:{binaries[cpp]}}")
|
||||
SET(CMAKE_RC_COMPILER {which:{binaries[windres]}})
|
||||
SET(CMAKE_AR:FILEPATH {which:{binaries[ar]}})
|
||||
SET(CMAKE_RANLIB:FILEPATH {which:{binaries[ranlib]}})
|
||||
|
||||
find_program(CCACHE_FOUND ccache)
|
||||
if(CCACHE_FOUND)
|
||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
|
||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
|
||||
endif(CCACHE_FOUND)
|
||||
|
||||
# where is the target environment
|
||||
SET(CMAKE_FIND_ROOT_PATH {root_path})
|
||||
|
||||
|
|
Loading…
Reference in New Issue