From e58f4e44c8b72a864ae61fd459e940da40bcbfb6 Mon Sep 17 00:00:00 2001 From: Alexander Smorkalov Date: Fri, 1 Feb 2013 13:15:39 +0400 Subject: [PATCH] Modules redifinition in case of multiple includes of OpenCV.mk in single Android.mk fixed. --- cmake/templates/OpenCV.mk.in | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/cmake/templates/OpenCV.mk.in b/cmake/templates/OpenCV.mk.in index d52f75b915..943d7cb672 100644 --- a/cmake/templates/OpenCV.mk.in +++ b/cmake/templates/OpenCV.mk.in @@ -89,14 +89,20 @@ define add_opencv_camera_module include $(PREBUILT_SHARED_LIBRARY) endef -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)))) +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 -ifneq ($(OPENCV_BASEDIR),) - OPENCV_LOCAL_C_INCLUDES += $(foreach mod, $(OPENCV_MODULES), $(OPENCV_BASEDIR)/modules/$(mod)/include) + #turn off module installation to prevent their redefinition + OPENCV_MK_ALREADY_INCLUDED:=on endif ifeq ($(OPENCV_LOCAL_CFLAGS),)