summaryrefslogtreecommitdiff
path: root/lib/spack/env
diff options
context:
space:
mode:
authorChristoph Junghans <christoph.junghans@gmail.com>2018-07-09 15:06:10 -0600
committerscheibelp <scheibel1@llnl.gov>2018-07-09 14:06:10 -0700
commit8bc3f7d726d18d2c76e5bcc64d4160ae950b2cae (patch)
treef6a0cb0e0c55f11253990d4971e96358eea2ec94 /lib/spack/env
parent8770957b7ad26f9697663c39b43f493ac8ecd79c (diff)
downloadspack-8bc3f7d726d18d2c76e5bcc64d4160ae950b2cae.tar.gz
spack-8bc3f7d726d18d2c76e5bcc64d4160ae950b2cae.tar.bz2
spack-8bc3f7d726d18d2c76e5bcc64d4160ae950b2cae.tar.xz
spack-8bc3f7d726d18d2c76e5bcc64d4160ae950b2cae.zip
Add ccache support (#3761)
If the user sets "ccache: true" in spack's config.yaml, Spack will use an available ccache executable when compiling c/c++ code. This feature is disabled by default (i.e. "ccache: false") and the documentation is updated with how to enable ccache support
Diffstat (limited to 'lib/spack/env')
-rwxr-xr-xlib/spack/env/cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/spack/env/cc b/lib/spack/env/cc
index 22f6cb345c..bc4a20dc3e 100755
--- a/lib/spack/env/cc
+++ b/lib/spack/env/cc
@@ -342,7 +342,15 @@ case "$mode" in
args=("${args[@]}" ${SPACK_LDLIBS[@]}) ;;
esac
-full_command=("$command" "${args[@]}")
+#ccache only supports C languages, so filtering out Fortran
+if [[ ( ${lang_flags} = "C" || ${lang_flags} = "CXX" ) && ${SPACK_CCACHE_BINARY} ]]; then
+ full_command=("${SPACK_CCACHE_BINARY}" "$command" "${args[@]}")
+ # #3761#issuecomment-294352232
+ # workaround for stage being a temp folder
+ export CCACHE_NOHASHDIR=yes
+else
+ full_command=("$command" "${args[@]}")
+fi
# In test command mode, write out full command for Spack tests.
if [[ $SPACK_TEST_COMMAND == dump-args ]]; then