-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·46 lines (35 loc) · 1.24 KB
/
setup.sh
File metadata and controls
executable file
·46 lines (35 loc) · 1.24 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
#!/bin/bash
# Note: only run this script when you know what you are doing.
# run it once from the current directory of this sub-project as ./setup.sh
source ~/.bashrc
# create /build directory if it does not exist
if [ ! -d "$(pwd)/build" ]; then
# If not, create the /build directory
mkdir "$(pwd)/build"
echo "/build directory created."
else
echo "/build directory already exists."
fi
# check if
# check if DISPLAYRT_ROS2_WS environment variable is set to the current directory
if [ "$DISPLAYRT_ROS2_WS" != "$(pwd)" ]; then
echo "DISPLAYRT_ROS2_WS environment variable is not set to the current directory."
echo "export DISPLAYRT_ROS2_WS=$(pwd)" >> ~/.bashrc
else
echo "DISPLAYRT_ROS2_WS environment variable is set to the current directory."
fi
# check if LD_LIBRARY_PATH includes \$DISPLAYRT_ROS2_WS/build
if [[ ":$LD_LIBRARY_PATH:" != *":$DISPLAYRT_ROS2_WS/build:"* ]]; then
echo "LD_LIBRARY_PATH does not include \$DISPLAYRT_ROS2_WS/build."
echo "export LD_LIBRARY_PATH=\$DISPLAYRT_ROS2_WS/build:\$LD_LIBRARY_PATH" >> ~/.bashrc
else
echo "LD_LIBRARY_PATH includes \$DISPLAYRT_ROS2_WS/build."
fi
source ~/.bashrc
# Enter the /build directory
cd "$(pwd)/build"
# Compile the cmake project
cmake ..
make
# Exit
exit 0