-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sh
executable file
·137 lines (137 loc) · 4.26 KB
/
build.sh
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#!/bin/bash
#
# Define how to build the libraries and executables:
BUILD_TYPE=Debug
Fortran_COMPILER=gfortran
LIBSUFFIX="so"
if [[ "$OSTYPE" == "linux-gnu" ]]; then
LIBSUFFIX="so"
elif [[ "$OSTYPE" == "darwin"* ]]; then
LIBSUFFIX="dylib"
fi
################################################################################
# #
# Build OPI #
# #
################################################################################
echo "Checking for OPI"
if [[ ! -d "OPI" ]]; then
echo "Not found - cloning from https://github.com/Space-Systems/OPI.git --branch OPI-2015"
git clone https://github.com/Space-Systems/OPI.git --branch OPI-2015
else
echo "Found - updating branch."
cd OPI
git pull
cd ..
fi
# No need to continue when cloning did not work
if [[ $? -ne 0 ]]; then
echo "OPI could not be found. Exiting."
exit $?
fi
# Build OPI
cd OPI
# Create the build directory if it does not exist
if [[ ! -d "build" ]]; then
mkdir build
else
rm -rf build/*
fi
cd build
echo "Updating cmake"
cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=../ -DCMAKE_Fortran_COMPILER=$Fortran_COMPILER -DENABLE_CXX11=ON -DENABLE_CL_SUPPORT=OFF -DENABLE_CUDA_SUPPORT=OFF -DENABLE_PYTHON=OFF ../
echo "Building OPI"
make install
if [[ $? -ne 0 ]]; then
echo "Could not build OPI. Exiting."
exit $?
fi
echo "Leaving OPI"
cd ../../
################################################################################
# #
# Build libslam #
# #
################################################################################
echo "Checking for libslam"
if [[ ! -d "libslam" ]]; then
echo "Not found - cloning from https://github.com/Space-Systems/libslam.git"
git clone https://github.com/Space-Systems/libslam.git -b v2020-11
else
echo "Found - updating branch."
cd libslam
git pull
cd ..
fi
# No need to continue when cloning did not work
if [[ $? -ne 0 ]]; then
echo "libslam could not be found. Exiting."
exit $?
fi
# Build libslam
cd libslam
# Create the build directory if it does not exist
if [[ ! -d "build" ]]; then
mkdir build
else
rm -rf build/*
fi
cd build
echo "Updating cmake"
cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_Fortran_COMPILER=$Fortran_COMPILER -DENABLE_OpenMP_SUPPORT=ON -DENABLE_POSTGRESQL_SUPPORT=ON ../
echo "Building libslam"
make install
if [[ $? -ne 0 ]]; then
echo "Could not build libslam. Exiting."
exit $?
fi
echo "Manually preparing 'lib' and 'include' directories"
cd ../
ln -sf build/include include
ln -sf build/lib lib
echo "Leaving libslam"
cd ../
################################################################################
# #
# Build NEPTUNE #
# #
################################################################################
# Create the lib directory if it does not exist
if [[ ! -d "lib" ]]; then
mkdir lib
fi
# Create the links to libraries needed by CAMP
cd lib
ln -sf ../libslam/lib/libslam-Fortran.$LIBSUFFIX .
ln -sf ../OPI/lib/libOPI-Fortran.$LIBSUFFIX .
ln -sf ../OPI/lib/libOPI.$LIBSUFFIX .
cd ..
# Create the include directory if it does not exist
if [[ ! -d "include" ]]; then
mkdir include
fi
# Create the links to includes needed by NEPTUNE
cd include
ln -sf ../libslam/include/SLAM .
ln -sf ../OPI/include/OPI .
cd ..
# Create the build directory if it does not exist
if [[ ! -d "build" ]]; then
mkdir build
else
rm -rf build/*
fi
cd build
echo "Updating cmake"
cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_Fortran_COMPILER=$Fortran_COMPILER -ENABLE_OpenMP_SUPPORT=ON -DENABLE_OPI_SUPPORT=ON ../
echo "Building NEPTUNE"
make install
if [[ $? -ne 0 ]]; then
echo "Could not build NEPTUNE. Exiting."
exit $?
fi
echo "Leaving NEPTUNE"
cd ../work
ln -sf ../bin/neptune-sa
cd ..
echo "Done"