mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-21 01:01:41 +00:00
Statically link OpenCV and always extract shared object (#177)
This commit is contained in:
committed by
GitHub
parent
0c89db421c
commit
11a66b15ed
@@ -36,15 +36,16 @@ public class PicamJNI {
|
||||
if (libraryLoaded || !Platform.isRaspberryPi()) return;
|
||||
|
||||
try {
|
||||
File libDirectory = Path.of("lib/").toFile();
|
||||
if (!libDirectory.exists()) {
|
||||
Files.createDirectory(libDirectory.toPath()).toFile();
|
||||
}
|
||||
|
||||
// We always extract the shared object (we could hash each so, but that's a lot of work)
|
||||
URL resourceURL = PicamJNI.class.getResource("/nativelibraries/libpicam.so");
|
||||
File libFile = Path.of("lib/libpicam.so").toFile();
|
||||
if (!Files.exists(libFile.toPath())) {
|
||||
// Assumes that the directory doesn't exist if libpicam doesn't exist
|
||||
Files.createDirectory(Path.of("lib/")).toFile();
|
||||
|
||||
try (InputStream in = resourceURL.openStream()) {
|
||||
Files.copy(in, libFile.toPath());
|
||||
}
|
||||
try (InputStream in = resourceURL.openStream()) {
|
||||
Files.copy(in, libFile.toPath());
|
||||
}
|
||||
System.load(libFile.getAbsolutePath());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user