mirror of
https://github.com/opencv/opencv.git
synced 2026-09-11 04:43:22 -05:00
Merge pull request #28159 from asmorkalov:as/java_cleaners
Introduce option to generate Java code with finalize() or Cleaners interface #28159 Closes https://github.com/opencv/opencv/issues/22260 Replaces https://github.com/opencv/opencv/pull/23467 The PR introduce configuration option to generate Java code with Cleaner interface for Java 9+ and old-fashion finalize() method for old Java and Android. Mat class and derivatives are manually written. The PR introduce 2 base classes for it depending on the generator configuration. Pros: 1. No need to implement complex and error prone cleaner on library side. 2. No new CMake templates, easier to modify code in IDE. Cons: 1. More generator branches and different code for modern desktop and Android. TODO: - [x] Add Java version check to cmake - [x] Use Cleaners for ANDROID API 33+ ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [ ] The PR is proposed to the proper branch - [ ] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
committed by
GitHub
parent
7ca9d9ce03
commit
c03734475f
@@ -834,12 +834,12 @@ if(BUILD_JAVA)
|
||||
if(ANDROID)
|
||||
include(cmake/android/OpenCVDetectAndroidSDK.cmake)
|
||||
else()
|
||||
include(cmake/OpenCVDetectApacheAnt.cmake)
|
||||
if(ANT_EXECUTABLE AND NOT OPENCV_JAVA_IGNORE_ANT)
|
||||
ocv_update(OPENCV_JAVA_SDK_BUILD_TYPE "ANT")
|
||||
elseif(NOT ANDROID)
|
||||
find_package(Java)
|
||||
if(Java_FOUND)
|
||||
find_package(Java QUIET)
|
||||
if(Java_FOUND)
|
||||
include(cmake/OpenCVDetectApacheAnt.cmake)
|
||||
if(ANT_EXECUTABLE AND NOT OPENCV_JAVA_IGNORE_ANT)
|
||||
ocv_update(OPENCV_JAVA_SDK_BUILD_TYPE "ANT")
|
||||
else()
|
||||
include(UseJava)
|
||||
ocv_update(OPENCV_JAVA_SDK_BUILD_TYPE "JAVA")
|
||||
endif()
|
||||
@@ -1997,7 +1997,7 @@ if(BUILD_JAVA)
|
||||
status(" Java:" Java_FOUND THEN "YES (ver ${Java_VERSION})" ELSE NO)
|
||||
status(" JNI:" JNI_INCLUDE_DIRS THEN "${JNI_INCLUDE_DIRS}" ELSE NO)
|
||||
endif()
|
||||
status(" Java wrappers:" HAVE_opencv_java THEN "YES (${OPENCV_JAVA_SDK_BUILD_TYPE})" ELSE NO)
|
||||
status(" Java wrappers:" HAVE_opencv_java THEN "YES (${OPENCV_JAVA_SDK_BUILD_TYPE})" ELSE NO)
|
||||
status(" Java tests:" BUILD_TESTS AND (opencv_test_java_BINARY_DIR OR opencv_test_android_BINARY_DIR) THEN YES ELSE NO)
|
||||
endif()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user