Commit ececcbd4 authored by Andrea Valassi's avatar Andrea Valassi
Browse files

Take ccache from CMAKE_PREFIX_PATH if found there (CORALCOOL-2912).


git-svn-id: file:///git/lcgcool.svndb/cool/trunk@20108 4525493e-7705-40b1-a816-d608a930855b
parent 66263730
......@@ -78,20 +78,15 @@ $(info -- Using NINJA=$(NINJA))
# Use ccache for faster builds (avoid recompiling unchanged source files)!
# [moved here from setupCmake.sh to use it also in lcgcmake (CORALCOOL-2844)]
CCACHE := $(shell which ccache 2> /dev/null || which ccache-swig 2> /dev/null)
$(info -- Using CCACHE=$(CCACHE))
ifneq ($(CCACHE),)
override CMAKEFLAGS += "-DCMAKE_USE_CCACHE=ON"
# define CCACHE_DIR if not yet done
ifeq ($(CCACHE_DIR),)
export CCACHE_DIR=$(CURDIR)/.ccache
else
export CCACHE_DIR
endif
$(info -- Using CCACHE_DIR=$(CCACHE_DIR))
# [partly moved to CORALEnableCCache.cmake (CORALCOOL-2912)
# Define CCACHE_DIR (if not yet done) and CCACHE_CONFIGPATH (all the time)
override CMAKEFLAGS += "-DCMAKE_USE_CCACHE=ON"
ifeq ($(CCACHE_DIR),)
export CCACHE_DIR=$(CURDIR)/.ccache
else
export CCACHE_DIR=
export CCACHE_DIR
endif
export CCACHE_CONFIGPATH=$(CCACHE_DIR)/ccache.conf
# New simpler cmake build infrastructure with no toolchains (CORALCOOL-2847).
# This is meant to support three use cases: 1. standalone builds against an
......@@ -231,8 +226,10 @@ ifneq ($(MAKECMDGOALS),purge)
+$(BUILD_CMD) $*
endif
# Aliases
# Phony targets
.PHONY: configure tests FORCE
# Aliases
ifneq ($(wildcard $(BUILDDIR)/$(BUILD_CONF_FILE)),)
configure: rebuild_cache
else
......@@ -270,16 +267,8 @@ $(MAKEFILE_LIST):
# Trigger CMake configuration
# [moved here from setupCmake.sh also CCACHE_DIR dir creation (CORALCOOL-2844)]
# [skip CCACHE_DIR creation, moved dump to CORALEnableCCache (CORALCOOL-2912)]
$(BUILDDIR)/$(BUILD_CONF_FILE):
ifneq ($(CCACHE_DIR),)
ifeq ($(wildcard $(CCACHE_DIR)),)
@echo "-- Creating cache dir $(CCACHE_DIR)"
@ccache -M2G
else
@echo "-- Dumping ccache stats for $(CCACHE_DIR)"
@ccache -s
endif
endif
@echo "-- Creating $(BUILDDIR)/$(BUILD_CONF_FILE)"
mkdir -p $(BUILDDIR)
cd $(BUILDDIR) && $(CMAKE) $(CMAKEFLAGS) $(CURDIR)
......@@ -74,8 +74,8 @@ touch $out
# Dump the cache for info before rebuilding
if ccache -h > /dev/null 2>&1; then
echo "=== ccache -s"
ccache -s
ccache -s >> $out 2>&1
echo ccache is `which ccache`
ccache -s # Dump this only to stdout
fi
# Rebuild from scratch
......
# Add to a project the possibility of using ccache during compilation.
find_program(ccache_cmd NAMES ccache ccache-swig)
mark_as_advanced(ccache_cmd distcc_cmd)
mark_as_advanced(ccache_cmd)
if(ccache_cmd)
option(CMAKE_USE_CCACHE "Use ccache to speed up compilation." OFF)
if(CMAKE_USE_CCACHE)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${ccache_cmd})
###set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ${ccache_cmd}) # Not needed (CORALCOOL-2927)
message(STATUS "Using ccache for building")
message(STATUS "Using CCACHE=${ccache_cmd}")
message(STATUS "Using CCACHE_DIR=$ENV{CCACHE_DIR}")
message(STATUS "Using CCACHE_CONFIGPATH=$ENV{CCACHE_CONFIGPATH}")
message(STATUS "Dump ccache stats")
execute_process(COMMAND ${ccache_cmd} -s)
endif()
endif()
......@@ -63,6 +63,7 @@ fi
# Use ccache for faster builds (avoid recompiling unchanged source files)!
# [moved from here to Makefile to use it also in nightlies (CORALCOOL-2844)]
export CCACHE_DIR=$topdir/.ccache # keep this here to allow interactive queries
export CCACHE_CONFIGPATH=$CCACHE_DIR/ccache.conf
###export CMAKEFLAGS="-DCMAKE_USE_CCACHE=ON"
###if ! ccache -h > /dev/null 2>&1; then
### echo "WARNING! No path to ccache"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment