setup_ccache 929 B

12345678910111213141516171819202122232425262728293031323334353637
  1. autoload -Uz is-at-least log_debug log_warning
  2. if (( ${+commands[ccache]} )) {
  3. log_debug "Found ccache at ${commands[ccache]}"
  4. local ccache_version=$(ccache --version | head -1 | cut -d ' ' -f 3)
  5. if ! is-at-least 4.12 ${ccache_version}; then
  6. ccache --set-config=run_second_cpp=true
  7. fi
  8. ccache --set-config=direct_mode=true
  9. ccache --set-config=inode_cache=true
  10. ccache --set-config=compiler_check=content
  11. ccache --set-config=file_clone=true
  12. local -a sloppiness=(
  13. include_file_mtime
  14. include_file_ctime
  15. file_stat_matches
  16. system_headers
  17. )
  18. if [[ ${host_os} == macos ]] {
  19. sloppiness+=(
  20. modules
  21. clang_index_store
  22. )
  23. ccache --set-config=sloppiness=${(j:,:)sloppiness}
  24. }
  25. ccache --set-config=cache_dir="${GITHUB_WORKSPACE:-${HOME}}/.ccache"
  26. ccache --set-config=max_size="${CCACHE_SIZE:-1G}"
  27. ccache -z > /dev/null
  28. } else {
  29. log_warning "Ccache not available"
  30. }