From: Leonardo Flórez-Valencia Date: Fri, 21 Apr 2017 15:44:19 +0000 (-0500) Subject: ... X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=4f48a0e46031eafe8b090f682b8bbfcd80a440b2;p=cpPlugins.git ... --- diff --git a/install/INSTALL.txt b/install/INSTALL.txt index 26d2a8f..5437404 100644 --- a/install/INSTALL.txt +++ b/install/INSTALL.txt @@ -2,8 +2,8 @@ 0. Pre-requisites ----------------- -cpPlugins is developed in C++11 and makes extensive use of VTK (>=7.0) and -ITK (>=4.10). Qt (=4.8) could be used at will. +cpPlugins is developed in C++11 and makes extensive use of CMake (>=3.0), +VTK (>=7.0) and ITK (>=4.10). Qt (=4.8) could be used at will. In order to compile it, you will need a development environment that includes: @@ -15,7 +15,7 @@ In order to compile it, you will need a development environment that includes: - GLUT. - whatever your compiler complains about... ;-) -A convinient shell script (cpPlugins_Install_Dependencies.sh) is distributed +A convenient shell script (cpPlugins_Install_Dependencies.sh) is distributed with this notice in order to simplify the base librraries installation process. You could use it to compile Qt, CMake, ITK and VTK, as long as you have downloaded the compressed files of each package: @@ -25,6 +25,9 @@ downloaded the compressed files of each package: - ITK : http://www.itk.org - VTK : http://www.vtk.org +As an extra, this script will try to perform a draft configuration of cpPlugins +with the given base libraries. After this, you are on your own :-) + This script has been tested on: Ubuntu. ## eof - $RCSfile$ diff --git a/install/cpPlugins_Install_Dependencies.sh b/install/cpPlugins_Install_Dependencies.sh index cbfb986..468ae16 100755 --- a/install/cpPlugins_Install_Dependencies.sh +++ b/install/cpPlugins_Install_Dependencies.sh @@ -13,7 +13,9 @@ echo "#######################################################################" # = Various values = # ================== +number_of_cores=`nproc --all` number_of_threads="nope" +echo "--> Keep in mind that you have $number_of_cores cores." while ! [[ "$number_of_threads" =~ ^[0-9]+$ ]]; do echo -n "--> How many threads do you want to use to compile?: " read number_of_threads @@ -70,6 +72,7 @@ source $bash_dir/cpPlugins_Install_Functions.sh # = Check for Qt4.8 = # =================== +qmake_exe="" read -p "Do you want to use Qt4.8? [y/N] " -n 1 -r echo if [[ $REPLY =~ ^[Yy]$ ]]; then @@ -91,178 +94,170 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then make -j$number_of_threads -k make -j install cd $cur_dir + qmake_exe="$install_prefix/qmake" + fi + if [ "x$qmake_exe" == "x" ]; then + echo "Sorry, could not find a vaild qmake executable. Bailing out!!!" + exit 1 + fi + qt_version=`$qmake_exe -v | grep Using\ Qt\ version | sed 's/Using\ Qt\ version\ //g'` + if version_gt 4.8 $qt_version; then + echo "*** FATAL ERROR: your Qt version is $qt_version, but needed version should be 4.8 ***" fi fi +# ====================== +# = Check for CMake3.0 = +# ====================== + +echo "########################" +echo "# Configuring CMake3.0 #" +echo "########################" +cmake_exe=`choose_installation \`which -a cmake\`` +if [ "x$cmake_exe" == "x" ]; then + cmake_source_dir=`prepare_compilation` + cmake_binary_dir="$cmake_source_dir"_build + cmake_qt_options="--no-qt-gui" + if [ -x "$qmake_exe" ]; then + cmake_qt_options="--qt-gui --qt-qmake=$qmake_exe" + fi + rm -rf $cmake_binary_dir + mkdir -p $cmake_binary_dir + cd $cmake_binary_dir + $cmake_source_dir/bootstrap --prefix=$install_prefix $cmake_qt_options + make -j$number_of_threads -k + make -j install + cd $cur_dir + cmake_exe="$install_prefix/cmake" +fi +if [ "x$cmake_exe" == "x" ]; then + echo "Sorry, could not find a vaild cmake executable. Bailing out!!!" + exit 1 +fi +cmake_version=`$cmake_exe -version | grep cmake\ version | sed 's/cmake\ version\ //g'` +if version_gt 3.0 $cmake_version; then + echo "*** FATAL ERROR: your CMake version is $cmake_version, but needed version should be at least 3.0 ***" +fi -# qmake_exe="" -# qmake_execs=($install_prefix/bin/qmake $install_prefix/bin/qmake-qt4) -# for i in $qmake_execs; do -# if [[ -f "$i" ]]; then -# qmake_exe=$i -# break -# fi -# done -# fi -# if [ "x$qmake_exe" == "x" ]; then -# echo "Sorry, could not find a vaild qmake executable. Bailing out!!!" -# exit 1 -# fi -# qt_version=`$qmake_exe -v | grep Using\ Qt\ version | sed 's/Using\ Qt\ version\ //g'` -# if version_gt 4.8 $qt_version; then -# echo "*** FATAL ERROR: your Qt version is $qt_version, but needed version should be 4.8 ***" -# fi -# fi +# ================= +# = Check for ITK = +# ================= -# # =============== -# # = Build CMake = -# # =============== +echo "#######################" +echo "# Configuring ITK4.10 #" +echo "#######################" +itk_loc=`choose_installation \`locate UseITK.cmake\`` +if [ "x$itk_loc" == "x" ]; then + itk_source_dir=`prepare_compilation` + itk_binary_dir="$itk_source_dir"_build + itk_link_type="-DBUILD_SHARED_LIBS:BOOL=ON" + if [ "$link_type" = "static" ]; then + itk_link_type="-DBUILD_SHARED_LIBS:BOOL=OFF" + fi + rm -rf $itk_binary_dir + mkdir -p $itk_binary_dir + cd $itk_binary_dir + $cmake_exe \ + -DCMAKE_CXX_FLAGS:STRING=-std=c++11 \ + -DBUILD_DOCUMENTATION:BOOL=OFF \ + -DBUILD_EXAMPLES:BOOL=OFF \ + $itk_link_type \ + -DBUILD_TESTING:BOOL=OFF \ + -DCMAKE_BUILD_TYPE:STRING=$tk_build_type \ + -DModule_ITKReview:BOOL=ON \ + -DModule_ITKVtkGlue:BOOL=OFF \ + -DCMAKE_INSTALL_PREFIX:PATH=$install_prefix \ + $itk_source_dir + make -j$number_of_threads -k + make -j install + cd $cur_dir + itk_loc="$install_prefix/lib/cmake/UseITK.cmake" +fi -# echo "#####################" -# echo "# Configuring CMake #" -# echo "#####################" -# cmake_exe=`find_executables cmake` -# if [ "x$cmake_exe" == "x" ]; then -# cmake_source_dir="" -# cmake_binary_dir="" -# echo "----> Ok, we will compile CMake from source code <----" -# read -e -p "--> Please provide a valid location of CMake's source code (either a compressed file or directory): " tmp -# cmake_loc=`readlink -f ${tmp/#\~/$HOME}` -# if [[ -f $cmake_loc ]]; then -# echo -n "--> Expanding CMake source code... " -# cmake_source_dir=`dirname $cmake_loc`/`echo \`basename $cmake_loc\` | sed 's/\./_/g'`_sources -# cmake_binary_dir=`dirname $cmake_loc`/`echo \`basename $cmake_loc\` | sed 's/\./_/g'`_binary -# rm -rf $cmake_source_dir $cmake_binary_dir -# mkdir -p $cmake_source_dir -# uncompress $cmake_loc $cmake_source_dir -# echo "done!" -# else -# cmake_source_dir=$cmake_loc -# cmake_binary_dir="$cmake_loc"_binary -# fi -# cmake_qt_options="--no-qt-gui" -# if [ -x "$qmake_exe" ]; then -# cmake_qt_options="--qt-gui --qt-qmake=$qmake_exe" -# fi -# mkdir -p $cmake_binary_dir -# cd $cmake_binary_dir -# $cmake_source_dir/bootstrap --prefix=$install_prefix $cmake_qt_options -# make -j$number_of_threads -k -# make -j install -# cd $cur_dir -# cmake_exe="" -# cmake_execs=($install_prefix/bin/cmake) -# for i in $cmake_execs; do -# if [[ -f "$i" ]]; then -# cmake_exe=$i -# break -# fi -# done -# fi -# if [ "x$cmake_exe" == "x" ]; then -# echo "Sorry, could not find a vaild cmake executable. Bailing out!!!" -# exit 1 -# fi -# cmake_version=`$cmake_exe -version | grep cmake\ version | sed 's/cmake\ version\ //g'` -# if version_gt 3.0 $cmake_version; then -# echo "*** FATAL ERROR: your CMake version is $cmake_version, but needed version should be at least 3.0 ***" -# fi -# # ============= -# # = Build ITK = -# # ============= +# ================= +# = Check for VTK = +# ================= -# echo "#####################" -# echo "# Configuring ITK #" -# echo "#####################" -# itk_source_dir="" -# itk_binary_dir="" -# echo "----> Ok, we will compile ITK from source code <----" -# read -e -p "--> Please provide a valid location of ITK's source code (either a compressed file or directory): " tmp -# itk_loc=`readlink -f ${tmp/#\~/$HOME}` -# if [[ -f $itk_loc ]]; then -# echo -n "--> Expanding ITK source code... " -# itk_source_dir=`dirname $itk_loc`/`echo \`basename $itk_loc\` | sed 's/\./_/g'`_sources -# itk_binary_dir=`dirname $itk_loc`/`echo \`basename $itk_loc\` | sed 's/\./_/g'`_binary -# rm -rf $itk_source_dir $itk_binary_dir -# mkdir -p $itk_source_dir -# uncompress $itk_loc $itk_source_dir -# echo "done!" -# else -# itk_source_dir=$itk_loc -# itk_binary_dir="$itk_loc"_binary -# fi -# mkdir -p $itk_binary_dir -# cd $itk_binary_dir -# $cmake_exe \ -# -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=$itk_build_type \ -# -DModule_ITKReview:BOOL=ON \ -# -DModule_ITKVtkGlue:BOOL=OFF \ -# -DCMAKE_INSTALL_PREFIX:PATH=$install_prefix \ -# $itk_source_dir -# make -j$number_of_threads -k -# make -j install -# cd $cur_dir +echo "#######################" +echo "# Configuring VTK4.10 #" +echo "#######################" +vtk_loc=`choose_installation \`locate UseVTK.cmake\`` +if [ "x$vtk_loc" == "x" ]; then + vtk_source_dir=`prepare_compilation` + vtk_binary_dir="$vtk_source_dir"_build + vtk_link_type="-DBUILD_SHARED_LIBS:BOOL=ON" + if [ "$link_type" = "static" ]; then + vtk_link_type="-DBUILD_SHARED_LIBS:BOOL=OFF" + fi + rm -rf $vtk_binary_dir + mkdir -p $vtk_binary_dir + cd $vtk_binary_dir + if [ "x$qmake_exe" == "x" ]; then + $cmake_exe \ + -DCMAKE_CXX_FLAGS:STRING=-std=c++11 \ + -DBUILD_DOCUMENTATION:BOOL=OFF \ + -DBUILD_EXAMPLES:BOOL=OFF \ + $vtk_link_type \ + -DBUILD_TESTING:BOOL=OFF \ + -DCMAKE_BUILD_TYPE:STRING=$tk_build_type \ + -DCMAKE_INSTALL_PREFIX:PATH=$install_prefix \ + $vtk_source_dir + else + $cmake_exe \ + -DCMAKE_CXX_FLAGS:STRING=-std=c++11 \ + -DBUILD_DOCUMENTATION:BOOL=OFF \ + -DBUILD_EXAMPLES:BOOL=OFF \ + $vtk_link_type \ + -DBUILD_TESTING:BOOL=OFF \ + -DQT_QMAKE_EXECUTABLE:PATH=$qmake_exe \ + -DCMAKE_BUILD_TYPE:STRING=$tk_build_type \ + -DModule_vtkGUISupportQt:BOOL=ON \ + -DModule_vtkGUISupportQtOpenGL:BOOL=ON \ + -DModule_vtkGUISupportQtSQL:BOOL=OFF \ + -DModule_vtkGUISupportQtWebkit:BOOL=OFF \ + -DCMAKE_INSTALL_PREFIX:PATH=$install_prefix \ + $vtk_source_dir + fi + make -j$number_of_threads -k + make -j install + cd $cur_dir + vtk_loc="$install_prefix/lib/cmake/UseVTK.cmake" +fi -# # ============= -# # = Build VTK = -# # ============= +# ================================= +# = Draft cpPlugins configuration = +# ================================= -# echo "#####################" -# echo "# Configuring VTK #" -# echo "#####################" -# vtk_source_dir="" -# vtk_binary_dir="" -# echo "----> Ok, we will compile VTK from source code <----" -# read -e -p "--> Please provide a valid location of VTK's source code (either a compressed file or directory): " tmp -# vtk_loc=`readlink -f ${tmp/#\~/$HOME}` -# if [[ -f $vtk_loc ]]; then -# echo -n "--> Expanding VTK source code... " -# vtk_source_dir=`dirname $vtk_loc`/`echo \`basename $vtk_loc\` | sed 's/\./_/g'`_sources -# vtk_binary_dir=`dirname $vtk_loc`/`echo \`basename $vtk_loc\` | sed 's/\./_/g'`_binary -# rm -rf $vtk_source_dir $vtk_binary_dir -# mkdir -p $vtk_source_dir -# uncompress $vtk_loc $vtk_source_dir -# echo "done!" -# else -# vtk_source_dir=$vtk_loc -# vtk_binary_dir="$vtk_loc"_binary -# fi -# mkdir -p $vtk_binary_dir -# cd $vtk_binary_dir -# if [ "x$qmake_exe" == "x" ]; then -# $cmake_exe \ -# -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=$vtk_build_type \ -# -DCMAKE_INSTALL_PREFIX:PATH=$install_prefix \ -# $vtk_source_dir -# else -# $cmake_exe \ -# -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_exe \ -# -DCMAKE_BUILD_TYPE:STRING=$vtk_build_type \ -# -DModule_vtkGUISupportQt:BOOL=ON \ -# -DModule_vtkGUISupportQtOpenGL:BOOL=ON \ -# -DModule_vtkGUISupportQtSQL:BOOL=OFF \ -# -DModule_vtkGUISupportQtWebkit:BOOL=OFF \ -# -DCMAKE_INSTALL_PREFIX:PATH=$install_prefix \ -# $vtk_source_dir -# fi -# make -j$number_of_threads -k -# make -j install -# cd $cur_dir +read -p "Do you want to configure cpPlugins? [y/N] " -n 1 -r +echo +if [[ $REPLY =~ ^[Yy]$ ]]; then + read -e -p "--> Please provide where you want to compile cpPlugins: " tmp + cpPlugins_binary_dir="${tmp/#\~/$HOME}" + cpPlugins_source_dir="$bash_dir/.." + rm -rf $cpPlugins_binary_dir + mkdir -p $cpPlugins_binary_dir + cd $cpPlugins_binary_dir + if [ "x$qmake_exe" == "x" ]; then + $cmake_exe \ + -DBUILD_QT4_COMPONENTS:BOOL=OFF \ + -DCMAKE_INSTALL_PREFIX:PATH=$install_prefix \ + -DITK_DIR:PATH=`dirname $itk_loc` \ + -DVTK_DIR:PATH=`dirname $vtk_loc` \ + $cpPlugins_source_dir + else + $cmake_exe \ + -DBUILD_QT4_COMPONENTS:BOOL=ON \ + -DQT_QMAKE_EXECUTABLE:PATH=$qmake_exe \ + -DCMAKE_INSTALL_PREFIX:PATH=$install_prefix \ + -DITK_DIR:PATH=`dirname $itk_loc` \ + -DVTK_DIR:PATH=`dirname $vtk_loc` \ + $cpPlugins_source_dir + fi + echo "#################################################################" + echo " cpPlugins has been configured. Now you can go to " + echo " $cpPlugins_binary_dir, compile and enjoy it!!!" + echo "#################################################################" +fi ## eof - $RCSfile$