forked from Tudat/tudatBundle
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathbuild.sh
88 lines (76 loc) · 2.84 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
#!/usr/bin/env bash
##################################################################
##################################################################
# This script is used to build the TU Delft Astrodynamics Toolbox
# Build options
# -d: build directory
# -j: number of processors
# -t: build type (Release, Debug)
# -c: clean build
##################################################################
##################################################################
echo "DEPRECATED - Use build.py instead"
exit 0
# allow input to set compilation config
while getopts d:j:t:c flag
do
case "${flag}" in
d) build_dir=${OPTARG};;
j) number_of_processors=${OPTARG};;
t) build_type=${OPTARG};;
c)
echo -en "\n\n\e[33m[USER INPUT REQUIRED] You have requested a clean build. Are you sure? [y/N]\e[0m "
read -r response
if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]]
then
clean_build=1
echo -e "\n\n\e[33m ---> Proceeding with a clean build!\e[0m\n\n"
else
clean_build=0
echo -e "\n\n\e[33m ---> Clean build cancelled. Proceeding with regular build.\e[0m\n\n"
fi
;;
esac
done
##################################################################
##################################################################
# Declare build options
##################################################################
##################################################################
# env control arguments
BUILD_DIR="${build_dir:-build}"
RUN_TESTS="${run_tests:-1}"
BUILD_TESTS="${build_tests:-1}"
NUMBER_OF_PROCESSORS=${number_of_processors:-1}
CLEAN_BUILD=${clean_build:-0}
BUILD_TYPE=${build_type:-Release}
# build directory
mkdir -p "${BUILD_DIR}"
cd "${BUILD_DIR}" || {
echo 'entry into build folder failed'
exit 1
}
##################################################################
##################################################################
# Configure CMake
##################################################################
##################################################################
# configuration step
cmake -DCMAKE_PREFIX_PATH="${CONDA_PREFIX}" \
-DCMAKE_CXX_STANDARD=14 \
-DBoost_NO_BOOST_CMAKE=ON \
-DCMAKE_BUILD_TYPE="${BUILD_TYPE}" \
-DTUDAT_BUILD_TESTS="${BUILD_TESTS}" \
..
##################################################################
##################################################################
# Build
##################################################################
##################################################################
# if required by user, clean
if [ "${CLEAN_BUILD}" = "1" ]; then
cmake --build . --target clean -j"${NUMBER_OF_PROCESSORS}"
printf "\nClean finished\n\n"
fi
# build
cmake --build . -j"${NUMBER_OF_PROCESSORS}"