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 ## Check input parameters and process inputs (if needed)
28 if [ "$#" -eq 1 ]; then
29 valid_extensions=("zip" "tar" "tar.gz" "tar.bz2")
31 for ext in ${valid_extensions[@]}; do
32 if [ `basename $1 $ext` != $1 ]; then
36 if [ "x$actual_ext" == "x" ]; then
37 echo "$0: Invalid file type."
40 canonical_path=`readlink -e $1`
41 source_dir=`dirname $canonical_path`/`basename $1 .$actual_ext`
42 build_dir=`dirname $canonical_path`/`basename $1 .$actual_ext`-build
43 echo -n "Cleaning directories... "
47 echo -n "Creating directories... "
51 echo -n "Extracting sources... "
52 if [ "$actual_ext" == "zip" ]; then
53 echo unzip $canonical_path
54 elif [ "$actual_ext" == "tar" ]; then
55 tar xf $canonical_path -C $source_dir --strip-components=1
56 elif [ "$actual_ext" == "tar.gz" ]; then
57 tar xzf $canonical_path -C $source_dir --strip-components=1
58 elif [ "$actual_ext" == "tar.bz2" ]; then
59 tar xjf $canonical_path -C $source_dir --strip-components=1
61 echo "$0: Invalid file type."
65 elif [ "$#" -eq 2 ]; then
66 source_dir=`dirname $1`
67 build_dir=`dirname $2`
69 echo "Usage: [itk_package] or [itk_source_dir itk_build_dir]"
72 echo "Given source dir : \"$source_dir\""
73 echo "Given build dir : \"$build_dir\""
75 echo "Configuring sources... "
78 -DCMAKE_CXX_FLAGS:STRING=-std=c++11 \
79 -DBUILD_DOCUMENTATION:BOOL=OFF \
80 -DBUILD_EXAMPLES:BOOL=OFF \
81 -DBUILD_SHARED_LIBS:BOOL=ON \
82 -DBUILD_TESTING:BOOL=OFF \
83 -DCMAKE_BUILD_TYPE:STRING=$comp_type \
84 -DModule_ITKReview:BOOL=ON \
85 -DModule_ITKVtkGlue:BOOL=OFF \
86 -DCMAKE_INSTALL_PREFIX:PATH=${HOME}/local \
88 echo "Configuring sources... done."
90 echo "Compiling sources..."
92 make $number_of_processes
93 echo "Compiling sources... done."
95 echo "Installing package..."
98 echo "Installing package... done."