Hello,
(please excuse that I'm not very familiar with makefiles) My current Makefile looks like this:
LOCAL_PATH := $(call my-dir)
#
# Library One
#
include $(CLEAR_VARS)
LOCAL_MODULE := LibOne
LOCAL_SRC_FILES := LibOne.cpp
LOCAL_LDLIBS += -llog
include $(BUILD_STATIC_LIBRARY)
#
# All libraries using OpenCV united
#
include $(CLEAR_VARS)
OPENCV_LIB_TYPE:=STATIC
OPENCV_INSTALL_MODULES:=on
include ../OpenCV-2.4.1/share/opencv/OpenCV.mk
LOCAL_MODULE := MyLib
LOCAL_SRC_FILES := LibTwo.cpp LibThree.cpp
LOCAL_STATIC_LIBRARIES += LibOne
LOCAL_LDLIBS += -llog -ldl -ljnigraphics -landroid
include $(BUILD_SHARED_LIBRARY)
As you see, I have LibOne, which does not need OpenCV and LibTwo plus LibThree, which need OpenCV.
What I want to acchieve is to separate LibTwo and LibThree (as I did it with LibOne). But when I do this
LOCAL_PATH := $(call my-dir)
#
# Library One
#
include $(CLEAR_VARS)
LOCAL_MODULE := LibOne
LOCAL_SRC_FILES := LibOne.cpp
LOCAL_LDLIBS += -llog
include $(BUILD_STATIC_LIBRARY)
#
# OpenCv
#
include $(CLEAR_VARS)
OPENCV_LIB_TYPE:=STATIC
OPENCV_INSTALL_MODULES:=on
include ../OpenCV-2.4.1/share/opencv/OpenCV.mk
#
# Library Two
#
include $(CLEAR_VARS)
LOCAL_MODULE := LibTwo
LOCAL_SRC_FILES := LibTwo.cpp
include $(BUILD_STATIC_LIBRARY)
#
# Library
#
# include $(CLEAR_VARS) <----------- notice/remember this line!
LOCAL_MODULE := MyLib
LOCAL_SRC_FILES := LibThree.cpp
LOCAL_STATIC_LIBRARIES += LibOne LibTwo
LOCAL_LDLIBS += -llog -ldl -ljnigraphics -landroid
include $(BUILD_SHARED_LIBRARY)
The compiling aborts with the error
jni/Android.mk:MyLib: LOCAL_MODULE_FILENAME should not include file extensions
This is of course because I did not use #include $(CLEAR_VARS) before the definition of MyLib. But if I do so, the OpenCV-Stuff is not accessible by MyLib!
So my Question is:
how to define multiple libraries using OpenCV?Is there a way to add the OpenCV-library into LOCAL_STATIC_LIBRARIES?