-
Notifications
You must be signed in to change notification settings - Fork 61
/
build.sh
executable file
·77 lines (70 loc) · 2.06 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
#!/bin/bash
SCRIPT=$(readlink -f $0)
SCRIPTPATH=`dirname $SCRIPT`
display_usage() {
echo "Usage: "
echo ""
echo "build.sh [--with-tests] [--standalone] [--clean-install]"
echo ""
echo "Options:"
echo "--with-tests - build with tests"
echo "--standalone - standalone version"
echo "--clean-install - makes a clean installation, removes install directory before deploying"
}
if [ ! -d "$SCRIPTPATH/src/ros2cs" ]; then
echo "Pull repositories with 'pull_repositories.sh' first."
exit 1
fi
OPTIONS=""
STANDALONE=0
TESTS=0
CLEAN_INSTALL=0
while [[ $# -gt 0 ]]; do
key="$1"
case $key in
-t|--with-tests)
OPTIONS="$OPTIONS --with-tests"
TESTS=1
shift # past argument
;;
-s|--standalone)
if ! hash patchelf 2>/dev/null ; then
echo "Patchelf missing. Standalone build requires patchelf. Install it via apt 'sudo apt install patchelf'."
exit 1
fi
OPTIONS="$OPTIONS --standalone"
STANDALONE=1
shift # past argument
;;
-c|--clean-install)
CLEAN_INSTALL=1
shift # past argument
;;
-h|--help)
display_usage
exit 0
shift # past argument
;;
*) # unknown option
shift # past argument
;;
esac
done
if [ $CLEAN_INSTALL == 1 ]; then
echo "Cleaning install directory..."
rm -rf $SCRIPTPATH/install/*
fi
if [ $STANDALONE == 1 ]; then
python3 $SCRIPTPATH/src/scripts/metadata_generator.py --standalone
else
python3 $SCRIPTPATH/src/scripts/metadata_generator.py
fi
if $SCRIPTPATH/src/ros2cs/build.sh $OPTIONS; then
mkdir -p $SCRIPTPATH/install/asset && cp -R $SCRIPTPATH/src/Ros2ForUnity $SCRIPTPATH/install/asset/
$SCRIPTPATH/deploy_unity_plugins.sh $SCRIPTPATH/install/asset/Ros2ForUnity/Plugins/
cp $SCRIPTPATH/src/Ros2ForUnity/metadata_ros2cs.xml $SCRIPTPATH/install/asset/Ros2ForUnity/Plugins/Linux/x86_64/metadata_ros2cs.xml
cp $SCRIPTPATH/src/Ros2ForUnity/metadata_ros2cs.xml $SCRIPTPATH/install/asset/Ros2ForUnity/Plugins/metadata_ros2cs.xml
else
echo "Ros2cs build failed!"
exit 1
fi