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()
# 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)
endif()
......@@ -953,7 +953,9 @@ if(WIN32)
endif()
############## 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
"Path to Android source tree.
Set this variable to path to your Android sources to compile
......@@ -1276,7 +1278,7 @@ if(ANDROID)
endif()
if(BUILD_ANDROID_CAMERA_WRAPPER)
set(CMAKE_CAMERA_LIBS_CONFIGCMAKE "native_camera_r${ANDROID_VERSION}")
else()
elseif(WITH_ANDROID_CAMERA)
SET(CMAKE_CAMERA_LIBS_CONFIGCMAKE "")
file(GLOB CMAKE_CAMERA_LIBS "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/lib/libnative_camera_r*.so")
foreach(cam_lib ${CMAKE_CAMERA_LIBS})
......@@ -1575,10 +1577,14 @@ if(UNIX AND NOT APPLE)
status(" Xine:" HAVE_XINE THEN YES ELSE NO)
if(ANDROID)
if(BUILD_ANDROID_CAMERA_WRAPPER)
status(" AndroidNativeCamera:" "build for Android ${ANDROID_VERSION}")
if(WITH_ANDROID_CAMERA)
if(BUILD_ANDROID_CAMERA_WRAPPER)
status(" AndroidNativeCamera:" "build for Android ${ANDROID_VERSION}")
else()
status(" AndroidNativeCamera:" ARMEABI_V7A THEN use prebuilt libraries ELSE NO)
endif()
else()
status(" AndroidNativeCamera:" ARMEABI_V7A THEN use prebuilt libraries ELSE NO)
status(" AndroidNativeCamera:" "NO (native camera requires Android API level 8 or higher)")
endif()
endif()
elseif(APPLE)
......@@ -1613,7 +1619,11 @@ status(" Interfaces:")
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 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)
status(" android tool:" ANDROID_EXECUTABLE THEN "${ANDROID_EXECUTABLE}" ELSE NO)
......
......@@ -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
ifeq ($(TARGET_ARCH_ABI),armeabi)
OPENCV_CAMERA_MODULES:=
else
ifeq (${OPENCV_CAMERA_MODULES},off)
OPENCV_CAMERA_MODULES:=
OPENCV_CAMERA_MODULES:=
else
OPENCV_CAMERA_MODULES:=@CMAKE_CAMERA_LIBS_CONFIGCMAKE@
endif
ifeq ($(TARGET_ARCH_ABI),armeabi)
OPENCV_CAMERA_MODULES:=
else
OPENCV_CAMERA_MODULES:=@CMAKE_CAMERA_LIBS_CONFIGCMAKE@
endif
endif
OPENCV_LIB_TYPE:=@OPENCV_LIBTYPE_CONFIGMAKE@
......@@ -28,7 +28,9 @@ ifeq ($(OPENCV_LIB_TYPE),SHARED)
OPENCV_EXTRA_COMPONENTS:=
else
OPENCV_LIB_SUFFIX:=a
OPENCV_MODULES+= androidcamera
ifeq (@WITH_ANDROID_CAMERA@,ON)
OPENCV_MODULES+= androidcamera
endif
OPENCV_EXTRA_COMPONENTS:=@JPEG_LIBRARIES@ @PNG_LIBRARIES@ @TIFF_LIBRARIES@ @JASPER_LIBRARIES@ @ZLIB_LIBRARY@
endif
......
......@@ -27,6 +27,7 @@
# - OpenCV_LIB_COMPONENTS
# - OpenCV_EXTRA_COMPONENTS
# - OpenCV_USE_MANGLED_PATHS
# - OpenCV_HAVE_ANDROID_CAMERA
#
# =================================================================================================
......@@ -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)
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)
# Presence of Android native camera support
set (OpenCV_HAVE_ANDROID_CAMERA @WITH_ANDROID_CAMERA@)
# ======================================================
# Include directories to add to the user project:
# ======================================================
......@@ -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
if(NOT ANDROID)
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)
endif()
......@@ -138,20 +142,18 @@ ENDIF()
# ======================================================
# Android camera helper macro
# ======================================================
IF (ANDROID)
IF (OpenCV_HAVE_ANDROID_CAMERA)
macro( COPY_NATIVE_CAMERA_LIBS target )
IF( ARMEABI_V7A)
get_target_property(target_location ${target} LOCATION)
get_filename_component(target_location "${target_location}" PATH)
file(GLOB camera_wrappers "${OpenCV_LIB_DIR}/libnative_camera_r*.so")
foreach(wrapper ${camera_wrappers})
ADD_CUSTOM_COMMAND(
TARGET ${target}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${wrapper}" "${target_location}"
)
endforeach()
ENDIF( ARMEABI_V7A )
get_target_property(target_location ${target} LOCATION)
get_filename_component(target_location "${target_location}" PATH)
file(GLOB camera_wrappers "${OpenCV_LIB_DIR}/libnative_camera_r*.so")
foreach(wrapper ${camera_wrappers})
ADD_CUSTOM_COMMAND(
TARGET ${target}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${wrapper}" "${target_location}"
)
endforeach()
endmacro()
ENDIF(ANDROID)
......
......@@ -3,8 +3,10 @@ if(ANDROID)
if(ANDROID_API_LEVEL LESS 8)
ADD_DEFINITIONS(-DGTEST_HAS_CLONE=0)
endif()
add_subdirectory(androidcamera)
IF(WITH_ANDROID_CAMERA)
add_subdirectory(androidcamera)
endif()
endif()
add_subdirectory(calib3d)
......
......@@ -211,7 +211,7 @@ if(APPLE)
endif()
endif(APPLE)
if(ANDROID)
if(WITH_ANDROID_CAMERA)
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../androidcamera/include")
set(highgui_srcs ${highgui_srcs} src/cap_android.cpp)
add_definitions(-DHAVE_ANDROID_NATIVE_CAMERA)
......@@ -333,7 +333,7 @@ if(NOT ZLIB_FOUND)
add_dependencies(${the_target} zlib)
endif()
if(ANDROID)
if(WITH_ANDROID_CAMERA)
add_dependencies(${the_target} opencv_androidcamera)
endif()
......@@ -377,7 +377,7 @@ if(BUILD_TESTS)
"${CMAKE_CURRENT_BINARY_DIR}")
set(test_deps opencv_ts opencv_highgui opencv_imgproc)
if(ANDROID)
if(WITH_ANDROID_CAMERA)
set(test_deps ${test_deps} opencv_androidcamera)
endif()
......
......@@ -5,7 +5,7 @@ project(opencv_java)
SET(OPENCV_JAVA_MODULES objdetect features2d imgproc video highgui ml core)
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)
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