Switch clang-4.0 build to trusty; cache libc++

This uses the trusty container rather than docker for the clang 4.0
build.  It also caches the local libc++ installation so that it doesn't
need to be compiled every time, which should speed up the job
considerably.
This commit is contained in:
Jason Rhinelander 2017-04-14 16:53:14 -04:00
parent 3d5005168b
commit f0c7c00815

View File

@ -23,9 +23,12 @@ matrix:
- sudo: true - sudo: true
services: docker services: docker
env: PYTHON=3.5 CPP=17 GCC=7 env: PYTHON=3.5 CPP=17 GCC=7
- sudo: true - os: linux
services: docker env: PYTHON=3.6 CPP=17 CLANG=4.0
env: PYTHON=3.5 CPP=17 CLANG=4.0 addons:
apt:
sources: [deadsnakes, llvm-toolchain-trusty-4.0]
packages: [python3.6-dev python3.6-venv clang-4.0 llvm-4.0-dev]
- os: osx - os: osx
osx_image: xcode7.3 osx_image: xcode7.3
env: PYTHON=2.7 CPP=14 CLANG env: PYTHON=2.7 CPP=14 CLANG
@ -76,27 +79,27 @@ matrix:
- flake8 - flake8
allow_failures: allow_failures:
- env: PYTHON=3.5 CPP=17 GCC=7 - env: PYTHON=3.5 CPP=17 GCC=7
- env: PYTHON=3.5 CPP=17 CLANG=4.0 - env: PYTHON=3.6 CPP=17 CLANG=4.0
cache: cache:
directories: directories:
- $HOME/.local/bin - $HOME/.local/bin
- $HOME/.local/lib - $HOME/.local/lib
- $HOME/.local/include
- $HOME/Library/Python - $HOME/Library/Python
before_install: before_install:
- | - |
# Configure build variables # Configure build variables
if [ "$TRAVIS_OS_NAME" = "linux" ]; then if [ "$TRAVIS_OS_NAME" = "linux" ]; then
if [ -n "$CLANG" ]; then if [ -n "$CLANG" ]; then
export CXX=clang++-$CLANG CC=clang-$CLANG COMPILER_PACKAGES="clang-$CLANG llvm-$CLANG-dev" export CXX=clang++-$CLANG CC=clang-$CLANG
if [ "$CLANG" = "4.0" ]; then export CXXFLAGS="-stdlib=libc++"; fi COMPILER_PACKAGES="clang-$CLANG llvm-$CLANG-dev"
else else
if [ -z "$GCC" ]; then export GCC=4.8 if [ -z "$GCC" ]; then export GCC=4.8
else export COMPILER_PACKAGES=g++-$GCC else export COMPILER_PACKAGES=g++-$GCC
fi fi
export CXX=g++-$GCC CC=gcc-$GCC export CXX=g++-$GCC CC=gcc-$GCC
fi fi
if [ "$CLANG" = "4.0" ]; then export DOCKER=debian:sid if [ "$GCC" = "6" ] || [ "$CLANG" = "3.9" ]; then export DOCKER=${ARCH:+$ARCH/}debian:testing
elif [ "$GCC" = "6" ] || [ -n "$CLANG" ]; then export DOCKER=${ARCH:+$ARCH/}debian:testing
elif [ "$GCC" = "7" ]; then export DOCKER=debian:experimental APT_GET_EXTRA="-t experimental" elif [ "$GCC" = "7" ]; then export DOCKER=debian:experimental APT_GET_EXTRA="-t experimental"
fi fi
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
@ -113,7 +116,6 @@ before_install:
export containerid=$(docker run --detach --tty \ export containerid=$(docker run --detach --tty \
--volume="$PWD":/pybind11 --workdir=/pybind11 \ --volume="$PWD":/pybind11 --workdir=/pybind11 \
--env="CXXFLAGS=$CXXFLAGS" \
--env="CC=$CC" --env="CXX=$CXX" --env="DEBIAN_FRONTEND=$DEBIAN_FRONTEND" \ --env="CC=$CC" --env="CXX=$CXX" --env="DEBIAN_FRONTEND=$DEBIAN_FRONTEND" \
--env=GCC_COLORS=\ \ --env=GCC_COLORS=\ \
$DOCKER) $DOCKER)
@ -153,21 +155,30 @@ install:
apt-get -qy --no-install-recommends $APT_GET_EXTRA install \ apt-get -qy --no-install-recommends $APT_GET_EXTRA install \
$PY_DEBUG python$PY-dev python$PY-pytest python$PY-scipy \ $PY_DEBUG python$PY-dev python$PY-pytest python$PY-scipy \
libeigen3-dev cmake make ${COMPILER_PACKAGES} && break; done" libeigen3-dev cmake make ${COMPILER_PACKAGES} && break; done"
else
if [ "$CLANG" = "4.0" ]; then if [ "$CLANG" = "4.0" ]; then
# Neither debian nor llvm provide a libc++ deb; luckily it's fairly quick if ! [ -d ~/.local/include/c++/v1 ]; then
# to build and install, so do it ourselves: # Neither debian nor llvm provide a libc++ 4.0 deb; luckily it's fairly quick
git clone --depth=1 https://github.com/llvm-mirror/llvm.git llvm-source # to build, install (and cache), so do it ourselves:
git clone https://github.com/llvm-mirror/libcxx.git llvm-source/projects/libcxx -b release_40 git clone --depth=1 https://github.com/llvm-mirror/llvm.git llvm-source
git clone https://github.com/llvm-mirror/libcxxabi.git llvm-source/projects/libcxxabi -b release_40 git clone https://github.com/llvm-mirror/libcxx.git llvm-source/projects/libcxx -b release_40
$SCRIPT_RUN_PREFIX sh -c "mkdir llvm-build && cd llvm-build && \ git clone https://github.com/llvm-mirror/libcxxabi.git llvm-source/projects/libcxxabi -b release_40
CXXFLAGS= cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr ../llvm-source && \ mkdir llvm-build && cd llvm-build
make -j2 install-cxxabi install-cxx && \ # Building llvm requires a newer cmake than is provided by the trusty container:
cp -a include/c++/v1/*cxxabi*.h /usr/include/c++/v1" CMAKE=cmake-3.8.0-Linux-x86_64
curl https://cmake.org/files/v3.8/$CMAKE.tar.gz | tar xz
if [ "$CPP" = "-std=c++17" ]; then export CPP="-std=c++1z"; fi ./$CMAKE/bin/cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/.local ../llvm-source
make -j2 install-cxxabi install-cxx
cp -a include/c++/v1/*cxxabi*.h ~/.local/include/c++/v1
cd ..
fi
export CXXFLAGS="-isystem $HOME/.local/include/c++/v1 -stdlib=libc++"
export LDFLAGS="-L$HOME/.local/lib"
export LD_LIBRARY_PATH="$HOME/.local/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
if [ "$CPP" = "-std=c++17" ]; then CPP="-std=c++1z"; fi
fi fi
else
export NPY_NUM_BUILD_JOBS=2 export NPY_NUM_BUILD_JOBS=2
echo "Installing pytest, numpy, scipy..." echo "Installing pytest, numpy, scipy..."
${PYPY:+travis_wait 30} $PY_CMD -m pip install --user --upgrade --quiet pytest numpy scipy ${PYPY:+travis_wait 30} $PY_CMD -m pip install --user --upgrade --quiet pytest numpy scipy
@ -175,7 +186,7 @@ install:
wget -q -O eigen.tar.gz https://bitbucket.org/eigen/eigen/get/3.3.3.tar.gz wget -q -O eigen.tar.gz https://bitbucket.org/eigen/eigen/get/3.3.3.tar.gz
tar xzf eigen.tar.gz tar xzf eigen.tar.gz
export CMAKE_EXTRA_ARGS="${CMAKE_EXTRA_ARGS} -DCMAKE_INCLUDE_PATH=$PWD/eigen-eigen-67e894c6cd8f" export CMAKE_INCLUDE_PATH="${CMAKE_INCLUDE_PATH:+:}$PWD/eigen-eigen-67e894c6cd8f"
fi fi
set +e set +e
script: script: