3 ## Some configuration variables
4 number_of_processes="-j4"
7 ## Locate cmake executable
8 cmake_locations=("/usr/bin" "/usr/local/bin" "${HOME}/local/bin")
11 for loc in ${cmake_locations[@]}; do
12 cmake_file="$loc/cmake"
13 if [ -x $cmake_file ]; then
14 str=`$cmake_file --version | grep version`
16 if [ "$cmake_ver" \< "$version" ]; then
18 cmake_exec=$cmake_file
22 if [ ! -x $cmake_exec ]; then
23 echo "$0: modify this script to put the correct location of cmake."
27 ## Locate qmake executable
28 qmake_locations=("/usr/bin" "/usr/local/bin" "${HOME}/local/bin")
30 for loc in ${qmake_locations[@]}; do
31 qmake_file="$loc/qmake"
32 if [ -x $qmake_file ]; then
33 str=`$qmake_file --version | grep Using\ Qt\ version`
34 version=`expr substr "$str" 18 3`
35 if [ "$version" == "4.8" ]; then
36 qmake_exec=$qmake_file
40 if [ ! -x $qmake_exec ]; then
41 echo "$0: modify this script to put the correct location of qmake."
45 ## Check input parameters and process inputs (if needed)
46 if [ "$#" -eq 1 ]; then
47 valid_extensions=("zip" "tar" "tar.gz" "tar.bz2")
49 for ext in ${valid_extensions[@]}; do
50 if [ `basename $1 $ext` != $1 ]; then
54 if [ "x$actual_ext" == "x" ]; then
55 echo "$0: Invalid file type."
58 canonical_path=`readlink -e $1`
59 source_dir=`dirname $canonical_path`/`basename $1 .$actual_ext`
60 build_dir=`dirname $canonical_path`/`basename $1 .$actual_ext`-build
61 echo -n "Cleaning directories... "
65 echo -n "Creating directories... "
69 echo -n "Extracting sources... "
70 if [ "$actual_ext" == "zip" ]; then
71 echo unzip $canonical_path
72 elif [ "$actual_ext" == "tar" ]; then
73 tar xf $canonical_path -C $source_dir --strip-components=1
74 elif [ "$actual_ext" == "tar.gz" ]; then
75 tar xzf $canonical_path -C $source_dir --strip-components=1
76 elif [ "$actual_ext" == "tar.bz2" ]; then
77 tar xjf $canonical_path -C $source_dir --strip-components=1
79 echo "$0: Invalid file type."
83 elif [ "$#" -eq 2 ]; then
84 source_dir=`dirname $1`
85 build_dir=`dirname $2`
87 echo "Usage: [vtk_package] or [vtk_source_dir vtk_build_dir]"
90 echo "Given source dir : \"$source_dir\""
91 echo "Given build dir : \"$build_dir\""
93 echo "Configuring sources... "
96 -DCMAKE_CXX_FLAGS:STRING=-std=c++11 \
97 -DBUILD_DOCUMENTATION:BOOL=OFF \
98 -DBUILD_EXAMPLES:BOOL=OFF \
99 -DBUILD_SHARED_LIBS:BOOL=ON \
100 -DBUILD_TESTING:BOOL=OFF \
101 -DQT_QMAKE_EXECUTABLE:PATH=$qmake_exec \
102 -DCMAKE_BUILD_TYPE:STRING=$comp_type \
103 -DModule_vtkGUISupportQt:BOOL=ON \
104 -DModule_vtkGUISupportQtOpenGL:BOOL=ON \
105 -DModule_vtkGUISupportQtSQL:BOOL=OFF \
106 -DModule_vtkGUISupportQtWebkit:BOOL=OFF \
107 -DCMAKE_INSTALL_PREFIX:PATH=${HOME}/local \
109 echo "Configuring sources... done."
111 echo "Compiling sources..."
113 make $number_of_processes
114 echo "Compiling sources... done."
116 echo "Installing package..."
119 echo "Installing package... done."