12 if [ "$cur_dir" == "/" ]; then
13 echo "$cur_dir`basename \"$1\"`"
15 echo "$cur_dir/`basename \"$1\"`"
21 ## Some configuration variables
22 number_of_processes="-j4"
24 ## Locate cmake executable
25 cmake_locations=("/usr/bin" "/usr/local/bin" "${HOME}/local/bin")
28 for loc in ${cmake_locations[@]}; do
29 cmake_file="$loc/cmake"
30 if [ -x $cmake_file ]; then
31 str=`$cmake_file --version | grep version`
33 if [ "$cmake_ver" \< "$version" ]; then
35 cmake_exec=$cmake_file
39 if [ ! -x $cmake_exec ]; then
40 echo "$0: modify this script to put the correct location of cmake."
44 ## Check input parameters and process inputs (if needed)
45 if [ "$#" -eq 2 ]; then
46 valid_extensions=("zip" "tar" "tar.gz" "tar.bz2")
48 for ext in ${valid_extensions[@]}; do
49 if [ `basename $1 $ext` != $1 ]; then
53 if [ "x$actual_ext" == "x" ]; then
54 echo "$0: Invalid file type."
57 canonical_path=`abspath $1`
58 source_dir=`dirname $canonical_path`/`basename $1 .$actual_ext`
59 build_dir=`dirname $canonical_path`/`basename $1 .$actual_ext`-build
60 echo -n "Cleaning directories... "
64 echo -n "Creating directories... "
68 echo -n "Extracting sources... "
69 if [ "$actual_ext" == "zip" ]; then
70 echo unzip $canonical_path
71 elif [ "$actual_ext" == "tar" ]; then
72 tar xf $canonical_path -C $source_dir --strip-components=1
73 elif [ "$actual_ext" == "tar.gz" ]; then
74 tar xzf $canonical_path -C $source_dir --strip-components=1
75 elif [ "$actual_ext" == "tar.bz2" ]; then
76 tar xjf $canonical_path -C $source_dir --strip-components=1
78 echo "$0: Invalid file type."
83 elif [ "$#" -eq 3 ]; then
84 source_dir=`dirname $1`
85 build_dir=`dirname $2`
88 echo "Usage: [itk_package] or [itk_source_dir itk_build_dir] [build_type]"
91 echo "Given source dir : \"$source_dir\""
92 echo "Given build dir : \"$build_dir\""
94 echo "Configuring sources... "
97 -DCMAKE_CXX_FLAGS:STRING=-std=c++11 \
98 -DBUILD_DOCUMENTATION:BOOL=OFF \
99 -DBUILD_EXAMPLES:BOOL=OFF \
100 -DBUILD_SHARED_LIBS:BOOL=ON \
101 -DBUILD_TESTING:BOOL=OFF \
102 -DCMAKE_BUILD_TYPE:STRING=$build_type \
103 -DModule_ITKReview:BOOL=ON \
104 -DModule_ITKVtkGlue:BOOL=OFF \
105 -DCMAKE_INSTALL_PREFIX:PATH=${HOME}/local \
107 echo "Configuring sources... done."
109 echo "Compiling sources..."
111 make $number_of_processes
112 echo "Compiling sources... done."
114 echo "Installing package..."
117 echo "Installing package... done."