Commit 73062217 authored by Andrey Kamaev's avatar Andrey Kamaev

Turned off android camera and java wrappers for low Android API levels…

Turned off android camera and java wrappers for low Android API levels (android-8 is required for these components)
parent 53ff93f3
...@@ -664,7 +664,7 @@ endif() ...@@ -664,7 +664,7 @@ endif()
# Java support # Java support
# =================================================== # ===================================================
if (PYTHON_EXECUTABLE AND ANDROID) if (PYTHON_EXECUTABLE AND ANDROID AND ANDROID_API_LEVEL GREATER 7)
option(BUILD_JAVA_SUPPORT "Build with Java support" TRUE) option(BUILD_JAVA_SUPPORT "Build with Java support" TRUE)
endif() endif()
...@@ -953,7 +953,9 @@ if(WIN32) ...@@ -953,7 +953,9 @@ if(WIN32)
endif() endif()
############## Android source tree for native camera ############### ############## Android source tree for native camera ###############
if(ANDROID) if(ANDROID AND ANDROID_API_LEVEL GREATER 7)
option(WITH_ANDROID_CAMERA "Build with native Android camera support" TRUE)
SET (ANDROID_SOURCE_TREE "ANDROID_SOURCE_TREE-NOTFOUND" CACHE PATH SET (ANDROID_SOURCE_TREE "ANDROID_SOURCE_TREE-NOTFOUND" CACHE PATH
"Path to Android source tree. "Path to Android source tree.
Set this variable to path to your Android sources to compile Set this variable to path to your Android sources to compile
...@@ -1276,7 +1278,7 @@ if(ANDROID) ...@@ -1276,7 +1278,7 @@ if(ANDROID)
endif() endif()
if(BUILD_ANDROID_CAMERA_WRAPPER) if(BUILD_ANDROID_CAMERA_WRAPPER)
set(CMAKE_CAMERA_LIBS_CONFIGCMAKE "native_camera_r${ANDROID_VERSION}") set(CMAKE_CAMERA_LIBS_CONFIGCMAKE "native_camera_r${ANDROID_VERSION}")
else() elseif(WITH_ANDROID_CAMERA)
SET(CMAKE_CAMERA_LIBS_CONFIGCMAKE "") SET(CMAKE_CAMERA_LIBS_CONFIGCMAKE "")
file(GLOB CMAKE_CAMERA_LIBS "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/lib/libnative_camera_r*.so") file(GLOB CMAKE_CAMERA_LIBS "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/lib/libnative_camera_r*.so")
foreach(cam_lib ${CMAKE_CAMERA_LIBS}) foreach(cam_lib ${CMAKE_CAMERA_LIBS})
...@@ -1575,11 +1577,15 @@ if(UNIX AND NOT APPLE) ...@@ -1575,11 +1577,15 @@ if(UNIX AND NOT APPLE)
status(" Xine:" HAVE_XINE THEN YES ELSE NO) status(" Xine:" HAVE_XINE THEN YES ELSE NO)
if(ANDROID) if(ANDROID)
if(WITH_ANDROID_CAMERA)
if(BUILD_ANDROID_CAMERA_WRAPPER) if(BUILD_ANDROID_CAMERA_WRAPPER)
status(" AndroidNativeCamera:" "build for Android ${ANDROID_VERSION}") status(" AndroidNativeCamera:" "build for Android ${ANDROID_VERSION}")
else() else()
status(" AndroidNativeCamera:" ARMEABI_V7A THEN use prebuilt libraries ELSE NO) status(" AndroidNativeCamera:" ARMEABI_V7A THEN use prebuilt libraries ELSE NO)
endif() endif()
else()
status(" AndroidNativeCamera:" "NO (native camera requires Android API level 8 or higher)")
endif()
endif() endif()
elseif(APPLE) elseif(APPLE)
status(" Video I/O:" WITH_QUICKTIME THEN QuickTime ELSE QTKit) status(" Video I/O:" WITH_QUICKTIME THEN QuickTime ELSE QTKit)
...@@ -1613,7 +1619,11 @@ status(" Interfaces:") ...@@ -1613,7 +1619,11 @@ status(" Interfaces:")
status(" Python:" BUILD_NEW_PYTHON_SUPPORT THEN YES ELSE NO) status(" Python:" BUILD_NEW_PYTHON_SUPPORT THEN YES ELSE NO)
status(" Python interpreter:" PYTHON_EXECUTABLE THEN "${PYTHON_EXECUTABLE} (ver ${PYTHON_VERSION_MAJOR_MINOR})" ELSE NO) status(" Python interpreter:" PYTHON_EXECUTABLE THEN "${PYTHON_EXECUTABLE} (ver ${PYTHON_VERSION_MAJOR_MINOR})" ELSE NO)
status(" Python numpy:" PYTHON_USE_NUMPY THEN YES ELSE "NO (Python interface will not cover OpenCV 2.x API)") status(" Python numpy:" PYTHON_USE_NUMPY THEN YES ELSE "NO (Python interface will not cover OpenCV 2.x API)")
status(" Java:" BUILD_JAVA_SUPPORT THEN YES ELSE NO) if(ANDROID AND ANDROID_API_LEVEL LESS 8)
status(" Java:" "NO (Java API requires Android API level 8 or higher)")
else()
status(" Java:" BUILD_JAVA_SUPPORT THEN YES ELSE NO)
endif()
if(ANDROID) if(ANDROID)
status(" android tool:" ANDROID_EXECUTABLE THEN "${ANDROID_EXECUTABLE}" ELSE NO) status(" android tool:" ANDROID_EXECUTABLE THEN "${ANDROID_EXECUTABLE}" ELSE NO)
......
...@@ -11,14 +11,14 @@ OPENCV_LOCAL_C_INCLUDES:=@CMAKE_INCLUDE_DIRS_CONFIGCMAKE@ ...@@ -11,14 +11,14 @@ OPENCV_LOCAL_C_INCLUDES:=@CMAKE_INCLUDE_DIRS_CONFIGCMAKE@
OPENCV_MODULES := contrib calib3d objdetect features2d imgproc video highgui ml legacy flann core OPENCV_MODULES := contrib calib3d objdetect features2d imgproc video highgui ml legacy flann core
ifeq ($(TARGET_ARCH_ABI),armeabi)
OPENCV_CAMERA_MODULES:=
else
ifeq (${OPENCV_CAMERA_MODULES},off) ifeq (${OPENCV_CAMERA_MODULES},off)
OPENCV_CAMERA_MODULES:= OPENCV_CAMERA_MODULES:=
else else
OPENCV_CAMERA_MODULES:=@CMAKE_CAMERA_LIBS_CONFIGCMAKE@ ifeq ($(TARGET_ARCH_ABI),armeabi)
endif OPENCV_CAMERA_MODULES:=
else
OPENCV_CAMERA_MODULES:=@CMAKE_CAMERA_LIBS_CONFIGCMAKE@
endif
endif endif
OPENCV_LIB_TYPE:=@OPENCV_LIBTYPE_CONFIGMAKE@ OPENCV_LIB_TYPE:=@OPENCV_LIBTYPE_CONFIGMAKE@
...@@ -28,7 +28,9 @@ ifeq ($(OPENCV_LIB_TYPE),SHARED) ...@@ -28,7 +28,9 @@ ifeq ($(OPENCV_LIB_TYPE),SHARED)
OPENCV_EXTRA_COMPONENTS:= OPENCV_EXTRA_COMPONENTS:=
else else
OPENCV_LIB_SUFFIX:=a OPENCV_LIB_SUFFIX:=a
ifeq (@WITH_ANDROID_CAMERA@,ON)
OPENCV_MODULES+= androidcamera OPENCV_MODULES+= androidcamera
endif
OPENCV_EXTRA_COMPONENTS:=@JPEG_LIBRARIES@ @PNG_LIBRARIES@ @TIFF_LIBRARIES@ @JASPER_LIBRARIES@ @ZLIB_LIBRARY@ OPENCV_EXTRA_COMPONENTS:=@JPEG_LIBRARIES@ @PNG_LIBRARIES@ @TIFF_LIBRARIES@ @JASPER_LIBRARIES@ @ZLIB_LIBRARY@
endif endif
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
# - OpenCV_LIB_COMPONENTS # - OpenCV_LIB_COMPONENTS
# - OpenCV_EXTRA_COMPONENTS # - OpenCV_EXTRA_COMPONENTS
# - OpenCV_USE_MANGLED_PATHS # - OpenCV_USE_MANGLED_PATHS
# - OpenCV_HAVE_ANDROID_CAMERA
# #
# ================================================================================================= # =================================================================================================
...@@ -45,9 +46,12 @@ set(OpenCV_USE_MANGLED_PATHS @OPENCV_MANGLED_INSTALL_PATHS@) ...@@ -45,9 +46,12 @@ set(OpenCV_USE_MANGLED_PATHS @OPENCV_MANGLED_INSTALL_PATHS@)
# Extract the directory where *this* file has been installed (determined at cmake run-time) # Extract the directory where *this* file has been installed (determined at cmake run-time)
get_filename_component(OpenCV_CONFIG_PATH "${CMAKE_CURRENT_LIST_FILE}" PATH) get_filename_component(OpenCV_CONFIG_PATH "${CMAKE_CURRENT_LIST_FILE}" PATH)
#Get the absolute path with no ../.. relative marks, to eliminate implicit linker warnings # Get the absolute path with no ../.. relative marks, to eliminate implicit linker warnings
get_filename_component(OpenCV_INSTALL_PATH "${OpenCV_CONFIG_PATH}/../.." REALPATH) get_filename_component(OpenCV_INSTALL_PATH "${OpenCV_CONFIG_PATH}/../.." REALPATH)
# Presence of Android native camera support
set (OpenCV_HAVE_ANDROID_CAMERA @WITH_ANDROID_CAMERA@)
# ====================================================== # ======================================================
# Include directories to add to the user project: # Include directories to add to the user project:
# ====================================================== # ======================================================
...@@ -71,7 +75,7 @@ SET(OpenCV_LIB_COMPONENTS opencv_contrib opencv_legacy opencv_objdetect opencv_c ...@@ -71,7 +75,7 @@ SET(OpenCV_LIB_COMPONENTS opencv_contrib opencv_legacy opencv_objdetect opencv_c
#libraries order is very important because linker from Android NDK is one-pass linker #libraries order is very important because linker from Android NDK is one-pass linker
if(NOT ANDROID) if(NOT ANDROID)
LIST(INSERT OpenCV_LIB_COMPONENTS 0 opencv_gpu) LIST(INSERT OpenCV_LIB_COMPONENTS 0 opencv_gpu)
ELSEIF(NOT OpenCV_SHARED) ELSEIF(NOT OpenCV_SHARED AND OpenCV_HAVE_ANDROID_CAMERA)
LIST(APPEND OpenCV_LIB_COMPONENTS opencv_androidcamera) LIST(APPEND OpenCV_LIB_COMPONENTS opencv_androidcamera)
endif() endif()
...@@ -138,9 +142,8 @@ ENDIF() ...@@ -138,9 +142,8 @@ ENDIF()
# ====================================================== # ======================================================
# Android camera helper macro # Android camera helper macro
# ====================================================== # ======================================================
IF (ANDROID) IF (OpenCV_HAVE_ANDROID_CAMERA)
macro( COPY_NATIVE_CAMERA_LIBS target ) macro( COPY_NATIVE_CAMERA_LIBS target )
IF( ARMEABI_V7A)
get_target_property(target_location ${target} LOCATION) get_target_property(target_location ${target} LOCATION)
get_filename_component(target_location "${target_location}" PATH) get_filename_component(target_location "${target_location}" PATH)
file(GLOB camera_wrappers "${OpenCV_LIB_DIR}/libnative_camera_r*.so") file(GLOB camera_wrappers "${OpenCV_LIB_DIR}/libnative_camera_r*.so")
...@@ -151,7 +154,6 @@ IF (ANDROID) ...@@ -151,7 +154,6 @@ IF (ANDROID)
COMMAND ${CMAKE_COMMAND} -E copy "${wrapper}" "${target_location}" COMMAND ${CMAKE_COMMAND} -E copy "${wrapper}" "${target_location}"
) )
endforeach() endforeach()
ENDIF( ARMEABI_V7A )
endmacro() endmacro()
ENDIF(ANDROID) ENDIF(ANDROID)
......
...@@ -4,7 +4,9 @@ if(ANDROID) ...@@ -4,7 +4,9 @@ if(ANDROID)
ADD_DEFINITIONS(-DGTEST_HAS_CLONE=0) ADD_DEFINITIONS(-DGTEST_HAS_CLONE=0)
endif() endif()
IF(WITH_ANDROID_CAMERA)
add_subdirectory(androidcamera) add_subdirectory(androidcamera)
endif()
endif() endif()
add_subdirectory(calib3d) add_subdirectory(calib3d)
......
...@@ -211,7 +211,7 @@ if(APPLE) ...@@ -211,7 +211,7 @@ if(APPLE)
endif() endif()
endif(APPLE) endif(APPLE)
if(ANDROID) if(WITH_ANDROID_CAMERA)
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../androidcamera/include") include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../androidcamera/include")
set(highgui_srcs ${highgui_srcs} src/cap_android.cpp) set(highgui_srcs ${highgui_srcs} src/cap_android.cpp)
add_definitions(-DHAVE_ANDROID_NATIVE_CAMERA) add_definitions(-DHAVE_ANDROID_NATIVE_CAMERA)
...@@ -333,7 +333,7 @@ if(NOT ZLIB_FOUND) ...@@ -333,7 +333,7 @@ if(NOT ZLIB_FOUND)
add_dependencies(${the_target} zlib) add_dependencies(${the_target} zlib)
endif() endif()
if(ANDROID) if(WITH_ANDROID_CAMERA)
add_dependencies(${the_target} opencv_androidcamera) add_dependencies(${the_target} opencv_androidcamera)
endif() endif()
...@@ -377,7 +377,7 @@ if(BUILD_TESTS) ...@@ -377,7 +377,7 @@ if(BUILD_TESTS)
"${CMAKE_CURRENT_BINARY_DIR}") "${CMAKE_CURRENT_BINARY_DIR}")
set(test_deps opencv_ts opencv_highgui opencv_imgproc) set(test_deps opencv_ts opencv_highgui opencv_imgproc)
if(ANDROID) if(WITH_ANDROID_CAMERA)
set(test_deps ${test_deps} opencv_androidcamera) set(test_deps ${test_deps} opencv_androidcamera)
endif() endif()
......
...@@ -5,7 +5,7 @@ project(opencv_java) ...@@ -5,7 +5,7 @@ project(opencv_java)
SET(OPENCV_JAVA_MODULES objdetect features2d imgproc video highgui ml core) SET(OPENCV_JAVA_MODULES objdetect features2d imgproc video highgui ml core)
SET(OPENCV_EXTRA_JAVA_MODULES calib3d contrib legacy flann) SET(OPENCV_EXTRA_JAVA_MODULES calib3d contrib legacy flann)
IF(ANDROID AND NOT BUILD_SHARED_LIBS) IF(WITH_ANDROID_CAMERA AND NOT BUILD_SHARED_LIBS)
LIST(APPEND OPENCV_EXTRA_JAVA_MODULES androidcamera) LIST(APPEND OPENCV_EXTRA_JAVA_MODULES androidcamera)
ENDIF() ENDIF()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment