here is my Android.mk file
Code: Select all
# general
LOCAL_PATH := $(call my-dir)/..
IRRLICHT_PATH := D:\android_native\irrlicht_ogl_es
OPENCV_PATH := C:\OpenCV-android-sdk\sdk\native
TARGET_PROJECT_PATH := D:\android_native\openCVTest
# irrlicht
include $(CLEAR_VARS)
LOCAL_MODULE := Irrlicht
LOCAL_SRC_FILES := $(IRRLICHT_PATH)\source\Irrlicht\Android\obj\local\$(TARGET_ARCH_ABI)\libIrrlicht.a
include $(PREBUILT_STATIC_LIBRARY)
$(info +----------------------------------------------------------------------)
$(info |Irrlicht 3D)
$(info |include path : $(IRRLICHT_PATH))
$(info +----------------------------------------------------------------------)
$(info )
# open cv
include $(CLEAR_VARS)
OPENCV_INSTALL_MODULES:=on
OPENCV_CAMERA_MODULES:=on
OPENCV_LIB_TYPE:=STATIC
include $(OPENCV_PATH)\jni\OpenCV.mk
$(info +----------------------------------------------------------------------)
$(info |Open CV)
$(info |include path : )
$(info | $(OPENCV_LOCAL_C_INCLUDES))
$(info |Flag compiler : )
$(info | $(OPENCV_LOCAL_CFLAGS))
$(info |Components : )
$(info | $(OPENCV_MODULES))
$(info |3rd party Components : )
$(info | $(OPENCV_3RDPARTY_COMPONENTS))
$(info +----------------------------------------------------------------------)
$(info )
# main
include $(CLEAR_VARS)
LOCAL_MODULE := openCVTest
LOCAL_CFLAGS := -pipe -fno-exceptions -fno-rtti -fstrict-aliasing
# debug mode or use speed optimization
ifndef NDEBUG
LOCAL_CFLAGS += -g -D_DEBUG
else
LOCAL_CFLAGS += -fexpensive-optimizations -O3
endif
#special flag for x86
ifeq ($(TARGET_ARCH_ABI),x86)
LOCAL_CFLAGS += -fno-stack-protector
endif
LOCAL_C_INCLUDES := $(IRRLICHT_PATH)\include
LOCAL_C_INCLUDES += $(OPENCV_LOCAL_C_INCLUDES)
LOCAL_SRC_FILES := main.cpp android_tools.cpp
#irrlicht and user flags
LOCAL_LDLIBS := -lEGL -llog -lGLESv1_CM -lGLESv2 -lz -landroid
# addition from opencv
LOCAL_LDLIBS += $(foreach lib,$(OPENCV_EXTRA_COMPONENTS), -l$(lib))
#opencv
LOCAL_WHOLE_STATIC_LIBRARIES := $(OPENCV_3RDPARTY_COMPONENTS) $(OPENCV_MODULES)
#irrlicht and project static libs
LOCAL_WHOLE_STATIC_LIBRARIES += Irrlicht android_native_app_glue
#summary
$(info +----------------------------------------------------------------------)
$(info +----------------SUMMARY------SUMMARY--------SUMMARY-------------------)
$(info +----------------------------------------------------------------------)
$(info |TARGET_ARCH_ABI : $(TARGET_ARCH_ABI))
$(info |LOCAL_MODULE : $(LOCAL_MODULE))
$(info |LOCAL_CFLAGS : $(LOCAL_CFLAGS))
$(info |LOCAL_C_INCLUDES : $(LOCAL_C_INCLUDES))
$(info |LOCAL_SRC_FILES : $(LOCAL_SRC_FILES))
$(info |LOCAL_LDLIBS : $(LOCAL_LDLIBS))
$(info |LOCAL_WHOLE_STATIC_LIBRARIES : $(LOCAL_WHOLE_STATIC_LIBRARIES))
$(info +----------------------------------------------------------------------)
$(info )
$(info )
include $(BUILD_SHARED_LIBRARY)
$(call import-module,android\native_app_glue)
# copy Irrlicht data to assets
$(shell mkdir $(TARGET_PROJECT_PATH)\assets)
$(shell mkdir $(TARGET_PROJECT_PATH)\assets\media)
$(shell mkdir $(TARGET_PROJECT_PATH)\assets\media\Shaders)
$(shell mkdir $(TARGET_PROJECT_PATH)\src)
#copy all irrlicht shaders
IGNORE := $(shell copy /y $(IRRLICHT_PATH)\media\Shaders\ $(TARGET_PROJECT_PATH)\assets\media\Shaders)
Code: Select all
D:\android_native\openCVTest>ndk-build
+----------------------------------------------------------------------
|Irrlicht 3D
|include path : D:\android_native\irrlicht_ogl_es
+----------------------------------------------------------------------
+----------------------------------------------------------------------
|Open CV
|include path :
| "C:/OpenCV-android-sdk/sdk/native/jni/include/opencv" "C:/OpenCV-android-sdk/sdk/native/jni/include"
|Flag compiler :
| -fPIC -DANDROID -fsigned-char
|Components :
| shape stitching objdetect superres videostab calib3d features2d highgui videoio imgcodecs video photo ml imgproc flann core
|3rd party Components :
| libjpeg libwebp libpng libtiff libjasper IlmImf tbb
+----------------------------------------------------------------------
+----------------------------------------------------------------------
+----------------SUMMARY------SUMMARY--------SUMMARY-------------------
+----------------------------------------------------------------------
|TARGET_ARCH_ABI : armeabi
|LOCAL_MODULE : openCVTest
|LOCAL_CFLAGS : -pipe -fno-exceptions -fno-rtti -fstrict-aliasing -g -D_DEBUG
|LOCAL_C_INCLUDES : D:\android_native\irrlicht_ogl_es\include "C:/OpenCV-android-sdk/sdk/native/jni/include/opencv" "C:/OpenCV-android-sdk/sdk/native/jni/include"
|LOCAL_SRC_FILES : main.cpp android_tools.cpp
|LOCAL_LDLIBS : -lEGL -llog -lGLESv1_CM -lGLESv2 -lz -landroid -lz -ldl -lm -llog
|LOCAL_WHOLE_STATIC_LIBRARIES : libjpeg libwebp libpng libtiff libjasper IlmImf tbb shape stitching objdetect superres videostab calib3d features2d highgui videoio imgcodecs video photo ml imgproc flann core Irrlicht android_native_app_glue
+----------------------------------------------------------------------
A subdirectory or file D:\android_native\openCVTest\assets already exists.
A subdirectory or file D:\android_native\openCVTest\assets\media already exists.
A subdirectory or file D:\android_native\openCVTest\assets\media\Shaders already exists.
A subdirectory or file D:\android_native\openCVTest\src already exists.
[armeabi] Gdbserver : [arm-linux-androideabi-4.9] libs/armeabi/gdbserver
[armeabi] Gdbsetup : libs/armeabi/gdb.setup
[armeabi] Compile++ thumb: openCVTest <= main.cpp
[armeabi] Compile++ thumb: openCVTest <= android_tools.cpp
[armeabi] SharedLibrary : libopenCVTest.so
error: D:\android_native\irrlicht_ogl_es\source\Irrlicht\Android\obj\local\armeabi\libIrrlicht.a(jaricom.o): multiple definition of 'jpeg_aritab'
C:/OpenCV-android-sdk/sdk/native/jni/../3rdparty/libs/armeabi/liblibjpeg.a(jaricom.c.o): previous definition here
error: D:\android_native\irrlicht_ogl_es\source\Irrlicht\Android\obj\local\armeabi\libIrrlicht.a(jcapimin.o): multiple definition of 'jpeg_CreateCompress'
C:/OpenCV-android-sdk/sdk/native/jni/../3rdparty/libs/armeabi/liblibjpeg.a(jcapimin.c.o): previous definition here
error: D:\android_native\irrlicht_ogl_es\source\Irrlicht\Android\obj\local\armeabi\libIrrlicht.a(jcapimin.o): multiple definition of 'jpeg_destroy_compress'
C:/OpenCV-android-sdk/sdk/native/jni/../3rdparty/libs/armeabi/liblibjpeg.a(jcapimin.c.o): previous definition here
error: D:\android_native\irrlicht_ogl_es\source\Irrlicht\Android\obj\local\armeabi\libIrrlicht.a(jcapimin.o): multiple definition of 'jpeg_abort_compress'
C:/OpenCV-android-sdk/sdk/native/jni/../3rdparty/libs/armeabi/liblibjpeg.a(jcapimin.c.o): previous definition here
error: D:\android_native\irrlicht_ogl_es\source\Irrlicht\Android\obj\local\armeabi\libIrrlicht.a(jcapimin.o): multiple definition of 'jpeg_suppress_tables'
.............