+#!/bin/bash
+
+## -- Command line options
+while [[ "$#" -gt 1 ]]; do
+ key="$1"
+ case $key in
+ -qt5config)
+ qt5config="$2"
+ shift
+ ;;
+ -cmake)
+ cmake="$2"
+ shift
+ ;;
+ -use_vtk)
+ use_vtk="$2"
+ shift
+ ;;
+ -use_itk)
+ use_itk="$2"
+ shift
+ ;;
+ -prefix)
+ prefix="$2"
+ shift
+ ;;
+ -build_dir)
+ build_dir="$2"
+ shift
+ ;;
+ -cores)
+ cores="$2"
+ shift
+ ;;
+ -build_type)
+ build_type="$2"
+ shift
+ ;;
+ *)
+ # Do nothing
+ ;;
+ esac
+ shift
+done
+
+## -- Check command line options
+if \
+ [ -z "$qt5config" ] || \
+ [ -z "$cmake" ] || \
+ [ -z "$use_vtk" ] || \
+ [ -z "$use_itk" ] || \
+ [ -z "$prefix" ] || \
+ [ -z "$cores" ] || \
+ [ -z "$build_type" ] || \
+ [ -z "$build_dir" ] ; then
+ (>&2 echo "Usage: $0 -qt5config [file] -cmake [file] -use_vtk [file] -use_itk [file] -prefix [dir] -build_dir [dir] -build_type [Release/Debug] -cores [n]")
+ exit 1
+fi
+
+## -- Current dir
+curr_dir=`pwd`
+
+## -- Configure, build and install Qt5
+mkdir -p $build_dir/cpPlugins
+cd $build_dir/cpPlugins
+$cmake \
+ -DCMAKE_BUILD_TYPE:STRING=$build_type \
+ -DCMAKE_INSTALL_PREFIX:PATH=$prefix \
+ -DcpPlugins_BUILD:BOOL=ON \
+ -DcpPlugins_BUILD_APPLICATIONS:BOOL=ON \
+ -DcpPlugins_BUILD_ivq:BOOL=ON \
+ -DcpPlugins_BUILD_tclap:BOOL=ON \
+ -DITK_DIR:PATH=`dirname $use_itk` \
+ -DVTK_DIR:PATH=`dirname $use_vtk` \
+ -DQt5_DIR:PATH=`dirname $qt5config` \
+ $curr_dir/..
+make -s -j$cores -k
+make -s -j -k install
+
+## -- End
+cd $curr_dir
+
+## eof - $RCSfile$