fixed Android mk generation for arm64-v8a

pull/4042/head
Ilya Lavrenov 10 years ago
parent ede4943d7e
commit d89b6226a3
  1. 5
      cmake/OpenCVGenAndroidMK.cmake
  2. 30
      cmake/templates/OpenCV.mk.in

@ -25,6 +25,8 @@ if(ANDROID)
set( ${VAR} "armeabi" )
elseif( " ${TOOLCHAIN_FLAG}" STREQUAL " ARMEABI_V7A" )
set( ${VAR} "armeabi-v7a" )
elseif( " ${TOOLCHAIN_FLAG}" STREQUAL " ARM64_V8A" )
set( ${VAR} "arm64-v8a" )
elseif( " ${TOOLCHAIN_FLAG}" STREQUAL " X86" )
set( ${VAR} "x86" )
elseif( " ${TOOLCHAIN_FLAG}" STREQUAL " MIPS" )
@ -36,7 +38,7 @@ if(ANDROID)
endif()
# setup lists of camera libs
foreach(abi ARMEABI ARMEABI_V7A X86 MIPS)
foreach(abi ARMEABI ARMEABI_V7A ARM64_V8A X86 MIPS)
ANDROID_GET_ABI_RAWNAME(${abi} ndkabi)
if(BUILD_ANDROID_CAMERA_WRAPPER)
if(ndkabi STREQUAL ANDROID_NDK_ABI_NAME)
@ -46,6 +48,7 @@ if(ANDROID)
endif()
elseif(HAVE_opencv_androidcamera)
set(OPENCV_CAMERA_LIBS_${abi}_CONFIGCMAKE "")
# TODO: add prebuild camera libs for arm64-v8a
file(GLOB OPENCV_CAMERA_LIBS "${OpenCV_SOURCE_DIR}/3rdparty/lib/${ndkabi}/libnative_camera_r*.so")
if(OPENCV_CAMERA_LIBS)
list(SORT OPENCV_CAMERA_LIBS)

@ -31,7 +31,16 @@ ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
endif
OPENCV_DYNAMICUDA_MODULE:=@OPENCV_DYNAMICUDA_MODULE_CONFIGMAKE@
else
OPENCV_DYNAMICUDA_MODULE:=
ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
ifeq ($(OPENCV_HAVE_GPU_MODULE),on)
ifneq ($(CUDA_TOOLKIT_DIR),)
OPENCV_USE_GPU_MODULE:=on
endif
endif
OPENCV_DYNAMICUDA_MODULE:=@OPENCV_DYNAMICUDA_MODULE_CONFIGMAKE@
else
OPENCV_DYNAMICUDA_MODULE:=
endif
endif
CUDA_RUNTIME_LIBS:=@CUDA_RUNTIME_LIBS_CONFIGMAKE@
@ -56,6 +65,10 @@ else
OPENCV_3RDPARTY_COMPONENTS:=@OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE@
OPENCV_EXTRA_COMPONENTS:=@OPENCV_EXTRA_COMPONENTS_CONFIGMAKE@
endif
ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
OPENCV_3RDPARTY_COMPONENTS:=@OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE@
OPENCV_EXTRA_COMPONENTS:=@OPENCV_EXTRA_COMPONENTS_CONFIGMAKE@
endif
ifeq ($(TARGET_ARCH_ABI),x86)
OPENCV_3RDPARTY_COMPONENTS:=@OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE@
OPENCV_EXTRA_COMPONENTS:=@OPENCV_EXTRA_COMPONENTS_CONFIGMAKE@
@ -77,6 +90,9 @@ ifeq ($(OPENCV_CAMERA_MODULES),on)
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
OPENCV_CAMERA_MODULES:=@OPENCV_CAMERA_LIBS_ARMEABI_V7A_CONFIGCMAKE@
endif
ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
OPENCV_CAMERA_MODULES:=@OPENCV_CAMERA_LIBS_ARM64_V8A_CONFIGCMAKE@
endif
ifeq ($(TARGET_ARCH_ABI),x86)
OPENCV_CAMERA_MODULES:=@OPENCV_CAMERA_LIBS_X86_CONFIGCMAKE@
endif
@ -101,10 +117,18 @@ define add_opencv_module
include $(PREBUILT_$(OPENCV_LIB_TYPE)_LIBRARY)
endef
ifndef CUDA_LIBS_DIR
ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
CUDA_LIBS_DIR := $(CUDA_TOOLKIT_DIR)/targets/aarch64-linux-androideabi/lib
else
CUDA_LIBS_DIR := $(CUDA_TOOLKIT_DIR)/targets/armv7-linux-androideabi/lib
endif
endif
define add_cuda_module
include $(CLEAR_VARS)
LOCAL_MODULE:=$1
LOCAL_SRC_FILES:=$(CUDA_TOOLKIT_DIR)/targets/armv7-linux-androideabi/lib/lib$(1:opencv_dep_%=%).so
LOCAL_SRC_FILES:=$(CUDA_LIBS_DIR)/lib$(1:opencv_dep_%=%).so
include $(PREBUILT_SHARED_LIBRARY)
endef
@ -202,7 +226,7 @@ ifeq ($(OPENCV_USE_GPU_MODULE),on)
ifeq ($(INSTALL_CUDA_LIBRARIES),on)
LOCAL_SHARED_LIBRARIES += $(foreach mod, $(CUDA_RUNTIME_LIBS), $(mod))
else
LOCAL_LDLIBS += -L$(CUDA_TOOLKIT_DIR)/targets/armv7-linux-androideabi/lib \
LOCAL_LDLIBS += -L$(CUDA_LIBS_DIR) \
$(foreach lib, $(CUDA_RUNTIME_LIBS), -l$(lib:opencv_dep_%=%))
endif
LOCAL_STATIC_LIBRARIES+=libopencv_gpu

Loading…
Cancel
Save