feat: disable ccache by default, enable with --use-ccache flag

This change modifies the LLVM build process to disable ccache by default
and only enable it when the --use-ccache flag is explicitly passed. This
reduces CI storage consumption while still allowing developers to opt-in
to ccache for faster incremental builds.

Changes:
- Modified build_llvm() to accept use_ccache parameter (defaults to False)
- Updated ccache logic to only enable when use_ccache=True and platform is not Windows
- Pass options.use_ccache from main() to build_llvm() call

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
liang.he@intel.com 2026-03-20 11:31:13 +08:00
parent bf9612c1e6
commit 89f34f12c7

View File

@ -48,7 +48,7 @@ def query_llvm_version(llvm_info):
return response['sha'] return response['sha']
def build_llvm(llvm_dir, platform, backends, projects, use_clang=False, extra_flags=''): def build_llvm(llvm_dir, platform, backends, projects, use_clang=False, extra_flags='', use_ccache=False):
LLVM_COMPILE_OPTIONS = [ LLVM_COMPILE_OPTIONS = [
'-DCMAKE_BUILD_TYPE:STRING="Release"', '-DCMAKE_BUILD_TYPE:STRING="Release"',
"-DCMAKE_EXPORT_COMPILE_COMMANDS=ON", "-DCMAKE_EXPORT_COMPILE_COMMANDS=ON",
@ -68,8 +68,8 @@ def build_llvm(llvm_dir, platform, backends, projects, use_clang=False, extra_fl
"-DLLVM_OPTIMIZED_TABLEGEN:BOOL=ON", "-DLLVM_OPTIMIZED_TABLEGEN:BOOL=ON",
] ]
# ccache is not available on Windows # ccache is opt-in via --use-ccache flag
if not "windows" == platform: if not "windows" == platform and use_ccache:
LLVM_COMPILE_OPTIONS.append("-DLLVM_CCACHE_BUILD:BOOL=ON") LLVM_COMPILE_OPTIONS.append("-DLLVM_CCACHE_BUILD:BOOL=ON")
# perf support is available on Linux only # perf support is available on Linux only
if "linux" == platform: if "linux" == platform:
@ -339,7 +339,7 @@ def main():
if ( if (
build_llvm( build_llvm(
llvm_dir, platform, options.arch, options.project, options.use_clang, llvm_dir, platform, options.arch, options.project, options.use_clang,
options.extra_cmake_flags options.extra_cmake_flags, options.use_ccache
) )
is not None is not None
): ):