X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=dependencies%2FcpPlugins_Install_VTK.sh;fp=dependencies%2FcpPlugins_Install_VTK.sh;h=0000000000000000000000000000000000000000;hb=2e142df11d6f312a2a2b5097b8da73571ed523e8;hp=9c5776aa178639be3d1388ba2785b0e64f4ad41f;hpb=61b3659afe961ed248f30e26f9ca8f28fcfafddc;p=cpPlugins.git diff --git a/dependencies/cpPlugins_Install_VTK.sh b/dependencies/cpPlugins_Install_VTK.sh deleted file mode 100755 index 9c5776a..0000000 --- a/dependencies/cpPlugins_Install_VTK.sh +++ /dev/null @@ -1,256 +0,0 @@ -#!/bin/bash - -## ------------------------------------------------------------------------- -function abspath() -{ - pushd . > /dev/null - if [ -d "$1" ]; then - cd "$1" - dirs -l +0 - else - cd "`dirname \"$1\"`" - cur_dir=`dirs -l +0` - if [ "$cur_dir" == "/" ]; then - echo "$cur_dir`basename \"$1\"`" - else - echo "$cur_dir/`basename \"$1\"`" - fi - fi - popd > /dev/null -} - -## ------------------------------------------------------------------------- -function get_file_extension -{ - valid_extensions=("zip" "tar" "tar.gz" "tar.bz2") - actual_file=`abspath $1` - actual_ext="" - for ext in ${valid_extensions[@]}; do - test_str=`dirname $actual_file`/`basename $actual_file $ext` - if [ $test_str != $actual_file ]; then - actual_ext=$ext - fi - done - echo "$actual_ext" -} - -## ------------------------------------------------------------------------- -function print_help() -{ - echo "Usage: `basename $0` -f=compressed_code -c=source_dir -b=build_dir [-p=instalation_prefix] [-q=qmake_executable] [-m=cmake_executable] [-t=build_type[MinSizeRel/Debug/Release]]" -} - -## ------------------------------------------------------------------------- -## Analyze command-line arguments -if [ $# -eq 0 ]; then - print_help - exit 1 -fi -prefix="${HOME}/local" -build_type="MinSizeRel" -for i in "$@"; do - case $i in - -f=*|--file=*) - source_file="${i#*=}" - shift - ;; - -c=*|--source_dir=*) - source_dir="${i#*=}" - shift - ;; - -b=*|--build_dir=*) - build_dir="${i#*=}" - shift - ;; - -t=*|--build_type=*) - build_type="${i#*=}" - shift - ;; - -p=*|--prefix=*) - prefix="${i#*=}" - shift - ;; - -m=*|--cmake=*) - cmake_exec="${i#*=}" - shift - ;; - -q=*|--qmake=*) - qmake_exec="${i#*=}" - shift - ;; - *) - ;; - esac -done - -## Check command line arguments -if [ "x$source_dir" == "x" ]; then - if [ "x$source_file" != "x" ]; then - base_path=`abspath $source_file` - base_ext=`get_file_extension $base_path` - base_dir=`dirname $base_path` - if [ "x$base_ext" != "x" ]; then - source_dir="$base_dir"/`basename $base_path .$base_ext` - else - echo "Error: Input compressed file extension not recognized." - exit 1 - fi - else - print_help - exit 1 - fi -fi -if [ "x$build_dir" == "x" ]; then - if [ "x$source_dir" != "x" ]; then - base_dir=$source_dir - if [ "${source_dir:$((${#str}-1)):1}" == "/" ]; then - base_dir=`echo $source_dir | rev | cut -c 2- | rev` - fi - build_dir="$base_dir-build" - else - print_help - exit 1 - fi -fi - -## Locate cmake executable -if [ "x$cmake_exec" == "x" ]; then - cmake_locations=("/usr/bin" "/usr/local/bin" "${HOME}/local/bin") - cmake_ver="" - for loc in ${cmake_locations[@]}; do - cmake_file="$loc/cmake" - if [ -x $cmake_file ]; then - str=`$cmake_file --version | grep version` - version=${str:14} - if [ "$cmake_ver" \< "$version" ]; then - cmake_ver=$version - cmake_exec=$cmake_file - fi - fi - done -fi -if [ ! -x $cmake_exec ]; then - echo "ERROR: no valid cmake found." - exit 1 -fi -cmake_exec=`abspath $cmake_exec` - -# Locate qmake executable -if [ "x$qmake_exec" == "x" ]; then - qmake_locations=("/usr/bin" "/usr/local/bin" "${HOME}/local/bin") - for loc in ${qmake_locations[@]}; do - qmake_file="$loc/qmake" - if [ -x $qmake_file ]; then - version=`$qmake_file --version | grep Using\ Qt\ version | cut -d ' ' -f 4` - if [ "${version:0:3}" == "4.8" ]; then - qmake_exec=$qmake_file - fi - fi - done -fi -qmake_exec=`abspath $qmake_exec` -if [ -x $qmake_exec ]; then - use_qt="1" -else - use_qt="0" -fi - -## Other configuration variables -platform=`uname` -number_of_cores=`grep -c ^processor /proc/cpuinfo` -number_of_threads=`expr $number_of_cores / 2` -if [ "x$source_file" != "x" ]; then - source_file=`abspath $source_file` -fi -source_dir=`abspath $source_dir` -build_dir=`abspath $build_dir` - -echo "=====================================================================" -echo "==> Source file : $source_file" -echo "==> Source dir : $source_dir" -echo "==> Build dir : $build_dir" -echo "==> Build type : $build_type" -echo "==> Prefix : $prefix" -echo "==> cmake : $cmake_exec" -echo "==> qmake : $qmake_exec" -echo "==> Use Qt : $use_qt" -echo "==> Platform : $platform" -echo "==> Number of cores : $number_of_cores" -echo "==> Number of threads : $number_of_threads" -echo "=====================================================================" -read -n1 -r -p "Continue? [Y/N]... " key -echo -if [ "$key" != 'Y' -a "$key" != 'y' ] ; then - exit 1 -fi - -## Create paths -if [ "x$source_file" != "x" ]; then - echo -n "==> Cleaning directories... " - rm -rf $source_dir - rm -rf $build_dir - echo "done." - echo -n "==> Creating directories... " - mkdir -p $source_dir - mkdir -p $build_dir - echo "done." -fi - -## Extract source code -if [ "x$source_file" != "x" ]; then - echo -n "==> Extracting sources... " - base_path=`abspath $source_file` - base_ext=`get_file_extension $base_path` - if [ "$base_ext" == "zip" ]; then - echo unzip $base_path - elif [ "$base_ext" == "tar" ]; then - tar xf $base_path -C $source_dir --strip-components=1 - elif [ "$base_ext" == "tar.gz" ]; then - tar xzf $base_path -C $source_dir --strip-components=1 - elif [ "$base_ext" == "tar.bz2" ]; then - tar xjf $base_path -C $source_dir --strip-components=1 - fi - echo "done." -fi - -echo "==> Configuring sources... " -cd $build_dir -if [ "$use_qt" == "1" ]; then - $cmake_exec \ - -DCMAKE_CXX_FLAGS:STRING=-std=c++11 \ - -DBUILD_DOCUMENTATION:BOOL=OFF \ - -DBUILD_EXAMPLES:BOOL=OFF \ - -DBUILD_SHARED_LIBS:BOOL=ON \ - -DBUILD_TESTING:BOOL=OFF \ - -DQT_QMAKE_EXECUTABLE:PATH=$qmake_exec \ - -DCMAKE_BUILD_TYPE:STRING=$build_type \ - -DModule_vtkGUISupportQt:BOOL=ON \ - -DModule_vtkGUISupportQtOpenGL:BOOL=ON \ - -DModule_vtkGUISupportQtSQL:BOOL=OFF \ - -DModule_vtkGUISupportQtWebkit:BOOL=OFF \ - -DCMAKE_INSTALL_PREFIX:PATH=$prefix \ - ${source_dir} -else - $cmake_exec \ - -DCMAKE_CXX_FLAGS:STRING=-std=c++11 \ - -DBUILD_DOCUMENTATION:BOOL=OFF \ - -DBUILD_EXAMPLES:BOOL=OFF \ - -DBUILD_SHARED_LIBS:BOOL=ON \ - -DBUILD_TESTING:BOOL=OFF \ - -DCMAKE_BUILD_TYPE:STRING=$build_type \ - -DCMAKE_INSTALL_PREFIX:PATH=$prefix \ - ${source_dir} -fi -echo "==> Configuring sources... done." - -echo "==> Compiling sources..." -cd $build_dir -make -j$number_of_threads -echo "==> Compiling sources... done." - -echo "==> Installing package..." -cd $build_dir -make -j install -echo "==> Installing package... done." - -## eof - $RCSfile$