- Enable ccache for Travis CI
- GCC build on Travis CI actually chooses gcc as compiler (before, it was still clang somehow) - Disable GCC build on Travis because gcc on osx is broken
This commit is contained in:
parent
005d74c14e
commit
6de350c931
@ -2,7 +2,7 @@ language: cpp
|
||||
sudo: required
|
||||
dist: trusty
|
||||
compiler:
|
||||
- gcc
|
||||
# - gcc
|
||||
- clang
|
||||
os:
|
||||
#- linux
|
||||
@ -21,3 +21,4 @@ install:
|
||||
- .travisci/install.sh
|
||||
script:
|
||||
- .travisci/build_and_test.sh
|
||||
cache: ccache
|
||||
|
@ -1,6 +1,31 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
set -ev
|
||||
|
||||
# Use new clang on linux
|
||||
if [ "${TRAVIS_OS_NAME}" == "linux" ] && [ "$CXX" == "clang++" ]; then
|
||||
echo Switch to Clang 3.7
|
||||
export CXX="clang++-3.7" CC="clang-3.7"
|
||||
else
|
||||
echo Do not switch to Clang 3.7 because we are either not Linux or not Clang.
|
||||
fi
|
||||
|
||||
# If using gcc on mac, actually use it ("gcc" just links to clang, but "gcc-4.8" is gcc, https://github.com/travis-ci/travis-ci/issues/2423)
|
||||
# Note: This must be here and not in install.sh, because environment variables can't be passed between scripts.
|
||||
if [ "${TRAVIS_OS_NAME}" == "osx" ] && [ "${CXX}" == "g++" ]; then
|
||||
echo Switch to actual g++ and not just the AppleClang symlink
|
||||
export CXX="g++-7" CC="gcc-7"
|
||||
else
|
||||
echo Do not switch to actual g++ because we are either not osx or not g++
|
||||
fi
|
||||
|
||||
# Setup ccache
|
||||
export PATH="/usr/local/opt/ccache/libexec:$PATH"
|
||||
export CCACHE_COMPILERCHECK=content
|
||||
export CCACHE_COMPRESS=1
|
||||
export CCACHE_SLOPPINESS=include_file_mtime
|
||||
ccache --max-size=512M
|
||||
ccache --show-stats
|
||||
|
||||
# Detect number of CPU cores
|
||||
export NUMCORES=`grep -c ^processor /proc/cpuinfo`
|
||||
@ -9,6 +34,8 @@ if [ ! -n "$NUMCORES" ]; then
|
||||
fi
|
||||
echo Using $NUMCORES cores
|
||||
|
||||
echo Using CXX compiler $CXX and C compiler $CC
|
||||
|
||||
# Setup target directory
|
||||
mkdir cmake
|
||||
cd cmake
|
||||
@ -18,6 +45,8 @@ cmake --version
|
||||
cmake .. -DBUILD_TESTING=on -DCMAKE_BUILD_TYPE=Debug
|
||||
make -j$NUMCORES
|
||||
|
||||
ccache --show-stats
|
||||
|
||||
# Test
|
||||
./test/gitversion/gitversion-test
|
||||
./test/cpp-utils/cpp-utils-test
|
||||
|
@ -2,21 +2,19 @@
|
||||
|
||||
set -e
|
||||
|
||||
# Use new clang on linux
|
||||
if [ "${TRAVIS_OS_NAME}" == "linux" ] && [ "$CXX" = "clang++" ]; then
|
||||
export CXX="clang++-3.7" CC="clang-3.7"
|
||||
fi
|
||||
|
||||
# If using gcc on mac, actually use it ("gcc" just links to clang, but "gcc-4.8" is gcc, https://github.com/travis-ci/travis-ci/issues/2423)
|
||||
if [ "${TRAVIS_OS_NAME}" == "osx" ] && ["${CXX}" = "g++" ]; then
|
||||
export CXX="g++-4.8" CC="gcc-4.8"
|
||||
fi
|
||||
|
||||
# Install dependencies
|
||||
if [ "${TRAVIS_OS_NAME}" == "linux" ]; then
|
||||
./.travisci/install_boost.sh
|
||||
fi
|
||||
|
||||
# Install newer GCC if we're running on GCC osx
|
||||
if [ "${TRAVIS_OS_NAME}" == "osx" ] && [ "${CXX}" == "g++" ]; then
|
||||
# We need to uninstall oclint because it creates a /usr/local/include/c++ symlink that clashes with the gcc5 package
|
||||
# see https://github.com/Homebrew/homebrew-core/issues/21172
|
||||
brew cask uninstall oclint
|
||||
brew install gcc@7
|
||||
fi
|
||||
|
||||
if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
|
||||
brew cask install osxfuse
|
||||
brew install libomp
|
||||
@ -29,3 +27,6 @@ git fetch --unshallow
|
||||
if [ "${TRAVIS_OS_NAME}" == "linux" ]; then
|
||||
sudo cp -a /dev/urandom /dev/random
|
||||
fi
|
||||
|
||||
# Setup ccache
|
||||
brew install ccache
|
||||
|
Loading…
Reference in New Issue
Block a user