diff --git a/.gitignore b/.gitignore index 0cc7e4b52..562b07afa 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +build/ CMakeCache.txt CMakeFiles CMakeScripts diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..f01f80edf --- /dev/null +++ b/.travis.yml @@ -0,0 +1,52 @@ +# Source: https://github.com/boostorg/hana/blob/master/.travis.yml + +# Sudo is required for installing recent versions of dependencies. +sudo: required + +# Use C++ build environment. +language: cpp + +# Protobuf requires g++ (see https://github.com/google/protobuf/blob/master/src/README.md) +compiler: + - gcc + +# Cache dependencies to speed up the build. +cache: + directories: + - ${TRAVIS_BUILD_DIR}/deps/cmake + - ${TRAVIS_BUILD_DIR}/deps/protobuf + +# Handle dependencies in separate directory. +before_install: + - DEPS_DIR="${TRAVIS_BUILD_DIR}/deps" + - mkdir -p "${DEPS_DIR}" + - cd "${DEPS_DIR}" + +install: + # Install a recent version of CMake + - | + CMAKE_URL="https://cmake.org/files/v3.7/cmake-3.7.2-Linux-x86_64.tar.gz" + mkdir -p cmake + travis_retry wget --no-check-certificate --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake + export PATH=${DEPS_DIR}/cmake/bin:${PATH} + + # Install a recent version of the Protobuf + - | + PROTOBUF_URL="https://github.com/google/protobuf/releases/download/v3.2.0/protobuf-cpp-3.2.0.tar.gz" + mkdir -p protobuf + travis_retry wget --no-check-certificate --quiet -O - ${PROTOBUF_URL} | tar --strip-components=1 -xz -C protobuf + cd protobuf + ./configure --prefix=/usr + make + sudo make install + +# Change directory back to default build directory. +before_script: + - cd "${TRAVIS_BUILD_DIR}" + +# Run the build script. +script: + - mkdir -p build + - cd build + - cmake .. + - cmake --build .