[llvm] r277389 - Build llvm with ccache if package is present
Sumanth Gundapaneni via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 1 14:28:03 PDT 2016
Author: sgundapa
Date: Mon Aug 1 16:28:03 2016
New Revision: 277389
URL: http://llvm.org/viewvc/llvm-project?rev=277389&view=rev
Log:
Build llvm with ccache if package is present
This patch has the following changes
The CMake variable LLVM_CCACHE_BUILD is set to OFF by default.
Set this to ON for a ccache enabled build
CCACHE_CPP2 is required to compile the source file directly instead
of compiling the preprocessed file. This will help WERROR is turned ON
for a host clang compiler
The below two options makes more sense in the context of a buildbot
CCACHE_HASHDIR is required to maintain the separate cached data across
builders. This will also help the debuggers to point to the correct source
location
CCACHE_SIZE is important in the perspective of buildbot to increase the
limit on the amount of data to hold in cache for faster compilation
CCACHE_DIR is used to save the cached data to a specific directory.
Modified:
llvm/trunk/CMakeLists.txt
Modified: llvm/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=277389&r1=277388&r2=277389&view=diff
==============================================================================
--- llvm/trunk/CMakeLists.txt (original)
+++ llvm/trunk/CMakeLists.txt Mon Aug 1 16:28:03 2016
@@ -101,6 +101,26 @@ if(LLVM_PARALLEL_COMPILE_JOBS)
endif()
endif()
+# 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(CCACHE_PROGRAM)
+ set(LLVM_CCACHE_SIZE "" CACHE STRING "Size of ccache")
+ set(LLVM_CCACHE_DIR "" CACHE STRING "Directory to keep ccached data")
+ set(CCACHE_PROGRAM "CCACHE_CPP2=yes CCACHE_HASHDIR=yes ${CCACHE_PROGRAM}")
+ if (LLVM_CCACHE_SIZE)
+ set(CCACHE_PROGRAM "CCACHE_SIZE=${LLVM_CCACHE_SIZE} ${CCACHE_PROGRAM}")
+ endif()
+ if (LLVM_CCACHE_DIR)
+ set(CCACHE_PROGRAM "CCACHE_DIR=${LLVM_CCACHE_DIR} ${CCACHE_PROGRAM}")
+ endif()
+ set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE_PROGRAM})
+ else()
+ message(FATAL_ERROR "Unable to find the program ccache. Set LLVM_CCACHE_BUILD to OFF")
+ endif()
+endif()
+
option(LLVM_BUILD_GLOBAL_ISEL "Experimental: Build GlobalISel" OFF)
if(LLVM_BUILD_GLOBAL_ISEL)
add_definitions(-DLLVM_BUILD_GLOBAL_ISEL)
More information about the llvm-commits
mailing list