-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.sh
executable file
·28 lines (20 loc) · 945 Bytes
/
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
#!/bin/bash
# Exit immediately if a command exits with a non-zero status.
set -e
# If mainly using one ROS distro, it may come in handy to set a symbolic link
# to your preferred distro:
# -> sudo ln -sr /opt/ros/<distro> /opt/ros/ros1
# When switching between ROS workspaces using different distros, set ROS_DISTRO
# accordingly before running this script or alter the default value below.
# Always prefer environment variable ROS_DISTRO
# over default value (comes after the dash).
ROS_DISTRO_NAME=${ROS_DISTRO:-ros1}
# Build command for ROS workspace
BUILD_CMD="catkin build --cmake-args -DCMAKE_BUILD_TYPE="Release""
# BUILD_CMD="catkin_make -DCMAKE_BUILD_TYPE="Release""
# echo command before executing it
print_and_execute() { echo " -> run '${1}'"; eval ${1}; }
print_and_execute "source \"/opt/ros/${ROS_DISTRO_NAME}/setup.bash\""
print_and_execute "${BUILD_CMD} $@"
unset ROS_DISTRO_NAME BUILD_CMD
unset -f print_and_execute