Skip to content

Commit

Permalink
CI: install latest CMake
Browse files Browse the repository at this point in the history
  • Loading branch information
chfast committed Jan 12, 2017
1 parent e4d1200 commit d8358d9
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 7 deletions.
4 changes: 1 addition & 3 deletions .travis.yml
Expand Up @@ -19,10 +19,8 @@ cache:
directories: build/llvm


before_install:
- cmake --version

script:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then scripts/install_cmake.sh; fi
- scripts/build.sh
- cd build && ctest
- cd ..
Expand Down
6 changes: 2 additions & 4 deletions circle.yml
@@ -1,9 +1,7 @@
dependencies:
pre:
- sudo apt-add-repository -y ppa:george-edison55/cmake-3.x
- sudo apt -q update
- sudo apt -qy install cmake
override:
- scripts/install_cmake.sh
- export PATH=~/.local/bin:$PATH
- BUILD_TYPE=RelWithDebInfo scripts/build.sh
cache_directories:
# TODO: add ccache
Expand Down
37 changes: 37 additions & 0 deletions scripts/install_cmake.sh
@@ -0,0 +1,37 @@
#!/usr/bin/env sh

# This script downloads the CMake binary and installs it in ~/.local directory
# (the cmake executable will be in ~/.local/bin).
# This is mostly suitable for CIs, not end users.

set -e

VERSION=3.7.1
PREFIX=~/.local

OS=$(uname -s)
case $OS in
Linux) SHA256=7b4b7a1d9f314f45722899c0521c261e4bfab4a6b532609e37fef391da6bade2;;
Darwin) SHA256=1851d1448964893fdc5a8c05863326119f397a3790e0c84c40b83499c7960267;;
esac


BIN=$PREFIX/bin

if test -f $BIN/cmake && ($BIN/cmake --version | grep -q "$VERSION"); then
echo "CMake $VERSION already installed in $BIN"
else
FILE=cmake-$VERSION-$OS-x86_64.tar.gz
URL=https://cmake.org/files/v3.7/$FILE
ERROR=0
TMPFILE=$(mktemp --tmpdir cmake-$VERSION-$OS-x86_64.XXXXXXXX.tar.gz)
echo "Downloading CMake ($URL)..."
wget "$URL" -O "$TMPFILE" -nv
if ! (shasum -a256 "$TMPFILE" | grep -q "$SHA256"); then
echo "Checksum mismatch ($TMPFILE)"
exit 1
fi
mkdir -p "$PREFIX"
tar xzf "$TMPFILE" -C "$PREFIX" --strip 1
rm $TMPFILE
fi

0 comments on commit d8358d9

Please sign in to comment.