From 4861667440d2d0bc926ea0b07192ecfe2003b2e9 Mon Sep 17 00:00:00 2001 From: Kevin Harrington Date: Sun, 7 Jan 2024 10:10:16 -0500 Subject: [PATCH 1/6] Updating the build scripts for M1 --- .github/workflows/main.yml | 11 +++++ .github/workflows/release.yml | 21 +++++++++ build-mac-m1.sh | 81 +++++++++++++++++++++++++++++++++++ build-mac-x86.sh | 80 ++++++++++++++++++++++++++++++++++ build-mac.sh | 81 ++--------------------------------- 5 files changed, 197 insertions(+), 77 deletions(-) create mode 100755 build-mac-m1.sh create mode 100755 build-mac-x86.sh diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 11f9bb8..59e22f4 100755 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -44,3 +44,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 \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 787e8f9..aa57be2 100755 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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] @@ -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 . diff --git a/build-mac-m1.sh b/build-mac-m1.sh new file mode 100755 index 0000000..b22733d --- /dev/null +++ b/build-mac-m1.sh @@ -0,0 +1,81 @@ +#!/bin/bash +bash --version +g++ --version +echo "Mac M1 Build" +VER=$(cat mujocoRelease.txt) + +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 + + + diff --git a/build-mac-x86.sh b/build-mac-x86.sh new file mode 100755 index 0000000..7ead7e5 --- /dev/null +++ b/build-mac-x86.sh @@ -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 + + + diff --git a/build-mac.sh b/build-mac.sh index 3591a51..4d343b2 100755 --- a/build-mac.sh +++ b/build-mac.sh @@ -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 \ No newline at end of file From 1b6f0bbcd753965e7bb775e69839cb397f4a3877 Mon Sep 17 00:00:00 2001 From: Kevin Harrington Date: Sun, 7 Jan 2024 10:11:47 -0500 Subject: [PATCH 2/6] changing arch target --- build-mac-m1.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build-mac-m1.sh b/build-mac-m1.sh index b22733d..a0b8b39 100755 --- a/build-mac-m1.sh +++ b/build-mac-m1.sh @@ -4,7 +4,7 @@ g++ --version echo "Mac M1 Build" VER=$(cat mujocoRelease.txt) -TYPE=macosx-x86_64 +TYPE=macosx-arm64 ARCHIVE=mujoco-$VER-macos-universal2.dmg URL=https://github.com/deepmind/mujoco/releases/download/$VER/$ARCHIVE echo "$URL" @@ -72,8 +72,8 @@ echo "ls -al $JAVADIR../resources/" ls -al $JAVADIR../resources/ cd $SCRIPT_DIR/ -echo "Resource File: " - +echo "Resource Files: " +ls -al $JAVADIR../resources/ ls -al $JAVADIR../resources/$TYPE ./gradlew jar --stacktrace test From b34b4e974198ddc05bb587e5de28cb60cc7b7f94 Mon Sep 17 00:00:00 2001 From: Kevin Harrington Date: Sun, 7 Jan 2024 10:12:58 -0500 Subject: [PATCH 3/6] make a PR test --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 59e22f4..0c03c26 100755 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -4,7 +4,7 @@ name: CI on: push: branches: - - main + - * jobs: linux: From c5323a7aa60b759466aa91289943a13f02056d90 Mon Sep 17 00:00:00 2001 From: Kevin Harrington Date: Sun, 7 Jan 2024 10:14:28 -0500 Subject: [PATCH 4/6] Update main.yml --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0c03c26..277c019 100755 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -4,7 +4,7 @@ name: CI on: push: branches: - - * + -* jobs: linux: @@ -54,4 +54,4 @@ jobs: java-version: '8' distribution: 'zulu' - name: Build - run: bash build-mac.sh \ No newline at end of file + run: bash build-mac.sh From 47a5bbc69e118f88ee42614e932a4e3d6dd04343 Mon Sep 17 00:00:00 2001 From: Kevin Harrington Date: Sun, 7 Jan 2024 10:16:05 -0500 Subject: [PATCH 5/6] adding star --- build-mac-m1.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-mac-m1.sh b/build-mac-m1.sh index a0b8b39..c90f228 100755 --- a/build-mac-m1.sh +++ b/build-mac-m1.sh @@ -73,7 +73,7 @@ ls -al $JAVADIR../resources/ cd $SCRIPT_DIR/ echo "Resource Files: " -ls -al $JAVADIR../resources/ +ls -al $JAVADIR../resources/* ls -al $JAVADIR../resources/$TYPE ./gradlew jar --stacktrace test From 28f8dcd2827de5784510c4d2a82384bfffad3b91 Mon Sep 17 00:00:00 2001 From: Kevin Harrington Date: Sun, 7 Jan 2024 10:17:25 -0500 Subject: [PATCH 6/6] on push --- .github/workflows/main.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 277c019..2aba913 100755 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,9 +2,7 @@ name: CI on: - push: - branches: - -* + push jobs: linux: