Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating the build scripts for M1 #4

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
name: CI

on:
push:
branches:
- main
push

jobs:
linux:
Expand Down Expand Up @@ -44,3 +42,14 @@ jobs:
distribution: 'zulu'
- name: Build
run: bash build-mac.sh
macM1:
runs-on: macos-13-xlarge
steps:
- name: Checkout
uses: actions/checkout@v1
- uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'zulu'
- name: Build
run: bash build-mac.sh
21 changes: 21 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,22 @@ jobs:
with:
name: mac-lib
path: src/main/resources/macosx-x86_64/*
macM1:
runs-on: macos-13-xlarge
steps:
- name: Checkout
uses: actions/checkout@v1
- uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'zulu'
- name: Build
run: bash build-mac.sh
- name: Upload math result for job Mac M1
uses: actions/upload-artifact@v3
with:
name: mac-lib-M1
path: src/main/resources/macosx-arm64/*
publish:
runs-on: ubuntu-latest
needs: [macos,windows,linux]
Expand Down Expand Up @@ -97,6 +113,11 @@ jobs:
with:
name: mac-lib
path: src/main/resources/macosx-x86_64/
- name: Download math result for job Mac M1
uses: actions/download-artifact@v3
with:
name: mac-lib-M1
path: src/main/resources/macosx-arm64/
- name: Print Working Dir
run: |
ls -al .
Expand Down
81 changes: 81 additions & 0 deletions build-mac-m1.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#!/bin/bash
bash --version
g++ --version
echo "Mac M1 Build"
VER=$(cat mujocoRelease.txt)

TYPE=macosx-arm64
ARCHIVE=mujoco-$VER-macos-universal2.dmg
URL=https://github.com/deepmind/mujoco/releases/download/$VER/$ARCHIVE
echo "$URL"
SCRIPT_DIR=$( pwd )
BUILDDIR=/tmp/
mkdir -p $BUILDDIR
if [ -f "$BUILDDIR$ARCHIVE" ]; then
echo "$BUILDDIR$ARCHIVE exists."
else
rm -rf $BUILDDIR/mujoco*
curl -L --location-trusted https://github.com/deepmind/mujoco/releases/download/$VER/$ARCHIVE -o $BUILDDIR/$ARCHIVE
cd $BUILDDIR
mkdir mujoco
cd mujoco
hdiutil attach ../$ARCHIVE
find /Volumes/MuJoCo/ -name '*.dylib'
mkdir $BUILDDIR/mujoco/include
cp -R /Volumes/MuJoCo/mujoco.framework/Headers/ $BUILDDIR/mujoco/include/mujoco
mkdir $BUILDDIR/mujoco/lib/
cp /Volumes/MuJoCo/mujoco.framework/Versions/A/libmujoco.$VER.dylib $BUILDDIR/mujoco/lib/libmujoco.dylib

echo $BUILDDIR/mujoco/
ls -al $BUILDDIR/mujoco/
cd /tmp
echo /tmp
ls -al
cd $SCRIPT_DIR/
fi
set -e
echo "Include"
ls $BUILDDIR/mujoco/include/
ls $BUILDDIR/mujoco/include/mujoco/
echo "Lib"
ls $BUILDDIR/mujoco/lib/


JAVACPP_VER=1.5.7
JAVACPPDIR=javacpp-platform-$JAVACPP_VER-bin
JAVACPP=$JAVACPPDIR.zip
if [ -f "$JAVACPP" ]; then
echo "$JAVACPP exists."
else
curl -L --location-trusted https://github.com/bytedeco/javacpp/releases/download/$JAVACPP_VER/$JAVACPP -o $JAVACPP
7z x $JAVACPP
echo "JavaCPP:"
ls -al $JAVACPPDIR
cd $SCRIPT_DIR/

fi
JAVADIR=$SCRIPT_DIR/src/main/java/
cd $SCRIPT_DIR/src/main/java/
cp $BUILDDIR/mujoco/lib/* $JAVADIR/
mv $BUILDDIR/mujoco/include/mujoco $JAVADIR/
java -jar $SCRIPT_DIR/javacpp-platform-$JAVACPP_VER-bin/javacpp.jar org/mujoco/MuJoCoConfig.java
java -jar $SCRIPT_DIR/javacpp-platform-$JAVACPP_VER-bin/javacpp.jar -copylibs -copyresources -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
find $SCRIPT_DIR|grep $TYPE
mv $JAVADIR/org/mujoco/$TYPE/ $JAVADIR../resources/
cp $BUILDDIR/mujoco/lib/* $JAVADIR../resources/$TYPE/

echo "ls -al $JAVADIR../resources/"
ls -al $JAVADIR../resources/

cd $SCRIPT_DIR/
echo "Resource Files: "
ls -al $JAVADIR../resources/*
ls -al $JAVADIR../resources/$TYPE
./gradlew jar --stacktrace test



80 changes: 80 additions & 0 deletions build-mac-x86.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#!/bin/bash
bash --version
g++ --version
echo "Mac x86 Build"
VER=$(cat mujocoRelease.txt)
ARCH=x64
TYPE=macosx-x86_64
ARCHIVE=mujoco-$VER-macos-universal2.dmg
URL=https://github.com/deepmind/mujoco/releases/download/$VER/$ARCHIVE
echo "$URL"
SCRIPT_DIR=$( pwd )
BUILDDIR=/tmp/
mkdir -p $BUILDDIR
if [ -f "$BUILDDIR$ARCHIVE" ]; then
echo "$BUILDDIR$ARCHIVE exists."
else
rm -rf $BUILDDIR/mujoco*
curl -L --location-trusted https://github.com/deepmind/mujoco/releases/download/$VER/$ARCHIVE -o $BUILDDIR/$ARCHIVE
cd $BUILDDIR
mkdir mujoco
cd mujoco
hdiutil attach ../$ARCHIVE
find /Volumes/MuJoCo/ -name '*.dylib'
mkdir $BUILDDIR/mujoco/include
cp -R /Volumes/MuJoCo/mujoco.framework/Headers/ $BUILDDIR/mujoco/include/mujoco
mkdir $BUILDDIR/mujoco/lib/
cp /Volumes/MuJoCo/mujoco.framework/Versions/A/libmujoco.$VER.dylib $BUILDDIR/mujoco/lib/libmujoco.dylib

echo $BUILDDIR/mujoco/
ls -al $BUILDDIR/mujoco/
cd /tmp
echo /tmp
ls -al
cd $SCRIPT_DIR/
fi
set -e
echo "Include"
ls $BUILDDIR/mujoco/include/
ls $BUILDDIR/mujoco/include/mujoco/
echo "Lib"
ls $BUILDDIR/mujoco/lib/


JAVACPP_VER=1.5.7
JAVACPPDIR=javacpp-platform-$JAVACPP_VER-bin
JAVACPP=$JAVACPPDIR.zip
if [ -f "$JAVACPP" ]; then
echo "$JAVACPP exists."
else
curl -L --location-trusted https://github.com/bytedeco/javacpp/releases/download/$JAVACPP_VER/$JAVACPP -o $JAVACPP
7z x $JAVACPP
echo "JavaCPP:"
ls -al $JAVACPPDIR
cd $SCRIPT_DIR/

fi
JAVADIR=$SCRIPT_DIR/src/main/java/
cd $SCRIPT_DIR/src/main/java/
cp $BUILDDIR/mujoco/lib/* $JAVADIR/
mv $BUILDDIR/mujoco/include/mujoco $JAVADIR/
java -jar $SCRIPT_DIR/javacpp-platform-$JAVACPP_VER-bin/javacpp.jar org/mujoco/MuJoCoConfig.java
java -jar $SCRIPT_DIR/javacpp-platform-$JAVACPP_VER-bin/javacpp.jar -copylibs -copyresources -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
find $SCRIPT_DIR|grep $TYPE
mv $JAVADIR/org/mujoco/$TYPE/ $JAVADIR../resources/
cp $BUILDDIR/mujoco/lib/* $JAVADIR../resources/$TYPE/

echo "ls -al $JAVADIR../resources/"
ls -al $JAVADIR../resources/

cd $SCRIPT_DIR/
echo "Resource File: "
ls -al $JAVADIR../resources/$TYPE
./gradlew jar --stacktrace test



81 changes: 4 additions & 77 deletions build-mac.sh
Original file line number Diff line number Diff line change
@@ -1,80 +1,7 @@
#!/bin/bash
bash --version
g++ --version
echo "Windows Build"
VER=$(cat mujocoRelease.txt)
ARCH=x64
TYPE=macosx-x86_64
ARCHIVE=mujoco-$VER-macos-universal2.dmg
URL=https://github.com/deepmind/mujoco/releases/download/$VER/$ARCHIVE
echo "$URL"
SCRIPT_DIR=$( pwd )
BUILDDIR=/tmp/
mkdir -p $BUILDDIR
if [ -f "$BUILDDIR$ARCHIVE" ]; then
echo "$BUILDDIR$ARCHIVE exists."
else
rm -rf $BUILDDIR/mujoco*
curl -L --location-trusted https://github.com/deepmind/mujoco/releases/download/$VER/$ARCHIVE -o $BUILDDIR/$ARCHIVE
cd $BUILDDIR
mkdir mujoco
cd mujoco
hdiutil attach ../$ARCHIVE
find /Volumes/MuJoCo/ -name '*.dylib'
mkdir $BUILDDIR/mujoco/include
cp -R /Volumes/MuJoCo/mujoco.framework/Headers/ $BUILDDIR/mujoco/include/mujoco
mkdir $BUILDDIR/mujoco/lib/
cp /Volumes/MuJoCo/mujoco.framework/Versions/A/libmujoco.$VER.dylib $BUILDDIR/mujoco/lib/libmujoco.dylib

echo $BUILDDIR/mujoco/
ls -al $BUILDDIR/mujoco/
cd /tmp
echo /tmp
ls -al
cd $SCRIPT_DIR/
fi
set -e
echo "Include"
ls $BUILDDIR/mujoco/include/
ls $BUILDDIR/mujoco/include/mujoco/
echo "Lib"
ls $BUILDDIR/mujoco/lib/


JAVACPP_VER=1.5.7
JAVACPPDIR=javacpp-platform-$JAVACPP_VER-bin
JAVACPP=$JAVACPPDIR.zip
if [ -f "$JAVACPP" ]; then
echo "$JAVACPP exists."
if [[ $(uname -m) == 'arm64' ]]; then
bash build-mac-m1.sh
else
curl -L --location-trusted https://github.com/bytedeco/javacpp/releases/download/$JAVACPP_VER/$JAVACPP -o $JAVACPP
7z x $JAVACPP
echo "JavaCPP:"
ls -al $JAVACPPDIR
cd $SCRIPT_DIR/

fi
JAVADIR=$SCRIPT_DIR/src/main/java/
cd $SCRIPT_DIR/src/main/java/
cp $BUILDDIR/mujoco/lib/* $JAVADIR/
mv $BUILDDIR/mujoco/include/mujoco $JAVADIR/
java -jar $SCRIPT_DIR/javacpp-platform-$JAVACPP_VER-bin/javacpp.jar org/mujoco/MuJoCoConfig.java
java -jar $SCRIPT_DIR/javacpp-platform-$JAVACPP_VER-bin/javacpp.jar -copylibs -copyresources -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
find $SCRIPT_DIR|grep $TYPE
mv $JAVADIR/org/mujoco/$TYPE/ $JAVADIR../resources/
cp $BUILDDIR/mujoco/lib/* $JAVADIR../resources/$TYPE/

echo "ls -al $JAVADIR../resources/"
ls -al $JAVADIR../resources/

cd $SCRIPT_DIR/
echo "Resource File: "
ls -al $JAVADIR../resources/$TYPE
./gradlew jar --stacktrace test



bash build-mac-x86.sh
fi
Loading