From ca94f64c7575121e4d82b06858632a1e267920a8 Mon Sep 17 00:00:00 2001 From: "Bruce B. Lacey" Date: Mon, 4 Jul 2016 15:17:58 -0700 Subject: [PATCH] Leverage ccache to reduce build times (both locally and on Travis-ci) --- .travis.yml | 32 +++++++++++++++++++++++++------- CMakeLists.txt | 5 +++++ 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 89b9bab74..f6b3e5ebc 100755 --- a/.travis.yml +++ b/.travis.yml @@ -23,10 +23,14 @@ env: matrix: - CMAKE_OPTS="-DBUILD_FEM_NETGEN=ON" +cache: + - ccache + language: cpp compiler: - clang + - gcc python: 2.7 @@ -37,6 +41,11 @@ os: dist: trusty sudo: required +matrix: + exclude: + - os: osx + compiler: gcc + git: depth: 1500 @@ -93,16 +102,24 @@ before_install: swig \ libvtk6-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 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 ';' export DISPLAY=:99.0 sh -e /etc/init.d/xvfb start - CMAKE_ARGS="${CMAKE_OPTS} -DPYTHON_EXECUTABLE=/usr/bin/python" - INSTALLED_APP_PATH="/usr/local/bin/FreeCAD" + #Install ccache to reduce successive build times (use 3.2.5+ to avoid spurious warnings) + 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") @@ -123,7 +140,8 @@ before_install: orocos-kdl \ hdf5 \ homebrew/science/oce \ - homebrew/python/matplotlib + homebrew/python/matplotlib \ + ccache brew install homebrew/science/nglib --with-oce brew install sanelson/freecad/coin --without-framework --without-soqt 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 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" - INSTALLED_APP_PATH="/usr/local/FreeCAD.app/Contents/bin/FreeCAD" + export CMAKE_ARGS="${CMAKE_OPTS} -DFREECAD_USE_EXTERNAL_KDL=ON -DFREECAD_CREATE_MAC_APP=ON" + export INSTALLED_APP_PATH="/usr/local/FreeCAD.app/Contents/bin/FreeCAD" ;; *) diff --git a/CMakeLists.txt b/CMakeLists.txt index b4aab7f40..ba8aae69d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,6 +23,11 @@ if(COMMAND cmake_policy) endif(POLICY CMP0045) 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(AddFileDependencies) include(cMake/FreeCadMacros.cmake)