Leverage ccache to reduce build times (both locally and on Travis-ci)

This commit is contained in:
Bruce B. Lacey 2016-07-04 15:17:58 -07:00
parent ca0a640aed
commit ca94f64c75
2 changed files with 30 additions and 7 deletions

View File

@ -23,10 +23,14 @@ env:
matrix: matrix:
- CMAKE_OPTS="-DBUILD_FEM_NETGEN=ON" - CMAKE_OPTS="-DBUILD_FEM_NETGEN=ON"
cache:
- ccache
language: cpp language: cpp
compiler: compiler:
- clang - clang
- gcc
python: 2.7 python: 2.7
@ -37,6 +41,11 @@ os:
dist: trusty dist: trusty
sudo: required sudo: required
matrix:
exclude:
- os: osx
compiler: gcc
git: git:
depth: 1500 depth: 1500
@ -93,16 +102,24 @@ before_install:
swig \ swig \
libvtk6-dev \ libvtk6-dev \
libmed-dev \ libmed-dev \
libmedc-dev libmedc-dev \
asciidoc
#Patch the system - there is a bug related to invalid location of libs on ubuntu 12.04 #Patch the system - there is a bug related to invalid location of libs on ubuntu 12.04
sudo ln -s /usr/lib/x86_64-linux-gnu/ /usr/lib/i386-linux-gnu sudo ln -s /usr/lib/x86_64-linux-gnu/ /usr/lib/i386-linux-gnu
sudo find /usr/lib -name libpq.so -exec ln -s {} /usr/lib/libpq.so ';' sudo find /usr/lib -name libpq.so -exec ln -s {} /usr/lib/libpq.so ';'
export DISPLAY=:99.0 export DISPLAY=:99.0
sh -e /etc/init.d/xvfb start sh -e /etc/init.d/xvfb start
CMAKE_ARGS="${CMAKE_OPTS} -DPYTHON_EXECUTABLE=/usr/bin/python" #Install ccache to reduce successive build times (use 3.2.5+ to avoid spurious warnings)
INSTALLED_APP_PATH="/usr/local/bin/FreeCAD" curl -L -o ccache.tgz "https://codeload.github.com/ccache/ccache/tar.gz/v3.2.5"
tar xvzf ccache.tgz && rm ccache.tgz && cd ccache-*
./autogen.sh && ./configure CC=gcc && sudo make install
cd ..
export CCACHE_CPP2=YES
export CMAKE_ARGS="${CMAKE_OPTS} -DPYTHON_EXECUTABLE=/usr/bin/python"
export INSTALLED_APP_PATH="/usr/local/bin/FreeCAD"
;; ;;
"osx") "osx")
@ -123,7 +140,8 @@ before_install:
orocos-kdl \ orocos-kdl \
hdf5 \ hdf5 \
homebrew/science/oce \ homebrew/science/oce \
homebrew/python/matplotlib homebrew/python/matplotlib \
ccache
brew install homebrew/science/nglib --with-oce brew install homebrew/science/nglib --with-oce
brew install sanelson/freecad/coin --without-framework --without-soqt brew install sanelson/freecad/coin --without-framework --without-soqt
brew install sanelson/freecad/pivy --HEAD brew install sanelson/freecad/pivy --HEAD
@ -140,8 +158,8 @@ before_install:
#Remove GDAL if installed because it results in non-existent dependent library exceptions #Remove GDAL if installed because it results in non-existent dependent library exceptions
if [ -e /usr/local/lib/libgdal.1.dylib ]; then brew unlink gdal; fi if [ -e /usr/local/lib/libgdal.1.dylib ]; then brew unlink gdal; fi
CMAKE_ARGS="${CMAKE_OPTS} -DFREECAD_USE_EXTERNAL_KDL=ON -DFREECAD_CREATE_MAC_APP=ON" export CMAKE_ARGS="${CMAKE_OPTS} -DFREECAD_USE_EXTERNAL_KDL=ON -DFREECAD_CREATE_MAC_APP=ON"
INSTALLED_APP_PATH="/usr/local/FreeCAD.app/Contents/bin/FreeCAD" export INSTALLED_APP_PATH="/usr/local/FreeCAD.app/Contents/bin/FreeCAD"
;; ;;
*) *)

View File

@ -23,6 +23,11 @@ if(COMMAND cmake_policy)
endif(POLICY CMP0045) endif(POLICY CMP0045)
endif(COMMAND cmake_policy) endif(COMMAND cmake_policy)
find_program(CCACHE_PROGRAM ccache) #This check should occur before project()
if(CCACHE_PROGRAM)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
endif()
# include local modules # include local modules
include(AddFileDependencies) include(AddFileDependencies)
include(cMake/FreeCadMacros.cmake) include(cMake/FreeCadMacros.cmake)