An error occurred while loading the file. Please try again.
-
Cresson Remi authoredd5cea606
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#!/bin/bash
# =========================================
# Script d'installation
# =========================================
function erreur {
echo "Usage : $0 [--libs --maj --compil --all]"
echo "--libs : Installation des bibliothèques python"
echo "--maj : Téléchargement des fichiers sources pour OTB"
echo "--compil : Compilation d'OTB"
echo "--all : Téléchargement des sources et des bibliothèques python puis compilation d'OTB"
exit
}
function confirme {
read -r -p "${1}Êtes-vous sûr de vouloir continuer ? [O/N] " response
if [[ $response == "o" || $response = "O" || $response == "y" || $response = "Y" ]]; then
echo -e "${ROUGE}\e[1mLauching generation in $prefix_dir\e[0m"
else
exit
fi
}
set -e
#Couleur 'Rouge' pour le terminal
ROUGE='\033[0;31m'
# Dossier courant du script
CMD="$(readlink -e "${BASH_SOURCE[0]}")"
SH_DIR="$(dirname "$CMD")"
prefix_dir=$SH_DIR
if [ ! -z $CXX ]; then
echo "Version du compilateur : $CXX"
else
CXX=`type -p g++`
fi
CXXVersion=`${CXX} -dumpversion`
version_compilateur="5.0.0"
if [ "$(printf '%s\n' "$version_compilateur" "$CXXVersion" | sort -V | head -n1)" = "$CXXVersion" ]; then
echo "Gcc version too old"
echo "Actual: ${CXXVersion}"
echo "Needed: ${version_compilateur}"
exit
fi
# Erreur si manque ou mauvais argument
if [[ "$#" != "1" ]]; then
erreur
fi
if [[ "$1" != "--libs" ]] && [[ "$1" != "--maj" ]] && [[ "$1" != "--compil" ]] && [[ "$1" != "--all" ]]; then
erreur
fi
if [[ "$1" == "--libs" ]]; then
echo "Installation des bibliothèques python3"
sudo apt-get update
sudo apt-get install aptitude -y
sudo aptitude install python3-pip -y
sudo pip3 install -r "dépendances.txt"
fi
echo $prefix_dir/OTB
if [[ "$1" != "--libs" ]]; then
echo "Installation de la bibliothèque OTB dans : ${prefix_dir}"
confirme
#----------------------------------------
# Récupération des sources
if [[ "$1" == "--maj" ]] || [[ "$1" == "--all" ]]; then
# Clonage du repertoire OTB
if [ -d "OTB" ]; then
echo "Le répertoire OTB existe déjà."
else
echo "Clonage OTB ..."
mkdir -p $prefix_dir/OTB
cd $prefix_dir/OTB
git clone https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb.git
fi
fi
#----------------------------------------
# Compilation
if [[ "$1" != "--compil" ]] || [[ "$1" == "--all" ]] ; then
sudo aptitude install make cmake-curses-gui build-essential libtool automake git libbz2-dev python-dev libboost-dev libboost-filesystem-dev libboost-serialization-dev libboost-system-dev zlib1g-dev libcurl4-gnutls-dev swig libgdal-dev
echo "Compilation d'OTB ..."
cd $prefix_dir/
mkdir -p build
mkdir -p build
cd build
# Compilation d'OTB
cmake -DCMAKE_CXX_COMPILER=${CXX} -DCMAKE_CXX_FLAGS:STRING=-std=c++14 -DUSE_SYSTEM_BOOST=ON -DUSE_SYSTEM_CURL=ON -DUSE_SYSTEM_ZLIB=ON -DUSE_SYSTEM_GDAL=ON -DCMAKE_BUILD_TYPE=Release -DOTB_WRAP_PYTHON3:BOOL=ON -DGDAL_SB_EXTRA_OPTIONS:STRING="--with-python" -DCMAKE_INSTALL_PREFIX=$prefix_dir/OTB/install/ -DOTB_USE_QWT=OFF -DOTB_USE_GLEW=OFF -DOTB_USE_GLFW=OFF -DOTB_USE_GLUT=OFF -DOTB_USE_OPENGL=OFF -DOTB_USE_QT=OFF -DOTB_USE_QWT=OFF $prefix_dir/OTB/otb/SuperBuild/
make --jobs=12
# Compilation des modules
cd $prefix_dir/OTB/build/OTB/build
cmake -DCMAKE_CXX_COMPILER=${CXX} -DCMAKE_CXX_FLAGS:STRING=-std=c++14 -DModule_OTBPhenology:BOOL=ON -DModule_OTBTemporalGapFilling:BOOL=ON $prefix_dir/OTB/otb
make --jobs=12
make install
fi
echo "Installation terminée."
fi