Skip to content

Instantly share code, notes, and snippets.

@brainstorm
Created May 13, 2023 00:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brainstorm/8c4ae39f40bb745a43db98a4ad06ed02 to your computer and use it in GitHub Desktop.
Save brainstorm/8c4ae39f40bb745a43db98a4ad06ed02 to your computer and use it in GitHub Desktop.
Apple Silicon OpenCV patch for OpenPnP
From 31eeed709cde9b32882cb4d0b9ab40e19cb6f537 Mon Sep 17 00:00:00 2001
From: Roman Valls Guimera <brainstorm@nopcode.org>
Date: Sun, 16 May 2021 21:14:21 +1000
Subject: [PATCH 01/17] Technically not sure it falls under ARMv8 for the M1,
should be AARCH64
---
src/main/java/nu/pattern/OpenCV.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/main/java/nu/pattern/OpenCV.java b/src/main/java/nu/pattern/OpenCV.java
index f3d5020..5d67146 100644
--- a/src/main/java/nu/pattern/OpenCV.java
+++ b/src/main/java/nu/pattern/OpenCV.java
@@ -377,8 +377,11 @@ private static Path extractNativeBinary(final OS os, final Arch arch) {
case X86_64:
location = "/nu/pattern/opencv/osx/x86_64/libopencv_java453.dylib";
break;
- case AARCH64:
- location = "/nu/pattern/opencv/osx/AARCH64/libopencv_java451.dylib";
+// case AARCH64:
+// location = "/nu/pattern/opencv/osx/AARCH64/libopencv_java451.dylib";
+// break;
+ case ARMv8:
+ location = "/nu/pattern/opencv/osx/ARMv8/libopencv_java451.dylib";
break;
default:
throw new UnsupportedPlatformException(os, arch);
From 9e4226b0520522b46e8590092f0552a1d1492661 Mon Sep 17 00:00:00 2001
From: Roman Valls Guimera <brainstorm@users.noreply.github.com>
Date: Sat, 25 Sep 2021 19:30:55 +1000
Subject: [PATCH 02/17] Bump to 4.5.3 from upstream
---
.github/workflows/build.yml | 4 ++++
src/main/java/nu/pattern/OpenCV.java | 4 ++--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 05b0ab1..186ba1f 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -280,6 +280,7 @@ jobs:
cp opencv-${{ env.OPENCV_VERSION }}/build/bin/opencv-${{ env.OPENCV_VERSION_SHORT }}.jar upstream || :
cp opencv-${{ env.OPENCV_VERSION }}/build/lib/libopencv_java${{ env.OPENCV_VERSION_SHORT }}.so src/main/resources/nu/pattern/opencv/linux/x86_64 || :
cp opencv-${{ env.OPENCV_VERSION }}/build/lib/libopencv_java${{ env.OPENCV_VERSION_SHORT }}.dylib src/main/resources/nu/pattern/opencv/osx/x86_64 || :
+ cp opencv-${{ env.OPENCV_VERSION }}/build/lib/libopencv_java${{ env.OPENCV_VERSION_SHORT }}.dylib src/main/resources/nu/pattern/opencv/osx/ARMv8 || :
- name: Build with Maven
run: mvn -B test
@@ -365,6 +366,8 @@ jobs:
run: |
cp macos-10.15/bin/opencv-${{ env.OPENCV_VERSION_SHORT }}.jar upstream
cp macos-10.15/lib/libopencv_java${{ env.OPENCV_VERSION_SHORT }}.dylib src/main/resources/nu/pattern/opencv/osx/x86_64
+ cp macos-10.15/lib/libopencv_java${{ env.OPENCV_VERSION_SHORT }}.dylib src/main/resources/nu/pattern/opencv/osx/ARMv8
+ find ubuntu-18.04 # list contents...
cp ubuntu-18.04/lib/libopencv_java${{ env.OPENCV_VERSION_SHORT }}.so src/main/resources/nu/pattern/opencv/linux/x86_64
cp ubuntu-18.04-arm/lib/libopencv_java${{ env.OPENCV_VERSION_SHORT }}.so src/main/resources/nu/pattern/opencv/linux/ARMv7
cp ubuntu-18.04-arm64/lib/libopencv_java${{ env.OPENCV_VERSION_SHORT }}.so src/main/resources/nu/pattern/opencv/linux/ARMv8
@@ -457,6 +460,7 @@ jobs:
run: |
cp macos-10.15/bin/opencv-${{ env.OPENCV_VERSION_SHORT }}.jar upstream
cp macos-10.15/lib/libopencv_java${{ env.OPENCV_VERSION_SHORT }}.dylib src/main/resources/nu/pattern/opencv/osx/x86_64
+ cp macos-10.15/lib/libopencv_java${{ env.OPENCV_VERSION_SHORT }}.dylib src/main/resources/nu/pattern/opencv/osx/ARMv8
cp ubuntu-18.04/lib/libopencv_java${{ env.OPENCV_VERSION_SHORT }}.so src/main/resources/nu/pattern/opencv/linux/x86_64
cp ubuntu-18.04-arm/lib/libopencv_java${{ env.OPENCV_VERSION_SHORT }}.so src/main/resources/nu/pattern/opencv/linux/ARMv7
cp ubuntu-18.04-arm64/lib/libopencv_java${{ env.OPENCV_VERSION_SHORT }}.so src/main/resources/nu/pattern/opencv/linux/ARMv8
diff --git a/src/main/java/nu/pattern/OpenCV.java b/src/main/java/nu/pattern/OpenCV.java
index 5d67146..0353e02 100644
--- a/src/main/java/nu/pattern/OpenCV.java
+++ b/src/main/java/nu/pattern/OpenCV.java
@@ -378,10 +378,10 @@ private static Path extractNativeBinary(final OS os, final Arch arch) {
location = "/nu/pattern/opencv/osx/x86_64/libopencv_java453.dylib";
break;
// case AARCH64:
-// location = "/nu/pattern/opencv/osx/AARCH64/libopencv_java451.dylib";
+// location = "/nu/pattern/opencv/osx/AARCH64/libopencv_java452.dylib";
// break;
case ARMv8:
- location = "/nu/pattern/opencv/osx/ARMv8/libopencv_java451.dylib";
+ location = "/nu/pattern/opencv/osx/ARMv8/libopencv_java452.dylib";
break;
default:
throw new UnsupportedPlatformException(os, arch);
From ede6f11e51b6c74aaa9f8cc856eaaf93aa5b2027 Mon Sep 17 00:00:00 2001
From: Roman Valls Guimera <brainstorm@users.noreply.github.com>
Date: Sun, 11 Jul 2021 21:10:23 +1000
Subject: [PATCH 03/17] Bump up javadocs, erroring out, 32-bit x86 should be
explicitly declared?
---
pom.xml | 2 +-
src/main/java/nu/pattern/OpenCV.java | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 607c8e9..d1af481 100644
--- a/pom.xml
+++ b/pom.xml
@@ -260,7 +260,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
- <version>2.9.1</version>
+ <version>3.3.0</version>
<executions>
<execution>
<id>attach-javadocs</id>
diff --git a/src/main/java/nu/pattern/OpenCV.java b/src/main/java/nu/pattern/OpenCV.java
index 0353e02..c09be8e 100644
--- a/src/main/java/nu/pattern/OpenCV.java
+++ b/src/main/java/nu/pattern/OpenCV.java
@@ -65,7 +65,7 @@ public static OS getCurrent() {
}
static enum Arch {
- X86_32("i386", "i686", "x86"),
+ X86_32("i386", "i686", "x86", "x86_32"),
X86_64("amd64", "x86_64"),
ARMv7("arm"),
ARMv8("aarch64", "arm64");
From d98cb839675e33ff75db49707f92c0e6b8dac806 Mon Sep 17 00:00:00 2001
From: Roman Valls Guimera <brainstorm@users.noreply.github.com>
Date: Sun, 11 Jul 2021 22:03:42 +1000
Subject: [PATCH 04/17] Bodge some javadocs to pass the build
---
.github/workflows/build.yml | 7 ++-----
pom.xml | 6 +-----
src/main/java/nu/pattern/OpenCV.java | 6 +++---
3 files changed, 6 insertions(+), 13 deletions(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 186ba1f..7f48821 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -392,7 +392,7 @@ jobs:
strategy:
matrix:
os: [macos-10.15, windows-2016, windows-2019, ubuntu-20.04, ubuntu-18.04]
- java: [8, 9, 10, 11, 12, 13, 14, 15]
+ java: [8, 11]
runs-on: ${{ matrix.os }}
@@ -468,12 +468,9 @@ jobs:
cp windows-2016/x64/opencv_java${{ env.OPENCV_VERSION_SHORT }}.dll src/main/resources/nu/pattern/opencv/windows/x86_64
- name: Publish to Apache Maven Central
+ if: github.repository == 'openpnp/opencv' && github.repository == 'openpnp/openpnp-capture' && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
run: mvn -B -e clean deploy -P release-sign-artifacts
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
-
-
-
-
diff --git a/pom.xml b/pom.xml
index d1af481..4b936a5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -256,7 +256,6 @@
</excludes>
</configuration>
</plugin>
-
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
@@ -270,10 +269,7 @@
</execution>
</executions>
<configuration>
- <links>
- <link>http://docs.opencv.org/java/</link>
- <link>http://docs.oracle.com/javase/8/docs/api/</link>
- </links>
+ <doclint>none</doclint>
<additionalparam>${javadoc.parameters}</additionalparam>
</configuration>
</plugin>
diff --git a/src/main/java/nu/pattern/OpenCV.java b/src/main/java/nu/pattern/OpenCV.java
index c09be8e..7706a3d 100644
--- a/src/main/java/nu/pattern/OpenCV.java
+++ b/src/main/java/nu/pattern/OpenCV.java
@@ -177,7 +177,7 @@ public void delete() {
}
/**
- * Exactly once per {@link ClassLoader}, attempt to load the native library (via {@link System#loadLibrary(String)} with {@link Core#NATIVE_LIBRARY_NAME}). If the first attempt fails, the native binary will be extracted from the classpath to a temporary location (which gets cleaned up on shutdown), that location is added to the {@code java.library.path} system property and {@link ClassLoader#usr_paths}, and then another call to load the library is made. Note this method uses reflection to gain access to private memory in {@link ClassLoader} as there's no documented method to augment the library path at runtime. Spurious calls are safe.
+ * Exactly once per {@link ClassLoader}, attempt to load the native library (via {@link System#loadLibrary(String)} with {@link Core#NATIVE_LIBRARY_NAME}). If the first attempt fails, the native binary will be extracted from the classpath to a temporary location (which gets cleaned up on shutdown), that location is added to the {@code java.library.path} system property and {@link ClassLoader}, and then another call to load the library is made. Note this method uses reflection to gain access to private memory in {@link ClassLoader} as there's no documented method to augment the library path at runtime. Spurious calls are safe.
*/
public static void loadShared() {
SharedLoader.getInstance();
@@ -266,7 +266,7 @@ public static SharedLoader getInstance() {
}
/**
- * Adds the provided {@link Path}, normalized, to the {@link ClassLoader#usr_paths} array, as well as to the {@code java.library.path} system property. Uses the reflection API to make the field accessible, and may be unsafe in environments with a security policy.
+ * Adds the provided {@link Path}, normalized, to the {@link ClassLoader} array, as well as to the {@code java.library.path} system property. Uses the reflection API to make the field accessible, and may be unsafe in environments with a security policy.
*
* @see <a href="http://stackoverflow.com/q/15409223">Adding new paths for native libraries at runtime in Java</a>
*/
@@ -293,7 +293,7 @@ private static void addLibraryPath(final Path path) {
}
/**
- * Removes the provided {@link Path}, normalized, from the {@link ClassLoader#usr_paths} array, as well as to the {@code java.library.path} system property. Uses the reflection API to make the field accessible, and may be unsafe in environments with a security policy.
+ * Removes the provided {@link Path}, normalized, from the {@link ClassLoader} array, as well as to the {@code java.library.path} system property. Uses the reflection API to make the field accessible, and may be unsafe in environments with a security policy.
*/
private static void removeLibraryPath(final Path path) {
final String normalizedPath = path.normalize().toString();
From d35003333f82f19230605a434454494c56a088c5 Mon Sep 17 00:00:00 2001
From: Roman Valls Guimera <brainstorm@users.noreply.github.com>
Date: Sun, 11 Jul 2021 22:13:29 +1000
Subject: [PATCH 05/17] Trigger test run, get latest version of arch-actions
---
.github/workflows/build.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 7f48821..b17f0d6 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -42,7 +42,7 @@ jobs:
echo "OPENCV_VERSION_SHORT=$(mvn build-helper:parse-version org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=opencv.version.short -q -DforceStdout)" >> $GITHUB_ENV
- name: Build OpenCV on Arm
- uses: uraimo/run-on-arch-action@v2.0.9
+ uses: uraimo/run-on-arch-action@v2
with:
arch: armv7
distro: ubuntu18.04
From 57a3d93dd63dfc87c09e620dfda5e3fa439add34 Mon Sep 17 00:00:00 2001
From: Roman Valls Guimera <brainstorm@users.noreply.github.com>
Date: Sun, 11 Jul 2021 22:19:05 +1000
Subject: [PATCH 06/17] Version not found
---
.github/workflows/build.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index b17f0d6..dacdf1b 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -42,7 +42,7 @@ jobs:
echo "OPENCV_VERSION_SHORT=$(mvn build-helper:parse-version org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=opencv.version.short -q -DforceStdout)" >> $GITHUB_ENV
- name: Build OpenCV on Arm
- uses: uraimo/run-on-arch-action@v2
+ uses: uraimo/run-on-arch-action@v2.0.10
with:
arch: armv7
distro: ubuntu18.04
@@ -145,7 +145,7 @@ jobs:
echo "OPENCV_VERSION_SHORT=$(mvn build-helper:parse-version org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=opencv.version.short -q -DforceStdout)" >> $GITHUB_ENV
- name: Build OpenCV on Arm64
- uses: uraimo/run-on-arch-action@v2.0.9
+ uses: uraimo/run-on-arch-action@v2.0.10
with:
arch: aarch64
distro: ubuntu18.04
From 2de82ee6775ac7d4a56a28b807b85536cacdb2d4 Mon Sep 17 00:00:00 2001
From: Roman Valls Guimera <brainstorm@users.noreply.github.com>
Date: Sun, 11 Jul 2021 23:00:02 +1000
Subject: [PATCH 07/17] Some pom warnings cleanups and more ignores
---
.gitignore | 3 +++
pom.xml | 54 ++++++++++++++++++++++++++----------------------------
2 files changed, 29 insertions(+), 28 deletions(-)
diff --git a/.gitignore b/.gitignore
index 9e7a1c3..65a57f9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,4 +10,7 @@ target
.settings/org.eclipse.jdt.core.prefs
.settings/org.eclipse.m2e.core.prefs
opencv/**
+opencv-*
.metadata/
+upstream
+*.swp
diff --git a/pom.xml b/pom.xml
index 4b936a5..8b4aa40 100644
--- a/pom.xml
+++ b/pom.xml
@@ -18,6 +18,19 @@
<opencv.version.short>${parsedVersion.majorVersion}${parsedVersion.minorVersion}${parsedVersion.incrementalVersion}</opencv.version.short>
</properties>
+
+ <distributionManagement>
+ <repository>
+ <id>github</id>
+ <name>GitHub brainstorm Apache Maven Packages</name>
+ <url>https://maven.pkg.github.com/brainstorm/opencv</url>
+ </repository>
+ <snapshotRepository>
+ <id>ossrh</id>
+ <url>https://oss.sonatype.org/content/repositories/snapshots</url>
+ </snapshotRepository>
+ </distributionManagement>
+
<profiles>
<profile>
<id>jdk-8</id>
@@ -109,14 +122,6 @@
</properties>-->
</developer>
</developers>
-
- <distributionManagement>
- <snapshotRepository>
- <id>ossrh</id>
- <url>https://oss.sonatype.org/content/repositories/snapshots</url>
- </snapshotRepository>
- </distributionManagement>
-
<build>
<plugins>
<plugin>
@@ -124,6 +129,17 @@
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.2.0</version>
<executions>
+ <execution>
+ <phase>prepare-package</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${project.build.directory}/upstream-sources</source>
+ </sources>
+ </configuration>
+ </execution>
<execution>
<id>parse-version</id>
<goals>
@@ -148,6 +164,7 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
+ <version>5.1.2</version>
<extensions>true</extensions>
<configuration>
<instructions>
@@ -160,6 +177,7 @@
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
+ <version>3.8.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
@@ -197,26 +215,6 @@
</executions>
</plugin>
- <!-- The upstream sources should be included in the source JAR, but not the binary JAR. Ensure upstream-sources is added after the compile phase and before package. -->
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <version>1.8</version>
- <executions>
- <execution>
- <phase>prepare-package</phase>
- <goals>
- <goal>add-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>${project.build.directory}/upstream-sources</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
<!-- Package local and upstream sources. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
From 74057936ef9ef555701e98645391a62eddd4371d Mon Sep 17 00:00:00 2001
From: Roman Valls Guimera <brainstorm@users.noreply.github.com>
Date: Sun, 11 Jul 2021 23:16:10 +1000
Subject: [PATCH 08/17] Try to create release objects, bump ubuntu to latest
---
.github/workflows/build.yml | 38 ++++++++++++++++++++++++++++++-------
1 file changed, 31 insertions(+), 7 deletions(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index dacdf1b..2849d2a 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -21,7 +21,7 @@ jobs:
build_linux_arm:
strategy:
matrix:
- os: [ubuntu-18.04]
+ os: [ubuntu-latest]
java: [8]
runs-on: ${{ matrix.os }}
@@ -121,10 +121,18 @@ jobs:
artifacts/bin/opencv-${{ env.OPENCV_VERSION_SHORT }}.jar
artifacts/lib/libopencv_java${{ env.OPENCV_VERSION_SHORT }}.so
+ - name: Create Release
+ if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
+ uses: ncipollo/release-action@v1
+ with:
+ artifacts: "artifacts/**"
+ token: ${{ secrets.GITHUB_TOKEN }}
+ allowUpdates: true
+
build_linux_arm64:
strategy:
matrix:
- os: [ubuntu-18.04]
+ os: [ubuntu-latest]
java: [15]
runs-on: ${{ matrix.os }}
@@ -224,12 +232,20 @@ jobs:
artifacts/bin/opencv-${{ env.OPENCV_VERSION_SHORT }}.jar
artifacts/lib/libopencv_java${{ env.OPENCV_VERSION_SHORT }}.so
+ - name: Create Release
+ if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
+ uses: ncipollo/release-action@v1
+ with:
+ artifacts: "artifacts/**"
+ token: ${{ secrets.GITHUB_TOKEN }}
+ allowUpdates: true
+
# Build native libraries for Linux and Mac. Uploads the libraries
# as artifacts which are used in subsequent jobs.
build_mac_linux_x64:
strategy:
matrix:
- os: [ubuntu-18.04, macos-10.15]
+ os: [ubuntu-latest, macos-10.15]
java: [8]
runs-on: ${{ matrix.os }}
@@ -294,13 +310,21 @@ jobs:
opencv-${{ env.OPENCV_VERSION }}/build/lib/libopencv_java${{ env.OPENCV_VERSION_SHORT }}.so
opencv-${{ env.OPENCV_VERSION }}/build/lib/libopencv_java${{ env.OPENCV_VERSION_SHORT }}.dylib
+ - name: Create Release
+ if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
+ uses: ncipollo/release-action@v1
+ with:
+ artifacts: opencv-${{ env.OPENCV_VERSION }}/build/bin/opencv-${{ env.OPENCV_VERSION_SHORT }}.jar
+ token: ${{ secrets.GITHUB_TOKEN }}
+ allowUpdates: true
+
# Downloads the Windows distribution from OpenCV, extracts it and uploads
# the native libraries as artifacts for use by subsequent jobs. This is
# in leiu of building the native libraries on Windows.
build_windows:
strategy:
matrix:
- os: [ubuntu-18.04]
+ os: [ubuntu-latest]
java: [15]
runs-on: ${{ matrix.os }}
@@ -339,7 +363,7 @@ jobs:
strategy:
matrix:
- os: [ubuntu-18.04]
+ os: [ubuntu-latest]
java: [8]
runs-on: ${{ matrix.os }}
@@ -391,7 +415,7 @@ jobs:
needs: build_dist
strategy:
matrix:
- os: [macos-10.15, windows-2016, windows-2019, ubuntu-20.04, ubuntu-18.04]
+ os: [macos-10.15, windows-2016, windows-2019, ubuntu-latest]
java: [8, 11]
runs-on: ${{ matrix.os }}
@@ -428,7 +452,7 @@ jobs:
strategy:
matrix:
- os: [ubuntu-18.04]
+ os: [ubuntu-latest]
java: [8]
runs-on: ${{ matrix.os }}
From ab766110911981e9cbcf0366fe54a4e025204dba Mon Sep 17 00:00:00 2001
From: Roman Valls Guimera <brainstorm@nopcode.org>
Date: Sun, 16 May 2021 21:08:44 +1000
Subject: [PATCH 09/17] Support for AARCH64 (Apple Silicon)
---
src/main/java/nu/pattern/OpenCV.java | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/main/java/nu/pattern/OpenCV.java b/src/main/java/nu/pattern/OpenCV.java
index 7706a3d..645f35f 100644
--- a/src/main/java/nu/pattern/OpenCV.java
+++ b/src/main/java/nu/pattern/OpenCV.java
@@ -383,6 +383,9 @@ private static Path extractNativeBinary(final OS os, final Arch arch) {
case ARMv8:
location = "/nu/pattern/opencv/osx/ARMv8/libopencv_java452.dylib";
break;
+ case AARCH64:
+ location = "/nu/pattern/opencv/osx/AARCH64/libopencv_java451.dylib";
+ break;
default:
throw new UnsupportedPlatformException(os, arch);
}
From 45df0cc2e948f73fb234e4598c5dc50c0ed547d3 Mon Sep 17 00:00:00 2001
From: Roman Valls Guimera <brainstorm@nopcode.org>
Date: Sun, 16 May 2021 21:14:21 +1000
Subject: [PATCH 10/17] Technically not sure it falls under ARMv8 for the M1,
should be AARCH64
---
src/main/java/nu/pattern/OpenCV.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/main/java/nu/pattern/OpenCV.java b/src/main/java/nu/pattern/OpenCV.java
index 645f35f..c223975 100644
--- a/src/main/java/nu/pattern/OpenCV.java
+++ b/src/main/java/nu/pattern/OpenCV.java
@@ -383,8 +383,11 @@ private static Path extractNativeBinary(final OS os, final Arch arch) {
case ARMv8:
location = "/nu/pattern/opencv/osx/ARMv8/libopencv_java452.dylib";
break;
- case AARCH64:
- location = "/nu/pattern/opencv/osx/AARCH64/libopencv_java451.dylib";
+// case AARCH64:
+// location = "/nu/pattern/opencv/osx/AARCH64/libopencv_java451.dylib";
+// break;
+ case ARMv8:
+ location = "/nu/pattern/opencv/osx/ARMv8/libopencv_java451.dylib";
break;
default:
throw new UnsupportedPlatformException(os, arch);
From 67291dd7594d32cab51a163b5a89d48b289a125d Mon Sep 17 00:00:00 2001
From: Roman Valls Guimera <brainstorm@nopcode.org>
Date: Sun, 16 May 2021 21:50:11 +1000
Subject: [PATCH 11/17] Version bump to OpenCV 4.5.2 and BUILD SUCCESS :tada:
---
src/main/java/nu/pattern/OpenCV.java | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/src/main/java/nu/pattern/OpenCV.java b/src/main/java/nu/pattern/OpenCV.java
index c223975..1c34be7 100644
--- a/src/main/java/nu/pattern/OpenCV.java
+++ b/src/main/java/nu/pattern/OpenCV.java
@@ -377,17 +377,8 @@ private static Path extractNativeBinary(final OS os, final Arch arch) {
case X86_64:
location = "/nu/pattern/opencv/osx/x86_64/libopencv_java453.dylib";
break;
-// case AARCH64:
-// location = "/nu/pattern/opencv/osx/AARCH64/libopencv_java452.dylib";
-// break;
case ARMv8:
- location = "/nu/pattern/opencv/osx/ARMv8/libopencv_java452.dylib";
- break;
-// case AARCH64:
-// location = "/nu/pattern/opencv/osx/AARCH64/libopencv_java451.dylib";
-// break;
- case ARMv8:
- location = "/nu/pattern/opencv/osx/ARMv8/libopencv_java451.dylib";
+ location = "/nu/pattern/opencv/osx/ARMv8/libopencv_java453.dylib";
break;
default:
throw new UnsupportedPlatformException(os, arch);
From f59990ce6f353fd59c67eba5c5f58b7692f1e7c8 Mon Sep 17 00:00:00 2001
From: Roman Valls Guimera <brainstorm@users.noreply.github.com>
Date: Sun, 11 Jul 2021 22:13:29 +1000
Subject: [PATCH 12/17] Trigger test run, get latest version of arch-actions
---
.github/workflows/build.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 2849d2a..6d8c9c4 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -42,7 +42,7 @@ jobs:
echo "OPENCV_VERSION_SHORT=$(mvn build-helper:parse-version org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=opencv.version.short -q -DforceStdout)" >> $GITHUB_ENV
- name: Build OpenCV on Arm
- uses: uraimo/run-on-arch-action@v2.0.10
+ uses: uraimo/run-on-arch-action@v2
with:
arch: armv7
distro: ubuntu18.04
From 4795a04ec67bba7714eaa0f95dccdc05bd2f2146 Mon Sep 17 00:00:00 2001
From: Roman Valls Guimera <brainstorm@users.noreply.github.com>
Date: Sun, 11 Jul 2021 22:19:05 +1000
Subject: [PATCH 13/17] Version not found
---
.github/workflows/build.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 6d8c9c4..2849d2a 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -42,7 +42,7 @@ jobs:
echo "OPENCV_VERSION_SHORT=$(mvn build-helper:parse-version org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=opencv.version.short -q -DforceStdout)" >> $GITHUB_ENV
- name: Build OpenCV on Arm
- uses: uraimo/run-on-arch-action@v2
+ uses: uraimo/run-on-arch-action@v2.0.10
with:
arch: armv7
distro: ubuntu18.04
From 012b4f0dc3d4cd49b24d760639e207870b2e6c5c Mon Sep 17 00:00:00 2001
From: Roman Valls Guimera <brainstorm@users.noreply.github.com>
Date: Sat, 25 Sep 2021 19:36:54 +1000
Subject: [PATCH 14/17] Try to find the missing files...
---
.github/workflows/build.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 2849d2a..59083fa 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -391,7 +391,7 @@ jobs:
cp macos-10.15/bin/opencv-${{ env.OPENCV_VERSION_SHORT }}.jar upstream
cp macos-10.15/lib/libopencv_java${{ env.OPENCV_VERSION_SHORT }}.dylib src/main/resources/nu/pattern/opencv/osx/x86_64
cp macos-10.15/lib/libopencv_java${{ env.OPENCV_VERSION_SHORT }}.dylib src/main/resources/nu/pattern/opencv/osx/ARMv8
- find ubuntu-18.04 # list contents...
+ find ubuntu-18.04 # list contents...
cp ubuntu-18.04/lib/libopencv_java${{ env.OPENCV_VERSION_SHORT }}.so src/main/resources/nu/pattern/opencv/linux/x86_64
cp ubuntu-18.04-arm/lib/libopencv_java${{ env.OPENCV_VERSION_SHORT }}.so src/main/resources/nu/pattern/opencv/linux/ARMv7
cp ubuntu-18.04-arm64/lib/libopencv_java${{ env.OPENCV_VERSION_SHORT }}.so src/main/resources/nu/pattern/opencv/linux/ARMv8
From b3afc88dd689c0e892f001dd127a08d20491bd31 Mon Sep 17 00:00:00 2001
From: Roman Valls Guimera <brainstorm@users.noreply.github.com>
Date: Sun, 26 Sep 2021 21:06:05 +1000
Subject: [PATCH 15/17] Running act locally next...
---
.github/workflows/build.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 59083fa..f2ea01e 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -391,7 +391,7 @@ jobs:
cp macos-10.15/bin/opencv-${{ env.OPENCV_VERSION_SHORT }}.jar upstream
cp macos-10.15/lib/libopencv_java${{ env.OPENCV_VERSION_SHORT }}.dylib src/main/resources/nu/pattern/opencv/osx/x86_64
cp macos-10.15/lib/libopencv_java${{ env.OPENCV_VERSION_SHORT }}.dylib src/main/resources/nu/pattern/opencv/osx/ARMv8
- find ubuntu-18.04 # list contents...
+ find . -depth 2 # list contents...
cp ubuntu-18.04/lib/libopencv_java${{ env.OPENCV_VERSION_SHORT }}.so src/main/resources/nu/pattern/opencv/linux/x86_64
cp ubuntu-18.04-arm/lib/libopencv_java${{ env.OPENCV_VERSION_SHORT }}.so src/main/resources/nu/pattern/opencv/linux/ARMv7
cp ubuntu-18.04-arm64/lib/libopencv_java${{ env.OPENCV_VERSION_SHORT }}.so src/main/resources/nu/pattern/opencv/linux/ARMv8
From 98ba668c4d6b15471d61f387050a51db150b51c9 Mon Sep 17 00:00:00 2001
From: Roman Valls Guimera <brainstorm@users.noreply.github.com>
Date: Mon, 27 Sep 2021 23:07:40 +1000
Subject: [PATCH 16/17] maxdepth, not depth?
---
.github/workflows/build.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index f2ea01e..852aa55 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -391,7 +391,7 @@ jobs:
cp macos-10.15/bin/opencv-${{ env.OPENCV_VERSION_SHORT }}.jar upstream
cp macos-10.15/lib/libopencv_java${{ env.OPENCV_VERSION_SHORT }}.dylib src/main/resources/nu/pattern/opencv/osx/x86_64
cp macos-10.15/lib/libopencv_java${{ env.OPENCV_VERSION_SHORT }}.dylib src/main/resources/nu/pattern/opencv/osx/ARMv8
- find . -depth 2 # list contents...
+ find . -maxdepth 2 # list contents...
cp ubuntu-18.04/lib/libopencv_java${{ env.OPENCV_VERSION_SHORT }}.so src/main/resources/nu/pattern/opencv/linux/x86_64
cp ubuntu-18.04-arm/lib/libopencv_java${{ env.OPENCV_VERSION_SHORT }}.so src/main/resources/nu/pattern/opencv/linux/ARMv7
cp ubuntu-18.04-arm64/lib/libopencv_java${{ env.OPENCV_VERSION_SHORT }}.so src/main/resources/nu/pattern/opencv/linux/ARMv8
From dd23644cf56014721256345cd392532fffdefb3c Mon Sep 17 00:00:00 2001
From: Roman Valls Guimera <brainstorm@users.noreply.github.com>
Date: Tue, 28 Sep 2021 21:09:40 +1000
Subject: [PATCH 17/17] No x86 ubuntu folder seems to be generated?
---
.github/workflows/build.yml | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 852aa55..0bb4653 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -388,11 +388,10 @@ jobs:
- name: Copy Binaries
run: |
+ find . -iname "libopencv_java*"
cp macos-10.15/bin/opencv-${{ env.OPENCV_VERSION_SHORT }}.jar upstream
cp macos-10.15/lib/libopencv_java${{ env.OPENCV_VERSION_SHORT }}.dylib src/main/resources/nu/pattern/opencv/osx/x86_64
cp macos-10.15/lib/libopencv_java${{ env.OPENCV_VERSION_SHORT }}.dylib src/main/resources/nu/pattern/opencv/osx/ARMv8
- find . -maxdepth 2 # list contents...
- cp ubuntu-18.04/lib/libopencv_java${{ env.OPENCV_VERSION_SHORT }}.so src/main/resources/nu/pattern/opencv/linux/x86_64
cp ubuntu-18.04-arm/lib/libopencv_java${{ env.OPENCV_VERSION_SHORT }}.so src/main/resources/nu/pattern/opencv/linux/ARMv7
cp ubuntu-18.04-arm64/lib/libopencv_java${{ env.OPENCV_VERSION_SHORT }}.so src/main/resources/nu/pattern/opencv/linux/ARMv8
cp windows-2016/x86/opencv_java${{ env.OPENCV_VERSION_SHORT }}.dll src/main/resources/nu/pattern/opencv/windows/x86_32
@brainstorm
Copy link
Author

Related to: openpnp/opencv#75

Removing associated repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment