[clang] e38cdc5 - Disable compiler launcher on external projects and multi stage clang

Haowei Wu via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 24 12:15:58 PDT 2023


Author: Haowei Wu
Date: 2023-04-24T12:15:44-07:00
New Revision: e38cdc5933b026cd25cf70c06f690a431c608d63

URL: https://github.com/llvm/llvm-project/commit/e38cdc5933b026cd25cf70c06f690a431c608d63
DIFF: https://github.com/llvm/llvm-project/commit/e38cdc5933b026cd25cf70c06f690a431c608d63.diff

LOG: Disable compiler launcher on external projects and multi stage clang

When using compiler caching program like ccache, there is no point to
use them on external projects or multi-stage clang builds. As these
builds uses fresh from source code toolchain and will pollute the build
cache. If a compiler launcher is still required, a user can explicity
define `CMAKE_C_COMPILER_LAUNCHER` and `CMAKE_CXX_COMPILER_LAUNCHER` in
`CLANG_BOOTSTRAP_PASSTHROUGH` and `LLVM_EXTERNAL_PROJECT_PASSTHROUGH`
flags to enable compiler launcher in these builds.

Differential Revision: https://reviews.llvm.org/D144603

Added: 
    

Modified: 
    clang/CMakeLists.txt
    llvm/cmake/modules/LLVMExternalProjectUtils.cmake

Removed: 
    


################################################################################
diff  --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index 4508ea4c77aa5..fd8558a16f81d 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -660,8 +660,6 @@ if (CLANG_ENABLE_BOOTSTRAP)
     LLVM_VERSION_SUFFIX
     LLVM_BINUTILS_INCDIR
     CLANG_REPOSITORY_STRING
-    CMAKE_C_COMPILER_LAUNCHER
-    CMAKE_CXX_COMPILER_LAUNCHER
     CMAKE_MAKE_PROGRAM
     CMAKE_OSX_ARCHITECTURES
     CMAKE_BUILD_TYPE

diff  --git a/llvm/cmake/modules/LLVMExternalProjectUtils.cmake b/llvm/cmake/modules/LLVMExternalProjectUtils.cmake
index 73910b4b083a1..44af6c1462bde 100644
--- a/llvm/cmake/modules/LLVMExternalProjectUtils.cmake
+++ b/llvm/cmake/modules/LLVMExternalProjectUtils.cmake
@@ -165,6 +165,19 @@ function(llvm_ExternalProject_Add name source_dir)
     endforeach()
   endforeach()
 
+  # Populate the non-project-specific passthrough variables
+  foreach(variableName ${LLVM_EXTERNAL_PROJECT_PASSTHROUGH})
+    if(DEFINED ${variableName})
+      if("${${variableName}}" STREQUAL "")
+        set(value "")
+      else()
+        string(REPLACE ";" "|" value "${${variableName}}")
+      endif()
+      list(APPEND PASSTHROUGH_VARIABLES
+        -D${variableName}=${value})
+    endif()
+  endforeach()
+
   if(ARG_USE_TOOLCHAIN AND NOT CMAKE_CROSSCOMPILING)
     if(CLANG_IN_TOOLCHAIN)
       if(is_msvc_target)
@@ -327,8 +340,6 @@ function(llvm_ExternalProject_Add name source_dir)
                -DPACKAGE_VERSION=${PACKAGE_VERSION}
                -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
                -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
-               -DCMAKE_C_COMPILER_LAUNCHER=${CMAKE_C_COMPILER_LAUNCHER}
-               -DCMAKE_CXX_COMPILER_LAUNCHER=${CMAKE_CXX_COMPILER_LAUNCHER}
                -DCMAKE_EXPORT_COMPILE_COMMANDS=1
                ${cmake_args}
                ${PASSTHROUGH_VARIABLES}


        


More information about the cfe-commits mailing list