-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·78 lines (62 loc) · 1.33 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
#!/bin/bash
#
INSTALL_PATH="$HOME/opt/botjs"
#
BOTJS_DIR=$(pwd)
# Parallel compilation
CPU_NUMBER=4
# Release or Debug
BUILD_TYPE="Release"
#
# Build function
#
function build_cmake_project {
# An argument must be passed
if [ $# -eq 0 ]; then
echo "* No arguments provided to build_project"
exit 1
fi
project_path=$1
echo ""
echo "-------------"
echo "++ $project_path"
echo "-------------"
# The argument must be a directory
if [[ ! -d $project_path ]]; then
echo "* [$project_path] must be a directory"
exit 1
fi
cd $project_path
# Check the build directory
if [ ! -d build ]; then
mkdir build
fi
cd build
# Cmake execution
cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_PATH -DCMAKE_BUILD_TYPE=$BUILD_TYPE ..
if [ $? -ne 0 ]; then
echo "* Cmake fail"
exit 1
fi
# make
make -j$CPU_NUMBER
if [ $? -ne 0 ]; then
echo "* Make fail"
exit 1
fi
# install
make install
if [ $? -ne 0 ]; then
echo "* Install fail"
exit 1
fi
cd $BOTJS_DIR
}
# ===================
# === Build steps ===
build_cmake_project core
build_cmake_project block/spy
build_cmake_project block/shell
build_cmake_project block/viewer3d
build_cmake_project block/joint
echo '-- Build OK'