]> Creatis software - cpPlugins.git/blob - config/install.sh
9ce8429ce3d354cb602828f3e068441d6d060039
[cpPlugins.git] / config / install.sh
1 #!/bin/bash
2
3 ## -- Command line options
4 while [[ "$#" -gt 1 ]]; do
5     key="$1"
6     case $key in
7         -prefix)
8         prefix="$2"
9         shift
10         ;;
11         -cores)
12         cores="$2"
13         shift
14         ;;
15         -build_type)
16         build_type="$2"
17         shift
18         ;;
19         *)
20         # Do nothing
21         ;;
22     esac
23     shift
24 done
25
26 ## -- Check command line options
27 if \
28     [ -z "$prefix" ] || \
29     [ -z "$cores" ] || \
30     [ -z "$build_type" ] ; then
31     (>&2 echo "Usage: $0 -prefix [dir] -build_type [Release/Debug] -cores [n]")
32     exit 1
33 fi
34
35 ccmake=`find $prefix -type f -name "ccmake"`
36 qt5config=`find $prefix -type f -name "Qt5Config.cmake"`
37 use_vtk=`find $prefix -type f -name "UseVTK.cmake"`
38 use_itk=`find $prefix -type f -name "UseITK.cmake"`
39 cmake=`dirname $ccmake`/cmake
40
41 ## -- Current dir
42 curr_dir=`pwd`
43 cd ..
44
45 ## -- Configure, build and install Qt5
46 mkdir -p build
47 cd build
48 $cmake \
49     -DCMAKE_BUILD_TYPE:STRING=$build_type \
50     -DCMAKE_INSTALL_PREFIX:PATH=$prefix \
51     -DcpPlugins_BUILD:BOOL=ON \
52     -DcpPlugins_BUILD_APPLICATIONS:BOOL=ON \
53     -DcpPlugins_BUILD_ivq:BOOL=ON \
54     -DcpPlugins_BUILD_tclap:BOOL=ON \
55     -DITK_DIR:PATH=`dirname $use_itk` \
56     -DVTK_DIR:PATH=`dirname $use_vtk` \
57     -DQt5_DIR:PATH=`dirname $qt5config` \
58     ..
59 make -s -j$cores -k
60 make -s -j -k install
61
62 ## -- End
63 cd $curr_dir
64
65 ## eof - $RCSfile$