From aa6b838a5b6880c40ca8d9dbe72846c5812e5f93 Mon Sep 17 00:00:00 2001 From: tbaudier Date: Tue, 17 Jan 2017 15:46:31 +0100 Subject: [PATCH] Add travis files VTK compilation on travis --- .travis.yml | 80 ++++++++++++++++++++++++++++++++ travis/travis_build_itk.sh | 34 ++++++++++++++ travis/travis_build_qt.sh | 21 +++++++++ travis/travis_build_vtk.sh | 95 ++++++++++++++++++++++++++++++++++++++ travis/travis_build_vv.sh | 18 ++++++++ 5 files changed, 248 insertions(+) create mode 100644 .travis.yml create mode 100755 travis/travis_build_itk.sh create mode 100755 travis/travis_build_qt.sh create mode 100755 travis/travis_build_vtk.sh create mode 100755 travis/travis_build_vv.sh diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..47b7f33 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,80 @@ +git: + depth: 1 + +sudo: required + +dist: trusty + +os: + - osx + - linux +compiler: + - gcc + - clang +env: + - WITH_CMAKE=true VTK_VERSION=7.0.0 ITK_VERSION=4.9.1 QT_VERSION=5.5.1 + - WITH_CMAKE=true VTK_VERSION=7.0.0 ITK_VERSION=4.9.1 QT_VERSION=4.8.7 + - WITH_CMAKE=true VTK_VERSION=6.3 ITK_VERSION=4.9.1 QT_VERSION=5.5.1 + - WITH_CMAKE=true VTK_VERSION=6.3 ITK_VERSION=4.9.1 QT_VERSION=4.8.7 + - WITH_CMAKE=true VTK_VERSION=6.0 ITK_VERSION=4.5 QT_VERSION=4.8.7 + +matrix: + exclude: + - os: osx + env: WITH_CMAKE=true VTK_VERSION=6.0 ITK_VERSION=4.5 QT_VERSION=4.8.7 #VTK6.0 doesn't work with osX + +language: cpp + +notifications: + email: + on_success: never + on_failure: never + +before_install: +- if test $TRAVIS_OS_NAME == osx ; then brew update; fi +- if test $TRAVIS_OS_NAME == linux ; then sudo add-apt-repository --yes ppa:kubuntu-ppa/backports; fi +- if test $TRAVIS_OS_NAME == linux ; then sudo apt-get update -qq; fi +- if test $TRAVIS_OS_NAME == linux ; then sudo apt-get install --reinstall ca-certificates; fi +- export NUM_THREADS=2 +- export cwd=$(pwd) +- export SCRIPTS=$cwd/travis +- export EXTERNALS_DIR=$HOME +- export VTK_SOURCE_DIR=${EXTERNALS_DIR}/vtk-${VTK_VERSION} +- export VTK_DIR=${EXTERNALS_DIR}/vtk-${VTK_VERSION}-build +- export ITK_SOURCE_DIR=${EXTERNALS_DIR}/itk-${ITK_VERSION} +- export ITK_DIR=${EXTERNALS_DIR}/itk-${ITK_VERSION}-build +- export BUILD_DIR=$cwd/build + +install: +- if test $TRAVIS_OS_NAME == linux ; then sudo apt-get install -y -qq build-essential cmake; fi +#Install qt5 +- $SCRIPTS/travis_build_qt.sh +- if test $TRAVIS_OS_NAME == linux; then sudo apt-get -y install libgdcm2-dev libpq-dev; fi +- if test $TRAVIS_OS_NAME == linux; then if [[ "$QT_VERSION" == "5.5.1" ]] ; then QTDIR="/opt/qt55" && PATH="$PATH:$QTDIR/bin" && qt55-env.sh ; fi; fi +- if test $TRAVIS_OS_NAME == osx ; then export HOMEBREW_QT_VERSION=$(brew list --versions qt | rev | cut -d' ' -f1 | rev); fi +- if test $TRAVIS_OS_NAME == osx ; then ln -s /usr/local/Cellar/qt5/$HOMEBREW_QT_VERSION/mkspecs /usr/local/mkspecs; fi +- if test $TRAVIS_OS_NAME == osx ; then ln -s /usr/local/Cellar/qt5/$HOMEBREW_QT_VERSION/plugins /usr/local/plugins; fi +- if test $TRAVIS_OS_NAME == osx ; then qmake -v; fi + +cache: + - directories: + - $HOME/vtk-6.0 + - $HOME/vtk-6.0-build + - $HOME/vtk-6.3 + - $HOME/vtk-6.3-build + - $HOME/vtk-7.0.0 + - $HOME/vtk-7.0.0-build + - $HOME/itk-4.5 + - $HOME/itk-4.5-build + - $HOME/itk-4.9.1 + - $HOME/itk-4.9.1-build + +before_script: +- if test $TRAVIS_OS_NAME == linux ; then sudo ln -s /usr/bin/x86_64-linux-gnu/libpq.so /usr/bin/libpq.so; fi +- $SCRIPTS/travis_build_vtk.sh +#- $SCRIPTS/travis_build_itk.sh +#Install vtk and itk (different version) + +script: +- echo "coucou"; +#- $SCRIPTS/travis_build_vv.sh diff --git a/travis/travis_build_itk.sh b/travis/travis_build_itk.sh new file mode 100755 index 0000000..5bcc4c0 --- /dev/null +++ b/travis/travis_build_itk.sh @@ -0,0 +1,34 @@ +#!/bin/bash +set -ev +MAKE="make --jobs=$NUM_THREADS --keep-going" + +#Prepare cmake arguments following the ITK version +if [ "$ITK_VERSION" == "4.5" ]; then +itk_repo_str=" --branch v4.5.0 https://github.com/InsightSoftwareConsortium/ITK.git --depth 1" +cmake_arg_str=" -DModule_ITKVtkGlue=ON -DVTK_DIR=$VTK_DIR -DModule_ITKReview=ON -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF " +elif [ "$ITK_VERSION" == "4.9.1" ]; then +itk_repo_str=" --branch v4.9.1 https://github.com/InsightSoftwareConsortium/ITK.git --depth 1" +cmake_arg_str=" -DModule_ITKVtkGlue=ON -DVTK_DIR=$VTK_DIR -DModule_ITKReview=ON -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF " +fi + +if [ -d $ITK_SOURCE_DIR ]; then +echo $ITK_SOURCE_DIR exists +if [ ! -f $ITK_SOURCE_DIR/CMakeLists.txt ]; then +echo $ITK_SOURCE_DIR does not contain CMakeList.txt +rm -rf $ITK_SOURCE_DIR +fi +fi + +#git clone in the ITK source folder +if [ ! -d $ITK_SOURCE_DIR ]; then +git clone $itk_repo_str $ITK_SOURCE_DIR +fi + +#CMAKE and MAKE +mkdir -p $ITK_DIR +cd $ITK_DIR +cmake $cmake_arg_str $ITK_SOURCE_DIR +$MAKE +cd - + +cd $cwd diff --git a/travis/travis_build_qt.sh b/travis/travis_build_qt.sh new file mode 100755 index 0000000..2bd9a31 --- /dev/null +++ b/travis/travis_build_qt.sh @@ -0,0 +1,21 @@ +#!/bin/bash +set -ev + +#Install the correct Qt Version +if [ "$QT_VERSION" == "4.8.7" ]; then + if test $TRAVIS_OS_NAME == linux ; then sudo apt-get -y --force-yes install qt4-dev-tools; fi + + if test $TRAVIS_OS_NAME == osx ; then brew install cartr/qt4/qt; fi + if test $TRAVIS_OS_NAME == osx ; then brew link qt --force; fi + if test $TRAVIS_OS_NAME == osx ; then qmake -v; fi +elif [ "$QT_VERSION" == "5.5.1" ]; then + if test $TRAVIS_OS_NAME == linux ; then sudo add-apt-repository --yes ppa:beineri/opt-qt551-trusty; fi + if test $TRAVIS_OS_NAME == linux ; then sudo apt-get update -qq; fi + if test $TRAVIS_OS_NAME == linux ; then sudo apt-get -y --force-yes install qt55tools; fi + + if test $TRAVIS_OS_NAME == osx ; then brew install qt5; fi + if test $TRAVIS_OS_NAME == osx ; then brew link qt5 --force; fi + if test $TRAVIS_OS_NAME == osx ; then brew linkapps qt5; fi +fi + + diff --git a/travis/travis_build_vtk.sh b/travis/travis_build_vtk.sh new file mode 100755 index 0000000..14649bc --- /dev/null +++ b/travis/travis_build_vtk.sh @@ -0,0 +1,95 @@ +#!/bin/bash +set -ev +MAKE="make --jobs=$NUM_THREADS --keep-going" + +if [ "$QT_VERSION" == "4.8.7" ]; then + QT_MAJOR_VERSION=4 +elif [ "$QT_VERSION" == "5.5.1" ]; then + QT_MAJOR_VERSION=5 +fi + +#Prepare cmake arguments following the VTK version +if [ "$VTK_VERSION" == "6.0" ]; then +vtk_repo_str=" --branch v6.0.0 https://github.com/Kitware/VTK.git --depth 1" +cmake_arg_str=" $cmake_arg_str + -DBUILD_SHARED_LIBS=1 + -DCMAKE_BUILD_TYPE=Release + -DBUILD_TESTING=0 + -DBUILD_EXAMPLES=0 + -DBUILD_DOCUMENTATION=0 + -DVTK_Group_StandAlone=ON + -DVTK_Group_Imaging=OFF + -DVTK_Group_MPI=OFF + -DVTK_Group_Rendering=ON + -DVTK_Group_Tk=OFF + -DVTK_Group_Views=OFF + -DVTK_Group_Web=OFF + -DModule_vtkGUISupportQt=ON + -DModule_vtkGUISupportQtOpenGL=ON + -DModule_vtkGUISupportQtSQL=ON + -DModule_vtkRenderingQt=ON + -DModule_vtkViewsQt=ON + -DVTK_QT_VERSION="$QT_MAJOR_VERSION" " +elif [ "$VTK_VERSION" == "6.3" ]; then +vtk_repo_str=" --branch v6.3.0 https://github.com/Kitware/VTK.git --depth 1" +cmake_arg_str=" $cmake_arg_str + -DBUILD_SHARED_LIBS=1 + -DCMAKE_BUILD_TYPE=Release + -DBUILD_TESTING=0 + -DBUILD_EXAMPLES=0 + -DBUILD_DOCUMENTATION=0 + -DVTK_Group_StandAlone=ON + -DVTK_Group_Imaging=OFF + -DVTK_Group_MPI=OFF + -DVTK_Group_Rendering=ON + -DVTK_Group_Tk=OFF + -DVTK_Group_Views=OFF + -DVTK_Group_Web=OFF + -DModule_vtkGUISupportQt=ON + -DModule_vtkGUISupportQtOpenGL=ON + -DModule_vtkGUISupportQtSQL=ON + -DModule_vtkRenderingQt=ON + -DModule_vtkViewsQt=ON + -DVTK_QT_VERSION="$QT_MAJOR_VERSION" " +elif [ "$VTK_VERSION" == "7.0.0" ]; then +vtk_repo_str=" --branch v7.0.0 https://github.com/Kitware/VTK.git --depth 1" +cmake_arg_str=" $cmake_arg_str + -DBUILD_SHARED_LIBS=1 + -DCMAKE_BUILD_TYPE=Release + -DBUILD_TESTING=0 + -DBUILD_EXAMPLES=0 + -DBUILD_DOCUMENTATION=0 + -DVTK_Group_StandAlone=ON + -DVTK_Group_Imaging=OFF + -DVTK_Group_MPI=OFF + -DVTK_Group_Rendering=ON + -DVTK_Group_Tk=OFF + -DVTK_Group_Views=OFF + -DVTK_Group_Web=OFF + -DVTK_RENDERING_BACKEND=OpenGL + -DModule_vtkGUISupportQt=ON + -DModule_vtkGUISupportQtOpenGL=ON + -DModule_vtkGUISupportQtSQL=ON + -DModule_vtkRenderingQt=ON + -DModule_vtkViewsQt=ON + -DVTK_QT_VERSION="$QT_MAJOR_VERSION" " +fi + +if [ -d $VTK_SOURCE_DIR ]; then +echo $VTK_SOURCE_DIR exists +if [ ! -f $VTK_SOURCE_DIR/CMakeLists.txt ]; then +echo $VTK_SOURCE_DIR does not contain CMakeList.txt +rm -rf $VTK_SOURCE_DIR +fi +fi + +#git clone in the VTK source folder +if [ ! -d "$VTK_SOURCE_DIR" ]; then +git clone $vtk_repo_str ${VTK_SOURCE_DIR} +fi + +#CMAKE and MAKE +mkdir -p ${VTK_DIR} +cd ${VTK_DIR} +cmake $cmake_arg_str ${VTK_SOURCE_DIR} +$MAKE diff --git a/travis/travis_build_vv.sh b/travis/travis_build_vv.sh new file mode 100755 index 0000000..797b03c --- /dev/null +++ b/travis/travis_build_vv.sh @@ -0,0 +1,18 @@ +#!/bin/bash +set -ev +MAKE="make --jobs=$NUM_THREADS --keep-going" + +#Prepare cmake arguments following the vv version +cmake_arg_str=" -DCLITK_BUILD_REGISTRATION=OFF +-DCLITK_BUILD_SEGMENTATION=OFF +-DCLITK_BUILD_TOOLS=OFF +-DCLITK_BUILD_VV=ON +-DCLITK_EXPERIMENTAL=OFF" + +#CMAKE and MAKE +mkdir -p $BUILD_DIR +cd $BUILD_DIR +cmake $cmake_arg_str .. +$MAKE +cd - +cd $cwd -- 2.47.1