3 ## Some configuration variables
4 number_of_processes="-j4"
7 ## Locate cmake executable
8 cmake_exec="/usr/bin/cmake"
9 if [ ! -x $cmake_exec ]; then
10 cmake_exec="/usr/local/bin/cmake"
12 if [ ! -x $cmake_exec ]; then
13 cmake_exec="${HOME}/local/bin/cmake"
15 if [ ! -x $cmake_exec ]; then
16 echo "$0: modify this script to put the correct location of cmake."
20 ## Check input parameters and process inputs (if needed)
21 if [ "$#" -eq 1 ]; then
22 valid_extensions=("zip" "tar" "tar.gz" "tar.bz2")
24 for ext in ${valid_extensions[@]}; do
25 if [ `basename $1 $ext` != $1 ]; then
29 if [ "x$actual_ext" == "x" ]; then
30 echo "$0: Invalid file type."
33 canonical_path=`readlink -e $1`
34 source_dir=`dirname $canonical_path`/`basename $1 .$actual_ext`
35 build_dir=`dirname $canonical_path`/`basename $1 .$actual_ext`-build
36 echo -n "Cleaning directories... "
40 echo -n "Creating directories... "
44 echo -n "Extracting sources... "
45 if [ "$actual_ext" == "zip" ]; then
46 echo unzip $canonical_path
47 elif [ "$actual_ext" == "tar" ]; then
48 tar xf $canonical_path -C $source_dir --strip-components=1
49 elif [ "$actual_ext" == "tar.gz" ]; then
50 tar xzf $canonical_path -C $source_dir --strip-components=1
51 elif [ "$actual_ext" == "tar.bz2" ]; then
52 tar xjf $canonical_path -C $source_dir --strip-components=1
54 echo "$0: Invalid file type."
58 elif [ "$#" -eq 2 ]; then
59 source_dir=`dirname $1`
60 build_dir=`dirname $2`
62 echo "Usage: [itk_package] or [itk_source_dir itk_build_dir]"
65 echo "Given source dir : \"$source_dir\""
66 echo "Given build dir : \"$build_dir\""
68 echo "Configuring sources... "
71 -DCMAKE_CXX_FLAGS:STRING=-std=c++11 \
72 -DBUILD_DOCUMENTATION:BOOL=OFF \
73 -DBUILD_EXAMPLES:BOOL=OFF \
74 -DBUILD_SHARED_LIBS:BOOL=ON \
75 -DBUILD_TESTING:BOOL=OFF \
76 -DCMAKE_BUILD_TYPE:STRING=$comp_type \
77 -DModule_ITKReview:BOOL=ON \
78 -DModule_ITKVtkGlue:BOOL=OFF \
79 -DCMAKE_INSTALL_PREFIX:PATH=${HOME}/local \
81 echo "Configuring sources... done."
83 echo "Compiling sources..."
85 make $number_of_processes
86 echo "Compiling sources... done."
88 echo "Installing package..."
91 echo "Installing package... done."