-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·85 lines (81 loc) · 2.7 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·85 lines (81 loc) · 2.7 KB
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
#!/bin/bash
#
# Define how to build the libraries and executables:
if [[ -z "${BUILD_TYPE}" ]]; then
BUILD_TYPE="Debug"
fi
echo "Using BUILD_TYPE = $BUILD_TYPE"
if [[ -z "${ENABLE_PFUNIT}" ]]; then
ENABLE_PFUNIT=ON
fi
echo "Using ENABLE_PFUNIT = $ENABLE_PFUNIT"
Fortran_COMPILER=gfortran
LIBSUFFIX="so"
GENERATOR_FLAGS=""
if [[ "$OSTYPE" == "linux-gnu" ]]; then
LIBSUFFIX="so"
elif [[ "$OSTYPE" == "darwin"* ]]; then
LIBSUFFIX="dylib"
elif [[ "$OSTYPE" == "CYGWIN"* ]]; then
LIBSUFFIX="dll"
elif [[ "$OSTYPE" == "MINGW"* ]]; then
LIBSUFFIX="dll"
elif [[ "$OSTYPE" == "msys"* ]]; then
LIBSUFFIX="dll"
GENERATOR_FLAGS="-G MSYS Makefiles"
fi
################################################################################
# #
# Build pFUnit #
# #
################################################################################
if [[ "$ENABLE_PFUNIT" == "ON" ]]; then
git submodule update --init --recursive || exit
cd pFUnit || exit
# Create the build directory if it does not exist
if [[ ! -d "build" ]]; then
mkdir build
else
rm -rf build/*
fi
cd build || exit
echo "Updating cmake"
export PFUNIT_DIR=../pFUnit/build/installed
export FC=$Fortran_COMPILER
cmake -DSKIP_MPI=yes "$GENERATOR_FLAGS" ../
echo "Building pFUnit"
cmake --build .
cmake --install .
cd ../ || exit
echo "Leaving pFUnit"
cd ../ || exit
else
echo "ENABLE_PFUNIT is 'OFF'. Skipping. Set to 'ON' to add it."
fi
################################################################################
# #
# Build libslam #
# #
################################################################################
# Create the build directory if it does not exist
if [[ ! -d "build" ]]; then
mkdir build
else
rm -rf build/*
fi
cd build || exit
echo "Executing cmake"
cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_Fortran_COMPILER=$Fortran_COMPILER -DENABLE_OpenMP_SUPPORT=ON -DENABLE_POSTGRESQL_SUPPORT=ON -DENABLE_PFUNIT="$ENABLE_PFUNIT" "$GENERATOR_FLAGS" ../
echo "Building libslam"
cmake --build .
cmake --install .
if [[ $? -ne 0 ]]; then
echo "Could not build libslam. Exiting."
exit $?
fi
echo "Manually preparing 'lib' and 'include' directories"
cd ../ || exit
ln -sf build/include include || exit
ln -sf build/lib lib || exit
echo "Leaving libslam"
echo "Done with $BUILD_TYPE build"