From 4df7b5a8a200ce326cfe7079380946f8f277de09 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Leonardo=20Fl=C3=B3rez-Valencia?= Date: Thu, 9 Nov 2017 11:05:49 -0500 Subject: [PATCH] ... --- config/install.sh | 93 +++++++++++++++++++++++++++++++ config/install_FrontAlgorithms.sh | 69 ----------------------- 2 files changed, 93 insertions(+), 69 deletions(-) create mode 100755 config/install.sh delete mode 100755 config/install_FrontAlgorithms.sh diff --git a/config/install.sh b/config/install.sh new file mode 100755 index 0000000..8228b51 --- /dev/null +++ b/config/install.sh @@ -0,0 +1,93 @@ +#!/bin/bash + +## -- Command line options +while [[ "$#" -gt 1 ]]; do + key="$1" + case $key in + -prefix) + prefix="$2" + shift + ;; + -cores) + cores="$2" + shift + ;; + -build_type) + build_type="$2" + shift + ;; + -install_type) + install_type="$2" + shift + ;; + -eigen_version) + eigen_version="$2" + shift + ;; + *) + # Do nothing + ;; + esac + shift +done + +## -- Check command line options +if \ + [ -z "$prefix" ] || \ + [ -z "$build_type" ] ; then + (>&2 echo "Usage: $0 -prefix [dir] [-build_type [Release/Debug]] [-cores [n]] [-install_type [compile/install]] [-eigen_version [x.y.z]]}") + exit 1 +fi + +if [ -z "$cores" ] ; then + cores="1" +fi +if [ -z "$build_type" ] ; then + build_type="Release" +fi +if [ -z "$install_type" ] ; then + install_type="install" +fi + +cmake=`find $prefix -type f -name "cmake" | grep bin` +cpPluginsConfig=`find $prefix -type f -name "cpPluginsConfig.cmake"` + +## -- Current dir +curr_dir=`pwd` + +## -- Compile eigen +if [ -n "$eigen_version" ] ; then + url="http://bitbucket.org/eigen/eigen/get/$eigen_version.tar.bz2" + dir="$HOME/.tmp" + mkdir -p $dir + mkdir -p $dir/eigen/src + mkdir -p $dir/eigen/bin + cd $dir/eigen + curl -L -o eigen.tar.bz2 $url + tar xf eigen.tar.bz2 -C $dir/eigen/src --strip-components=1 + cd $dir/eigen/bin + $cmake $dir/eigen/src +fi + +## -- Current dir +cd $curr_dir/.. + +## -- Configure, build and install +mkdir -p build +cd build +$cmake \ + -DCMAKE_BUILD_TYPE:STRING=$build_type \ + -DCMAKE_INSTALL_PREFIX:PATH=$prefix \ + -Dfpa_BUILD_CTArteries:BOOL=ON \ + -Dfpa_BUILD_CTBronchi:BOOL=ON \ + -DcpPlugins_DIR:PATH=`dirname $cpPluginsConfig` \ + $curr_dir/.. +make -j$cores -k +if [[ "$install_type" == 'install' ]] ; then + make -j -k install +fi + +## -- End +cd $curr_dir + +## eof - $RCSfile$ diff --git a/config/install_FrontAlgorithms.sh b/config/install_FrontAlgorithms.sh deleted file mode 100755 index 9ee9844..0000000 --- a/config/install_FrontAlgorithms.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/bash - -## -- Command line options -while [[ "$#" -gt 1 ]]; do - key="$1" - case $key in - -cpPluginsConfig) - cpPluginsConfig="$2" - shift - ;; - -cmake) - cmake="$2" - shift - ;; - -prefix) - prefix="$2" - shift - ;; - -build_dir) - build_dir="$2" - shift - ;; - -cores) - cores="$2" - shift - ;; - -build_type) - build_type="$2" - shift - ;; - *) - # Do nothing - ;; - esac - shift -done - -## -- Check command line options -if \ - [ -z "$cpPluginsConfig" ] || \ - [ -z "$cmake" ] || \ - [ -z "$prefix" ] || \ - [ -z "$cores" ] || \ - [ -z "$build_type" ] || \ - [ -z "$build_dir" ] ; then - (>&2 echo "Usage: $0 -cpPluginsConfig [file] -cmake [file] -prefix [dir] -build_dir [dir] -build_type [Release/Debug] -cores [n]") - exit 1 -fi - -## -- Current dir -curr_dir=`pwd` - -## -- Configure, build and install Qt5 -mkdir -p $build_dir/FrontAlgorithms -cd $build_dir/FrontAlgorithms -$cmake \ - -DCMAKE_BUILD_TYPE:STRING=$build_type \ - -DCMAKE_INSTALL_PREFIX:PATH=$prefix \ - -Dfpa_BUILD_CTArteries:BOOL=ON \ - -Dfpa_BUILD_CTBronchi:BOOL=ON \ - -DcpPlugins_DIR:PATH=`dirname $cpPluginsConfig` \ - $curr_dir/.. -make -s -j$cores -k -make -s -j -k install - -## -- End -cd $curr_dir - -## eof - $RCSfile$ -- 2.45.1