From 5cb74f484b00d79a43ddc5a8e887c1efc5339d36 Mon Sep 17 00:00:00 2001 From: Jonathan Thomas Date: Mon, 30 Dec 2024 23:50:06 -0600 Subject: [PATCH] Fixing swig java support to generate a package (org.openshot) and correctly wrap the shared pointers for Frame and Audio buffers. --- bindings/java/CMakeLists.txt | 5 +++++ bindings/java/openshot.i | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/bindings/java/CMakeLists.txt b/bindings/java/CMakeLists.txt index fc6a6ded8..4247c4e62 100644 --- a/bindings/java/CMakeLists.txt +++ b/bindings/java/CMakeLists.txt @@ -32,6 +32,11 @@ message(STATUS "JNI_LIBRARIES=${JNI_LIBRARIES}") set_property(SOURCE openshot.i PROPERTY CPLUSPLUS ON) set_property(SOURCE openshot.i PROPERTY SWIG_MODULE_NAME openshot) +### Set the swig package name for the JAR +set_source_files_properties(openshot.i PROPERTIES + SWIG_FLAGS "-package;org.openshot" +) + ### Suppress a ton of warnings in the generated SWIG C++ code set(SWIG_CXX_FLAGS "-Wno-unused-variable -Wno-unused-function \ -Wno-deprecated-copy -Wno-class-memaccess -Wno-cast-function-type \ diff --git a/bindings/java/openshot.i b/bindings/java/openshot.i index b0ca6213c..55cec2621 100644 --- a/bindings/java/openshot.i +++ b/bindings/java/openshot.i @@ -32,14 +32,14 @@ %include /* Include shared pointer code */ -#%include +%include /* Mark these classes as shared_ptr classes */ #ifdef USE_IMAGEMAGICK - #%shared_ptr(Magick::Image) + %shared_ptr(Magick::Image) #endif -#%shared_ptr(juce::AudioBuffer) -#%shared_ptr(openshot::Frame) +%shared_ptr(juce::AudioBuffer) +%shared_ptr(openshot::Frame) /* Instantiate the required template specializations */ %template() std::map;