]> Creatis software - cpPlugins.git/blobdiff - third_party_installers/cpPlugins_Install_VTK.sh
...
[cpPlugins.git] / third_party_installers / cpPlugins_Install_VTK.sh
index 59c3b8afbc5326e4634037f974739307a3d577ff..7cce532f1b4628949a71ce44fc748bd4b3842f1c 100755 (executable)
@@ -2,29 +2,42 @@
 
 ## Some configuration variables
 number_of_processes="-j4"
+comp_type=Debug
 
 ## Locate cmake executable
-cmake_exec="/usr/bin/cmake"
-if [ ! -x $cmake_exec ]; then
-    cmake_exec="/usr/local/bin/cmake"
-fi
-if [ ! -x $cmake_exec ]; then
-    cmake_exec="${HOME}/local/bin/cmake"
-fi
+cmake_locations=("/usr/bin" "/usr/local/bin" "${HOME}/local/bin")
+cmake_exec=""
+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
 if [ ! -x $cmake_exec ]; then
     echo "$0: modify this script to put the correct location of cmake."
     exit 1
 fi
 
 ## Locate qmake executable
-cmake_exec="/usr/bin/qmake"
-if [ ! -x $cmake_exec ]; then
-    cmake_exec="/usr/local/bin/qmake"
-fi
-if [ ! -x $cmake_exec ]; then
-    cmake_exec="${HOME}/local/bin/qmake"
-fi
-if [ ! -x $cmake_exec ]; then
+qmake_locations=("/usr/bin" "/usr/local/bin" "${HOME}/local/bin")
+qmake_exec=""
+for loc in ${qmake_locations[@]}; do
+    qmake_file="$loc/qmake"
+    if [ -x $qmake_file ]; then
+        str=`$qmake_file --version | grep Using\ Qt\ version`
+        version=`expr substr "$str" 18 3`
+        if [ "$version" == "4.8" ]; then
+            qmake_exec=$qmake_file
+        fi
+    fi
+done
+if [ ! -x $qmake_exec ]; then
     echo "$0: modify this script to put the correct location of qmake."
     exit 1
 fi
@@ -85,7 +98,8 @@ $cmake_exec \
     -DBUILD_EXAMPLES:BOOL=OFF \
     -DBUILD_SHARED_LIBS:BOOL=ON \
     -DBUILD_TESTING:BOOL=OFF \
-    -DCMAKE_BUILD_TYPE:STRING=MinSizeRel \
+    -DQT_QMAKE_EXECUTABLE:PATH=$qmake_exec \
+    -DCMAKE_BUILD_TYPE:STRING=$comp_type \
     -DModule_vtkGUISupportQt:BOOL=ON \
     -DModule_vtkGUISupportQtOpenGL:BOOL=ON \
     -DModule_vtkGUISupportQtSQL:BOOL=OFF \