2011-06-28 13:34:41 +02:00
|
|
|
# In order to compile your application under cygwin
|
2012-02-03 12:26:49 +01:00
|
|
|
# you might need to define NDK_USE_CYGPATH=1 before calling the ndk-build
|
2011-06-28 13:34:41 +02:00
|
|
|
|
2011-06-28 10:48:23 +02:00
|
|
|
USER_LOCAL_PATH:=$(LOCAL_PATH)
|
2011-06-28 13:34:41 +02:00
|
|
|
LOCAL_PATH:=$(subst ?,,$(firstword ?$(subst \, ,$(subst /, ,$(call my-dir)))))
|
2011-06-28 10:48:23 +02:00
|
|
|
|
2012-09-06 14:09:20 +02:00
|
|
|
OPENCV_TARGET_ARCH_ABI:=$(TARGET_ARCH_ABI)
|
2011-06-28 10:48:23 +02:00
|
|
|
OPENCV_THIS_DIR:=$(patsubst $(LOCAL_PATH)\\%,%,$(patsubst $(LOCAL_PATH)/%,%,$(call my-dir)))
|
2012-03-23 18:03:05 +01:00
|
|
|
OPENCV_MK_DIR:=$(dir $(lastword $(MAKEFILE_LIST)))
|
2012-02-03 12:26:49 +01:00
|
|
|
OPENCV_LIBS_DIR:=@OPENCV_LIBS_DIR_CONFIGCMAKE@
|
2012-06-28 19:23:50 +02:00
|
|
|
OPENCV_3RDPARTY_LIBS_DIR:=@OPENCV_3RDPARTY_LIBS_DIR_CONFIGCMAKE@
|
2012-02-03 12:26:49 +01:00
|
|
|
OPENCV_BASEDIR:=@OPENCV_BASE_INCLUDE_DIR_CONFIGCMAKE@
|
2012-10-17 01:18:30 +02:00
|
|
|
OPENCV_LOCAL_C_INCLUDES:=@OPENCV_INCLUDE_DIRS_CONFIGCMAKE@
|
2012-02-03 12:26:49 +01:00
|
|
|
OPENCV_MODULES:=@OPENCV_MODULES_CONFIGMAKE@
|
2012-03-23 18:03:05 +01:00
|
|
|
|
|
|
|
ifeq ($(OPENCV_LIB_TYPE),)
|
2012-10-17 01:18:30 +02:00
|
|
|
OPENCV_LIB_TYPE:=@OPENCV_LIBTYPE_CONFIGMAKE@
|
2012-03-23 18:03:05 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(OPENCV_LIB_TYPE),SHARED)
|
2012-10-17 01:18:30 +02:00
|
|
|
OPENCV_LIBS:=@OPENCV_LIBS_CONFIGMAKE@
|
|
|
|
OPENCV_LIB_TYPE:=@OPENCV_LIBTYPE_CONFIGMAKE@
|
2012-03-23 18:03:05 +01:00
|
|
|
else
|
2012-10-17 01:18:30 +02:00
|
|
|
OPENCV_LIBS:=$(OPENCV_MODULES)
|
|
|
|
OPENCV_LIB_TYPE:=@OPENCV_STATIC_LIBTYPE_CONFIGMAKE@
|
2012-03-23 18:03:05 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(OPENCV_LIB_TYPE),SHARED)
|
2012-10-17 01:18:30 +02:00
|
|
|
OPENCV_3RDPARTY_COMPONENTS:=
|
|
|
|
OPENCV_EXTRA_COMPONENTS:=
|
2012-03-23 18:03:05 +01:00
|
|
|
else
|
2012-11-19 09:58:17 +01:00
|
|
|
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
|
|
|
|
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@
|
|
|
|
endif
|
|
|
|
ifeq ($(TARGET_ARCH_ABI),armeabi)
|
|
|
|
OPENCV_3RDPARTY_COMPONENTS:=@OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE_NO_TBB@
|
|
|
|
OPENCV_EXTRA_COMPONENTS:=@OPENCV_EXTRA_COMPONENTS_CONFIGMAKE@
|
|
|
|
endif
|
|
|
|
ifeq ($(TARGET_ARCH_ABI),mips)
|
2013-02-26 07:32:10 +01:00
|
|
|
OPENCV_3RDPARTY_COMPONENTS:=@OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE@
|
2012-11-19 09:58:17 +01:00
|
|
|
OPENCV_EXTRA_COMPONENTS:=@OPENCV_EXTRA_COMPONENTS_CONFIGMAKE@
|
|
|
|
endif
|
2012-03-23 18:03:05 +01:00
|
|
|
endif
|
2011-06-20 17:35:05 +02:00
|
|
|
|
2012-06-28 19:23:50 +02:00
|
|
|
ifeq (${OPENCV_CAMERA_MODULES},on)
|
2012-10-17 01:18:30 +02:00
|
|
|
ifeq ($(TARGET_ARCH_ABI),armeabi)
|
|
|
|
OPENCV_CAMERA_MODULES:=@OPENCV_CAMERA_LIBS_ARMEABI_CONFIGCMAKE@
|
|
|
|
endif
|
|
|
|
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
|
|
|
|
OPENCV_CAMERA_MODULES:=@OPENCV_CAMERA_LIBS_ARMEABI_V7A_CONFIGCMAKE@
|
|
|
|
endif
|
|
|
|
ifeq ($(TARGET_ARCH_ABI),x86)
|
|
|
|
OPENCV_CAMERA_MODULES:=@OPENCV_CAMERA_LIBS_X86_CONFIGCMAKE@
|
|
|
|
endif
|
2013-02-22 08:57:42 +01:00
|
|
|
ifeq ($(TARGET_ARCH_ABI),mips)
|
|
|
|
OPENCV_CAMERA_MODULES:=@OPENCV_CAMERA_LIBS_MIPS_CONFIGCMAKE@
|
|
|
|
endif
|
2012-06-28 19:23:50 +02:00
|
|
|
else
|
2012-10-17 01:18:30 +02:00
|
|
|
OPENCV_CAMERA_MODULES:=
|
2011-06-29 15:18:20 +02:00
|
|
|
endif
|
2011-06-28 10:48:23 +02:00
|
|
|
|
2011-06-20 17:35:05 +02:00
|
|
|
ifeq ($(OPENCV_LIB_TYPE),SHARED)
|
2012-10-17 01:18:30 +02:00
|
|
|
OPENCV_LIB_SUFFIX:=so
|
2011-06-20 17:35:05 +02:00
|
|
|
else
|
2012-10-17 01:18:30 +02:00
|
|
|
OPENCV_LIB_SUFFIX:=a
|
|
|
|
OPENCV_INSTALL_MODULES:=on
|
2011-06-20 17:35:05 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
define add_opencv_module
|
2012-10-17 01:18:30 +02:00
|
|
|
include $(CLEAR_VARS)
|
|
|
|
LOCAL_MODULE:=opencv_$1
|
|
|
|
LOCAL_SRC_FILES:=$(OPENCV_LIBS_DIR)/libopencv_$1.$(OPENCV_LIB_SUFFIX)
|
|
|
|
include $(PREBUILT_$(OPENCV_LIB_TYPE)_LIBRARY)
|
2011-06-20 17:35:05 +02:00
|
|
|
endef
|
|
|
|
|
2012-02-03 12:26:49 +01:00
|
|
|
define add_opencv_3rdparty_component
|
2012-10-17 01:18:30 +02:00
|
|
|
include $(CLEAR_VARS)
|
|
|
|
LOCAL_MODULE:=$1
|
|
|
|
LOCAL_SRC_FILES:=$(OPENCV_3RDPARTY_LIBS_DIR)/lib$1.a
|
|
|
|
include $(PREBUILT_STATIC_LIBRARY)
|
2011-06-20 17:35:05 +02:00
|
|
|
endef
|
|
|
|
|
|
|
|
define add_opencv_camera_module
|
2012-10-17 01:18:30 +02:00
|
|
|
include $(CLEAR_VARS)
|
|
|
|
LOCAL_MODULE:=$1
|
|
|
|
LOCAL_SRC_FILES:=$(OPENCV_LIBS_DIR)/lib$1.so
|
|
|
|
include $(PREBUILT_SHARED_LIBRARY)
|
2011-06-20 17:35:05 +02:00
|
|
|
endef
|
|
|
|
|
2013-02-01 10:15:39 +01:00
|
|
|
ifeq ($(OPENCV_MK_ALREADY_INCLUDED),)
|
|
|
|
ifeq ($(OPENCV_INSTALL_MODULES),on)
|
|
|
|
$(foreach module,$(OPENCV_LIBS),$(eval $(call add_opencv_module,$(module))))
|
|
|
|
endif
|
|
|
|
|
|
|
|
$(foreach module,$(OPENCV_3RDPARTY_COMPONENTS),$(eval $(call add_opencv_3rdparty_component,$(module))))
|
|
|
|
$(foreach module,$(OPENCV_CAMERA_MODULES),$(eval $(call add_opencv_camera_module,$(module))))
|
|
|
|
|
|
|
|
ifneq ($(OPENCV_BASEDIR),)
|
|
|
|
OPENCV_LOCAL_C_INCLUDES += $(foreach mod, $(OPENCV_MODULES), $(OPENCV_BASEDIR)/modules/$(mod)/include)
|
|
|
|
endif
|
2011-06-20 17:35:05 +02:00
|
|
|
|
2013-02-01 10:15:39 +01:00
|
|
|
#turn off module installation to prevent their redefinition
|
|
|
|
OPENCV_MK_ALREADY_INCLUDED:=on
|
2011-06-20 17:35:05 +02:00
|
|
|
endif
|
|
|
|
|
2012-03-23 18:03:05 +01:00
|
|
|
ifeq ($(OPENCV_LOCAL_CFLAGS),)
|
2012-10-17 01:18:30 +02:00
|
|
|
OPENCV_LOCAL_CFLAGS := -fPIC -DANDROID -fsigned-char
|
2011-06-28 10:48:23 +02:00
|
|
|
endif
|
|
|
|
|
2011-06-20 17:35:05 +02:00
|
|
|
include $(CLEAR_VARS)
|
2012-03-23 18:03:05 +01:00
|
|
|
LOCAL_C_INCLUDES += $(OPENCV_LOCAL_C_INCLUDES)
|
|
|
|
LOCAL_CFLAGS += $(OPENCV_LOCAL_CFLAGS)
|
|
|
|
|
|
|
|
ifeq ($(OPENCV_INSTALL_MODULES),on)
|
2012-10-17 01:18:30 +02:00
|
|
|
LOCAL_$(OPENCV_LIB_TYPE)_LIBRARIES += $(foreach mod, $(OPENCV_LIBS), opencv_$(mod))
|
2012-03-23 18:03:05 +01:00
|
|
|
else
|
2012-10-17 01:18:30 +02:00
|
|
|
LOCAL_LDLIBS += -L$(call host-path,$(LOCAL_PATH)/$(OPENCV_LIBS_DIR)) $(foreach lib, $(OPENCV_LIBS), -lopencv_$(lib))
|
2012-03-23 18:03:05 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(OPENCV_LIB_TYPE),STATIC)
|
2012-10-17 01:18:30 +02:00
|
|
|
LOCAL_STATIC_LIBRARIES += $(OPENCV_3RDPARTY_COMPONENTS)
|
2012-03-23 18:03:05 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
LOCAL_LDLIBS += $(foreach lib,$(OPENCV_EXTRA_COMPONENTS), -l$(lib))
|
2011-06-28 10:48:23 +02:00
|
|
|
|
2012-02-03 12:26:49 +01:00
|
|
|
#restore the LOCAL_PATH
|
2011-06-28 10:48:23 +02:00
|
|
|
LOCAL_PATH:=$(USER_LOCAL_PATH)
|