forked from CoppeliaRobotics/simROS2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·55 lines (45 loc) · 1.22 KB
/
install.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
#!/bin/sh
set -e
cd "`dirname "$0"`"
PLUGIN_NAME="$(basename "$(pwd)")"
if [ "x$COPPELIASIM_ROOT_DIR" = "x" ]; then
# see if we can determine it automatically
# (i.e. the plugin dir is in $COPPELIASIM_ROOT_DIR/programming/$dir)
COPPELIASIM_ROOT_DIR="$(cd ../.. ; pwd)"
if [ ! -d "$COPPELIASIM_ROOT_DIR/programming/include" ]; then
echo "error: \$COPPELIASIM_ROOT_DIR is not set" 1>&2
exit 1
fi
fi
if [ "`uname`" = "Darwin" ]; then
INSTALL_TARGET="$COPPELIASIM_ROOT_DIR/coppeliaSim.app/Contents/MacOS/"
DLEXT=dylib
else
INSTALL_TARGET="$COPPELIASIM_ROOT_DIR"
DLEXT=so
fi
if [ "x$BUILD_TARGET" = "x" ]; then
BUILD_TARGET=debug
fi
LIBRARY="lib$PLUGIN_NAME.$DLEXT"
if [ -f CMakeLists.txt ]; then
# plugin uses cmake
mkdir -p build
cd build
cmake ..
cmake --build .
cd ..
LIBRARY="build/$LIBRARY"
elif [ -f $PLUGIN_NAME.pro ]; then
# plugin uses qmake
qmake $PLUGIN_NAME.pro
make $BUILD_TARGET
elif [ -f makefile ]; then
# plugin uses make
make $BUILD_TARGET
else
echo "Unable to figure out the build system of $PLUGIN_NAME"
exit 1
fi
cp -v "$LIBRARY" "$INSTALL_TARGET"
if [ -f *.lua ]; then cp -v *.lua "$COPPELIASIM_ROOT_DIR/lua/"; fi