[llvm] Use `ccache-swig` if `ccache` cannot be found (PR #90624)

Qiongsi Wu via llvm-commits llvm-commits at lists.llvm.org
Tue May 21 08:01:46 PDT 2024


https://github.com/qiongsiwu updated https://github.com/llvm/llvm-project/pull/90624

>From 474ca27ca961fa795b2f27a573ffe54617a606d5 Mon Sep 17 00:00:00 2001
From: Qiongsi Wu <qwu at ibm.com>
Date: Tue, 30 Apr 2024 10:56:03 -0400
Subject: [PATCH 1/3] Using ccache-swig on AIX

---
 llvm/CMakeLists.txt | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index 43181af3bc195..d0a4222009e9f 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -256,7 +256,12 @@ unset(SHOULD_ENABLE_PROJECT)
 # Build llvm with ccache if the package is present
 set(LLVM_CCACHE_BUILD OFF CACHE BOOL "Set to ON for a ccache enabled build")
 if(LLVM_CCACHE_BUILD)
-  find_program(CCACHE_PROGRAM ccache)
+  if(${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+    set(ccache_bin_name ccache-swig)
+  else()
+    set(ccache_bin_name ccache)
+  endif()
+  find_program(CCACHE_PROGRAM ${ccache_bin_name})
   if(CCACHE_PROGRAM)
     set(LLVM_CCACHE_MAXSIZE "" CACHE STRING "Size of ccache")
     set(LLVM_CCACHE_DIR "" CACHE STRING "Directory to keep ccached data")

>From cdbfc8f0902a9b86cce437c30b8d7fb8f2daf3b0 Mon Sep 17 00:00:00 2001
From: Qiongsi Wu <qwu at ibm.com>
Date: Tue, 30 Apr 2024 17:00:44 -0400
Subject: [PATCH 2/3] Address review comments.

---
 llvm/CMakeLists.txt | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index d0a4222009e9f..3ada38df09bab 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -256,12 +256,11 @@ unset(SHOULD_ENABLE_PROJECT)
 # Build llvm with ccache if the package is present
 set(LLVM_CCACHE_BUILD OFF CACHE BOOL "Set to ON for a ccache enabled build")
 if(LLVM_CCACHE_BUILD)
-  if(${CMAKE_SYSTEM_NAME} MATCHES "AIX")
-    set(ccache_bin_name ccache-swig)
-  else()
-    set(ccache_bin_name ccache)
+  find_program(CCACHE_PROGRAM ccache)
+  if (NOT CCACHE_PROGRAM)
+    find_program(CCACHE_PROGRAM ccache-swig)
   endif()
-  find_program(CCACHE_PROGRAM ${ccache_bin_name})
+
   if(CCACHE_PROGRAM)
     set(LLVM_CCACHE_MAXSIZE "" CACHE STRING "Size of ccache")
     set(LLVM_CCACHE_DIR "" CACHE STRING "Directory to keep ccached data")

>From 5c0a022b73e523e7b2c342a4a1806089c2fdbba3 Mon Sep 17 00:00:00 2001
From: Qiongsi Wu <qwu at ibm.com>
Date: Tue, 21 May 2024 11:01:47 -0400
Subject: [PATCH 3/3] Address review comments.

---
 llvm/CMakeLists.txt | 6 ++----
 llvm/docs/CMake.rst | 2 ++
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index 3ada38df09bab..0b94725d6a06a 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -256,11 +256,9 @@ unset(SHOULD_ENABLE_PROJECT)
 # Build llvm with ccache if the package is present
 set(LLVM_CCACHE_BUILD OFF CACHE BOOL "Set to ON for a ccache enabled build")
 if(LLVM_CCACHE_BUILD)
+  message(NOTICE "LLVM_CCACHE_BUILD will be deprecated. "
+	"Use CMAKE_C_COMPILER_LAUNCHER and CMAKE_CXX_COMPILER_LAUNCHER instead.")
   find_program(CCACHE_PROGRAM ccache)
-  if (NOT CCACHE_PROGRAM)
-    find_program(CCACHE_PROGRAM ccache-swig)
-  endif()
-
   if(CCACHE_PROGRAM)
     set(LLVM_CCACHE_MAXSIZE "" CACHE STRING "Size of ccache")
     set(LLVM_CCACHE_DIR "" CACHE STRING "Directory to keep ccached data")
diff --git a/llvm/docs/CMake.rst b/llvm/docs/CMake.rst
index 41ef5f40c6cf6..924d4ddc629a5 100644
--- a/llvm/docs/CMake.rst
+++ b/llvm/docs/CMake.rst
@@ -400,6 +400,8 @@ enabled sub-projects. Nearly all of these variable names begin with
   llvm-as* at the root of your build directory.
 
 **LLVM_CCACHE_BUILD**:BOOL
+  Note: this option will be deprecated. Use ``CMAKE_C_COMPILER_LAUNCHER`` and
+  ``CMAKE_CXX_COMPILER_LAUNCHER`` instead.
   If enabled and the ``ccache`` program is available, then LLVM will be
   built using ``ccache`` to speed up rebuilds of LLVM and its components.
   Defaults to OFF.  The size and location of the cache maintained



More information about the llvm-commits mailing list