diff --git a/modules/java/CMakeLists.txt b/modules/java/CMakeLists.txt index aa48d9d440..b905de94c3 100644 --- a/modules/java/CMakeLists.txt +++ b/modules/java/CMakeLists.txt @@ -346,9 +346,16 @@ endif(ANDROID) # workarounding lack of `__attribute__ ((visibility("default")))` in jni_md.h/JNIEXPORT string(REPLACE "-fvisibility=hidden" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") -ocv_add_library(${the_module} SHARED ${handwritten_h_sources} ${handwritten_cpp_sources} ${generated_cpp_sources} +if(ANDROID) + # Android native code need to link with libopencv_java.so + ocv_add_library(${the_module} SHARED ${handwritten_h_sources} ${handwritten_cpp_sources} ${generated_cpp_sources} ${copied_files} "${JAR_FILE}" "${JAR_FILE}.dephelper") +else() + ocv_add_library(${the_module} MODULE ${handwritten_h_sources} ${handwritten_cpp_sources} ${generated_cpp_sources} + ${copied_files} + "${JAR_FILE}" "${JAR_FILE}.dephelper") +endif() if(BUILD_FAT_JAVA_LIB) set(__deps ${OPENCV_MODULE_${the_module}_DEPS} ${OPENCV_MODULES_BUILD}) diff --git a/modules/python/common.cmake b/modules/python/common.cmake index 2444b77a98..e33581159c 100644 --- a/modules/python/common.cmake +++ b/modules/python/common.cmake @@ -46,7 +46,7 @@ add_custom_command( DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/headers.txt DEPENDS ${opencv_hdrs}) -ocv_add_library(${the_module} SHARED ${PYTHON_SOURCE_DIR}/src2/cv2.cpp ${cv2_generated_hdrs}) +ocv_add_library(${the_module} MODULE ${PYTHON_SOURCE_DIR}/src2/cv2.cpp ${cv2_generated_hdrs}) if(PYTHON_DEBUG_LIBRARIES AND NOT PYTHON_LIBRARIES MATCHES "optimized.*debug") ocv_target_link_libraries(${the_module} debug ${PYTHON_DEBUG_LIBRARIES} optimized ${PYTHON_LIBRARIES})