add travis testing (gcc5, clang36)

- also relaxed CMake version to 2.8.7, the version default in travis
This commit is contained in:
Tamas Kenez 2015-09-23 17:43:36 +02:00
parent 186001611a
commit 9b454b7a9b
4 changed files with 84 additions and 17 deletions

67
.travis.yml Normal file
View File

@ -0,0 +1,67 @@
# Based on https://github.com/ldionne/hana/blob/master/.travis.yml
language: cpp
sudo: false
matrix:
include:
- env: COMPILER=clang++-3.6 BUILD_TYPE=Debug CLANG=1
compiler: clang
addons: &clang36
apt:
packages:
- clang-3.6
- cmake
sources: &sources
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.6
- kalakris-cmake
- env: COMPILER=clang++-3.6 BUILD_TYPE=Release CLANG=1
compiler: clang
addons: *clang36
- env: COMPILER=g++-5 BUILD_TYPE=Debug
compiler: gcc
addons: &gcc5
apt:
packages: g++-5
sources: *sources
- env: COMPILER=g++-5 BUILD_TYPE=Release
compiler: gcc
addons: *gcc5
install:
- which $COMPILER
- DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
- mkdir ${DEPS_DIR} && cd ${DEPS_DIR}
- |
if [[ "$CLANG" == 1 && "${TRAVIS_OS_NAME}" == "linux" && "${STDLIB}" != "libstdc++" ]]; then
if [[ "${COMPILER}" == "clang++-3.5" ]]; then LLVM_VERSION="3.5.2"; fi
if [[ "${COMPILER}" == "clang++-3.6" ]]; then LLVM_VERSION="3.6.2"; fi
if [[ "${COMPILER}" == "clang++-3.7" ]]; then LLVM_VERSION="3.7.0"; fi
LLVM_URL="http://llvm.org/releases/${LLVM_VERSION}/llvm-${LLVM_VERSION}.src.tar.xz"
LIBCXX_URL="http://llvm.org/releases/${LLVM_VERSION}/libcxx-${LLVM_VERSION}.src.tar.xz"
LIBCXXABI_URL="http://llvm.org/releases/${LLVM_VERSION}/libcxxabi-${LLVM_VERSION}.src.tar.xz"
mkdir -p llvm llvm/build llvm/projects/libcxx llvm/projects/libcxxabi
travis_retry wget --quiet -O - ${LLVM_URL} | tar --strip-components=1 -xJ -C llvm
travis_retry wget --quiet -O - ${LIBCXX_URL} | tar --strip-components=1 -xJ -C llvm/projects/libcxx
travis_retry wget --quiet -O - ${LIBCXXABI_URL} | tar --strip-components=1 -xJ -C llvm/projects/libcxxabi
(cd llvm/build && cmake .. -DCMAKE_INSTALL_PREFIX=${DEPS_DIR}/llvm/install -DCMAKE_CXX_COMPILER=clang++)
(cd llvm/build/projects/libcxx && make install -j2)
(cd llvm/build/projects/libcxxabi && make install -j2)
export CXXFLAGS="-I ${DEPS_DIR}/llvm/install/include/c++/v1"
export LDFLAGS="-L ${DEPS_DIR}/llvm/install/lib -l c++ -l c++abi"
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${DEPS_DIR}/llvm/install/lib"
fi
before_script:
- cd ${TRAVIS_BUILD_DIR}
- git clone --depth 1 https://github.com/Microsoft/unittest-cpp tests/unittest-cpp
- cmake -H. -Bb -DCMAKE_CXX_COMPILER=$COMPILER -DCMAKE_INSTALL_PREFIX=$PWD/o -DCMAKE_BUILD_TYPE=$BUILD_TYPE
- cmake --build b
script:
- cd b
- ctest
notifications:
email: false

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.2.2) cmake_minimum_required(VERSION 2.8.7)
project(GSL) project(GSL CXX)
include_directories( include_directories(
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}

View File

@ -1,4 +1,4 @@
# GSL: Guidelines Support Library # GSL: Guidelines Support Library [![Build Status](https://travis-ci.org/Microsoft/GSL.svg?branch=master)](https://travis-ci.org/Microsoft/GSL)
The Guidelines Support Library (GSL) contains functions and types that are suggested for use by the The Guidelines Support Library (GSL) contains functions and types that are suggested for use by the
[C++ Core Guidelines](https://github.com/isocpp/CppCoreGuidelines) maintained by the [Standard C++ Foundation](https://isocpp.org). [C++ Core Guidelines](https://github.com/isocpp/CppCoreGuidelines) maintained by the [Standard C++ Foundation](https://isocpp.org).
@ -33,7 +33,7 @@ contributing any changes that were necessary back to this project to benefit the
## Building the tests ## Building the tests
To build the tests, you will require the following: To build the tests, you will require the following:
* [CMake](http://cmake.org), version 3.3 or later to be installed and in your PATH. * [CMake](http://cmake.org), version 2.8.7 or later to be installed and in your PATH.
* [UnitTest-cpp](https://github.com/Microsoft/unittest-cpp), to be cloned under the [tests/unittest-cpp](./tests/unittest-cpp) directory * [UnitTest-cpp](https://github.com/Microsoft/unittest-cpp), to be cloned under the [tests/unittest-cpp](./tests/unittest-cpp) directory
of your GSL source. of your GSL source.

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.2.2) cmake_minimum_required(VERSION 2.8.7)
project(GSLTests) project(GSLTests CXX)
add_subdirectory(unittest-cpp) add_subdirectory(unittest-cpp)
@ -23,7 +23,7 @@ else()
elseif(COMPILER_SUPPORTS_CXX11) elseif(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
else() else()
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.") message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif() endif()
endif() endif()
@ -38,8 +38,8 @@ function(add_gsl_test name)
RUNTIME DESTINATION bin RUNTIME DESTINATION bin
) )
add_test( add_test(
NAME ${name} ${name}
COMMAND ${name} ${name}
) )
endfunction() endfunction()