forked from CommonWealthRobotics/mujoco-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-linux.sh
executable file
·67 lines (56 loc) · 2.06 KB
/
build-linux.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
#!/bin/bash
echo "Linux Build"
VER=$(cat mujocoRelease.txt)
TYPE=linux-x86_64
ARCHIVE=mujoco-$VER-$TYPE.tar.gz
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
JAVADIR=$SCRIPT_DIR/src/main/java/
BUILDDIR=$SCRIPT_DIR/cppbuild
if [ -f "$SCRIPT_DIR/$ARCHIVE" ]; then
echo "$ARCHIVE exists."
else
wget https://github.com/deepmind/mujoco/releases/download/$VER/$ARCHIVE -O $SCRIPT_DIR/$ARCHIVE
fi
rm -rf $SCRIPT_DIR/cppbuild
mkdir -p $BUILDDIR
cd $BUILDDIR
tar -xf $SCRIPT_DIR/$ARCHIVE
mv $BUILDDIR/mujoco-$VER $BUILDDIR/mujoco/
rm $BUILDDIR/mujoco/lib/libmujoco.so
mv $BUILDDIR/mujoco/lib/libmujoco.so.$VER $BUILDDIR/mujoco/lib/libmujoco.so
mv $BUILDDIR/mujoco/lib/* $JAVADIR/
mv $BUILDDIR/mujoco/include/mujoco $JAVADIR/
cd $SCRIPT_DIR/
set -e
JAVACPP_VER=1.5.7
JAVACPP=javacpp-platform-$JAVACPP_VER-bin.zip
if [ -f "$JAVACPP" ]; then
echo "$JAVACPP exists."
else
wget https://github.com/bytedeco/javacpp/releases/download/$JAVACPP_VER/$JAVACPP -O $JAVACPP
unzip $JAVACPP
fi
echo "Include"
ls $JAVADIR/mujoco/
echo "Lib"
ls $BUILDDIR/
cd $JAVADIR
echo "JavaCPP configs:"
$JAVA_HOME/bin/java -jar $SCRIPT_DIR/javacpp-platform-$JAVACPP_VER-bin/javacpp.jar -Dcompiler.includepath=$BUILDDIR/include/ -print properties.includepath
$JAVA_HOME/bin/java -jar $SCRIPT_DIR/javacpp-platform-$JAVACPP_VER-bin/javacpp.jar org/mujoco/MuJoCoConfig.java
echo "Start compile \n\n"
$JAVA_HOME/bin/java -jar $SCRIPT_DIR/javacpp-platform-$JAVACPP_VER-bin/javacpp.jar -copylibs -copyresources -Xcompiler "-no-pie" -Xcompiler "-I$JAVADIR" -Xcompiler "-L$JAVADIR" org/mujoco/MuJoCoLib.java
LIBPATH=$PWD/../resources/$TYPE/
mkdir -p $SCRIPT_DIR/src/main/resources/
rm -rf $JAVADIR../resources/$TYPE
mv $JAVADIR/org/mujoco/$TYPE/ $JAVADIR../resources/
mv $JAVADIR/libmujoco.so $JAVADIR../resources/$TYPE/
rm -rf $JAVADIR/mujoco
echo "ls -al $JAVADIR../resources/"
ls -al $JAVADIR../resources/
cd $SCRIPT_DIR/
echo "Resources: "
ls -al $JAVADIR../resources/$TYPE
#mv $BUILDDIR/mujoco/ $BUILDDIR/mujoco-back/
./gradlew jar --stacktrace test
#mv $BUILDDIR/mujoco-back/ $BUILDDIR/mujoco/