This is an archive of the discontinued LLVM Phabricator instance.

Build llvm with ccache if package is present
ClosedPublic

Authored by sgundapa on Jul 14 2016, 1:13 PM.

Details

Reviewers
chandlerc
beanz
Summary

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.

Diff Detail

Event Timeline

sgundapa updated this revision to Diff 64031.Jul 14 2016, 1:13 PM
sgundapa retitled this revision from to Build llvm with ccache if package is present on linux .
sgundapa updated this object.
sgundapa added a reviewer: beanz.
beanz edited edge metadata.Jul 14 2016, 1:24 PM

A few small comments below, but mostly good here.

CMakeLists.txt
83

I think the CMAKE_SYSTEM_NAME check here is unnecessary. ccache works on FreeBSD, OS X, and probably under MingW32, so I suspect if the program is present it should just be used.

I'm not sure how ccache behaves on Windows, so you might need to ensure that if you're on windows you're also on MingW32, which would be something like:

if(CCACHE_PROGRAM AND LLVM_CCACHE_BUILD AND (NOT WINDOWS OR MINGW32 OR CYGWIN))

I also think it would be good to log an error if LLVM_CCACHE_BUILD=On and CCACHE_PROGRAM is not found.

Agree. Will fix the patch and push a new one in a while

Also, we might not need "NOT WINDOWS OR MINGW32 OR CYGWIN" and find_program is going to take care of it

sgundapa updated this revision to Diff 64152.Jul 15 2016, 9:48 AM
sgundapa retitled this revision from Build llvm with ccache if package is present on linux to Build llvm with ccache if package is present.
sgundapa edited edge metadata.
beanz accepted this revision.Jul 28 2016, 10:30 AM
beanz edited edge metadata.

LGTM.

This revision is now accepted and ready to land.Jul 28 2016, 10:30 AM

I have merged this change as r277389.

sgundapa closed this revision.Aug 3 2016, 12:30 PM