Merge branch 'add-travis-ci' of https://github.com/jlblancoc/gtsam into jlblancoc-add-travis-ci
						commit
						8906fa8da7
					
				|  | @ -0,0 +1,52 @@ | |||
| #!/bin/bash | ||||
| 
 | ||||
| set -e   # Make sure any error makes the script to return an error code | ||||
| set -x   # echo | ||||
| 
 | ||||
| SOURCE_DIR=`pwd` | ||||
| BUILD_DIR=build | ||||
| 
 | ||||
| #CMAKE_C_FLAGS="-Wall -Wextra -Wabi -O2" | ||||
| #CMAKE_CXX_FLAGS="-Wall -Wextra -Wabi -O2" | ||||
| 
 | ||||
| function build_and_test () | ||||
| { | ||||
|   #env | ||||
|   git clean -fd || true | ||||
|   rm -fr $BUILD_DIR || true | ||||
|   mkdir $BUILD_DIR && cd $BUILD_DIR | ||||
| 
 | ||||
|   if [ ! -z "$GCC_VERSION" ]; then | ||||
|     sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-$GCC_VERSION 60 \ | ||||
|                          --slave /usr/bin/g++ g++ /usr/bin/g++-$GCC_VERSION | ||||
|     sudo update-alternatives --set gcc /usr/bin/gcc-$GCC_VERSION | ||||
|   fi | ||||
| 
 | ||||
|   # gcc is too slow and we have a time limit in Travis CI: selective builds. | ||||
|   if [ "$BUILD_EXAMPLES" == "1" ]; then | ||||
|     GTSAM_BUILD_EXAMPLES_ALWAYS=ON | ||||
|   else | ||||
|     GTSAM_BUILD_EXAMPLES_ALWAYS=OFF | ||||
|   fi | ||||
|   if [ "$RUN_TESTS" == "1" ]; then | ||||
|     GTSAM_BUILD_TESTS=ON | ||||
|   else | ||||
|     GTSAM_BUILD_TESTS=OFF | ||||
|   fi | ||||
| 
 | ||||
|   cmake $SOURCE_DIR \ | ||||
|       -DGTSAM_BUILD_EXAMPLES_ALWAYS=$GTSAM_BUILD_EXAMPLES_ALWAYS \ | ||||
|       -DGTSAM_BUILD_TESTS=$GTSAM_BUILD_TESTS | ||||
| 
 | ||||
|   # Actual build: | ||||
|   make -j2 | ||||
| 
 | ||||
|   # Run tests: | ||||
|   if [ "$RUN_TESTS" == "1" ]; then | ||||
|     make check | ||||
|   fi | ||||
| 
 | ||||
|   cd $SOURCE_DIR | ||||
| } | ||||
| 
 | ||||
| build_and_test | ||||
|  | @ -0,0 +1,49 @@ | |||
| language: cpp | ||||
| cache: ccache | ||||
| sudo: required | ||||
| dist: xenial | ||||
| 
 | ||||
| addons: | ||||
|   apt: | ||||
|     sources: | ||||
|     - ubuntu-toolchain-r-test | ||||
|     packages: | ||||
|     - g++-8 | ||||
|     - clang-3.8 | ||||
|     - build-essential | ||||
|     - pkg-config | ||||
|     - cmake | ||||
|     - libpython-dev python-numpy | ||||
|     - libboost-all-dev | ||||
| 
 | ||||
| before_install: | ||||
|   - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update          ; fi | ||||
| 
 | ||||
| script: | ||||
|   - bash .travis.sh | ||||
| 
 | ||||
| env: | ||||
|   global: | ||||
|     - MAKEFLAGS="-j 2" | ||||
|     - CCACHE_SLOPPINESS=pch_defines,time_macros | ||||
| 
 | ||||
| matrix: | ||||
|   include: | ||||
|   - compiler: gcc | ||||
|     os: linux | ||||
|     env: BUILD_EXAMPLES=1 | ||||
|   - compiler: gcc | ||||
|     os: linux | ||||
|     env: RUN_TESTS=1 | ||||
|   - compiler: gcc | ||||
|     os: linux | ||||
|     env: BUILD_EXAMPLES=1 GCC_VERSION="8" | ||||
|   - compiler: clang | ||||
|     os: linux | ||||
|     env: BUILD_EXAMPLES=1 | ||||
|   - compiler: gcc | ||||
|     os: osx | ||||
|     env: BUILD_EXAMPLES=1 | ||||
|   - compiler: clang | ||||
|     os: osx | ||||
|     env: RUN_TESTS=1 | ||||
		Loading…
	
		Reference in New Issue