Fixed dependency from opencv_nonfree in Java bindings
This commit is contained in:
parent
f6bddd23af
commit
78ee81c409
@ -6,7 +6,7 @@ if(NOT ANDROID OR NOT PYTHON_EXECUTABLE OR ANDROID_NATIVE_API_LEVEL LESS 8)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(the_description "The java bindings")
|
set(the_description "The java bindings")
|
||||||
ocv_add_module(java BINDINGS opencv_core opencv_imgproc OPTIONAL opencv_objdetect opencv_features2d opencv_video opencv_highgui opencv_ml opencv_calib3d opencv_photo)
|
ocv_add_module(java BINDINGS opencv_core opencv_imgproc OPTIONAL opencv_objdetect opencv_features2d opencv_video opencv_highgui opencv_ml opencv_calib3d opencv_photo opencv_nonfree)
|
||||||
ocv_module_include_directories("${CMAKE_CURRENT_SOURCE_DIR}/src/cpp")
|
ocv_module_include_directories("${CMAKE_CURRENT_SOURCE_DIR}/src/cpp")
|
||||||
|
|
||||||
# get list of modules to wrap
|
# get list of modules to wrap
|
||||||
@ -56,23 +56,25 @@ foreach(module ${OPENCV_JAVA_MODULES})
|
|||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
# first run (to get list of generated files)
|
# first run (to get list of generated files)
|
||||||
file(REMOVE_RECURSE "${CMAKE_CURRENT_BINARY_DIR}/gen_java_out/")
|
if(module_headers)
|
||||||
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/gen_java_out")
|
file(REMOVE_RECURSE "${CMAKE_CURRENT_BINARY_DIR}/gen_java_out/")
|
||||||
execute_process(COMMAND ${PYTHON_EXECUTABLE} "${GEN_JAVA}" "${HDR_PARSER}" ${module} ${module_headers}
|
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/gen_java_out")
|
||||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/gen_java_out"
|
execute_process(COMMAND ${PYTHON_EXECUTABLE} "${GEN_JAVA}" "${HDR_PARSER}" ${module} ${module_headers}
|
||||||
OUTPUT_QUIET ERROR_QUIET)
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/gen_java_out"
|
||||||
file(GLOB_RECURSE ${module}_generated_java_sources RELATIVE "${CMAKE_CURRENT_BINARY_DIR}/gen_java_out/" "${CMAKE_CURRENT_BINARY_DIR}/gen_java_out/*.java")
|
OUTPUT_QUIET ERROR_QUIET)
|
||||||
ocv_list_add_prefix(${module}_generated_java_sources "${CMAKE_CURRENT_BINARY_DIR}/")
|
file(GLOB_RECURSE ${module}_generated_java_sources RELATIVE "${CMAKE_CURRENT_BINARY_DIR}/gen_java_out/" "${CMAKE_CURRENT_BINARY_DIR}/gen_java_out/*.java")
|
||||||
|
ocv_list_add_prefix(${module}_generated_java_sources "${CMAKE_CURRENT_BINARY_DIR}/")
|
||||||
|
|
||||||
# second run (at build time)
|
# second run (at build time)
|
||||||
add_custom_command(OUTPUT ${${module}_generated_java_sources} "${CMAKE_CURRENT_BINARY_DIR}/${module}.cpp"
|
add_custom_command(OUTPUT ${${module}_generated_java_sources} "${CMAKE_CURRENT_BINARY_DIR}/${module}.cpp"
|
||||||
COMMAND ${PYTHON_EXECUTABLE} "${GEN_JAVA}" "${HDR_PARSER}" ${module} ${module_headers}
|
COMMAND ${PYTHON_EXECUTABLE} "${GEN_JAVA}" "${HDR_PARSER}" ${module} ${module_headers}
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
DEPENDS "${GEN_JAVA}" "${HDR_PARSER}" ${module_headers})
|
DEPENDS "${GEN_JAVA}" "${HDR_PARSER}" ${module_headers})
|
||||||
|
|
||||||
list(APPEND java_hdr_deps ${module_headers})
|
list(APPEND java_hdr_deps ${module_headers})
|
||||||
list(APPEND generated_cpp_sources "${CMAKE_CURRENT_BINARY_DIR}/${module}.cpp")
|
list(APPEND generated_cpp_sources "${CMAKE_CURRENT_BINARY_DIR}/${module}.cpp")
|
||||||
list(APPEND generated_java_sources ${${module}_generated_java_sources})
|
list(APPEND generated_java_sources ${${module}_generated_java_sources})
|
||||||
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
# get handwritten files used for wrappers generation
|
# get handwritten files used for wrappers generation
|
||||||
|
0
modules/java/config/nonfree.filelist
Normal file
0
modules/java/config/nonfree.filelist
Normal file
@ -21,4 +21,16 @@ JNI_OnUnload(JavaVM *vm, void *reserved)
|
|||||||
//do nothing
|
//do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
|
|
||||||
|
#include "opencv2/opencv_modules.hpp"
|
||||||
|
|
||||||
|
#if HAVE_OPENCV_MODULES_NONFREE
|
||||||
|
#include "opencv2/nonfree/nonfree.hpp"
|
||||||
|
static bool makeUseOfNonfree = initModule_nonfree();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if HAVE_OPENCV_MODULES_FEATURES2D
|
||||||
|
#include "opencv2/features2d/features2d.hpp"
|
||||||
|
static bool makeUseOfNonfree = initModule_features2d();
|
||||||
|
#endif
|
Loading…
x
Reference in New Issue
Block a user