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
This commit is contained in:
		
				
					committed by
					
						
						scheibelp
					
				
			
			
				
	
			
			
			
						parent
						
							8770957b7a
						
					
				
				
					commit
					8bc3f7d726
				
			
							
								
								
									
										10
									
								
								lib/spack/env/cc
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								lib/spack/env/cc
									
									
									
									
										vendored
									
									
								
							@@ -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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user