diff --git a/CMakeLists.txt b/CMakeLists.txt index 0502fb899..8707e0155 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -467,7 +467,7 @@ if(BUILD_ANDROID_PACKAGE) add_subdirectory(android/package) endif() -if (ANDROID AND NOT BUILD_ANDROID_SERVICE AND NOT BUILD_ANDROID_PACKAGE AND NOT BUILD_CAMERA_WRAPER) +if (ANDROID) add_subdirectory(android/libinfo) endif() diff --git a/android/libinfo/info.c b/android/libinfo/info.c index f1e5bf01e..f0c2dd6a2 100644 --- a/android/libinfo/info.c +++ b/android/libinfo/info.c @@ -7,7 +7,7 @@ const char* GetLibraryList(void); JNIEXPORT jstring JNICALL Java_org_opencv_android_StaticHelper_getLibraryList(JNIEnv *, jclass); #define PACKAGE_NAME "org.opencv.lib_v" CVAUX_STR(CV_MAJOR_VERSION) CVAUX_STR(CV_MINOR_VERSION) "_" ANDROID_PACKAGE_PLATFORM -#define PACKAGE_REVISION CVAUX_STR(CV_SUBMINOR_VERSION) CVAUX_STR(ANDROID_PACKAGE_RELEASE) +#define PACKAGE_REVISION CVAUX_STR(CV_SUBMINOR_VERSION) "." CVAUX_STR(ANDROID_PACKAGE_RELEASE) const char* GetPackageName(void) { diff --git a/android/service/engine/AndroidManifest.xml b/android/service/engine/AndroidManifest.xml index 1e0652494..fdf6303d9 100644 --- a/android/service/engine/AndroidManifest.xml +++ b/android/service/engine/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="22@ANDROID_PLATFORM_VERSION_CODE@" + android:versionName="2.2" > diff --git a/android/service/engine/CMakeLists.txt b/android/service/engine/CMakeLists.txt index 529aef9bd..b0d8425ca 100644 --- a/android/service/engine/CMakeLists.txt +++ b/android/service/engine/CMakeLists.txt @@ -4,6 +4,24 @@ set(JNI_LIB_NAME ${engine} ${engine}_jni) unset(__android_project_chain CACHE) add_android_project(opencv_engine "${CMAKE_CURRENT_SOURCE_DIR}" SDK_TARGET 8 ${ANDROID_SDK_TARGET} IGNORE_JAVA ON) +set(ANDROID_PLATFORM_VERSION_CODE "0") + +if(ARMEABI_V7A) + set(ANDROID_PLATFORM_VERSION_CODE "2") + elseif(ARMEABI_V6) + set(ANDROID_PLATFORM_VERSION_CODE "1") + elseif(ARMEABI) + set(ANDROID_PLATFORM_VERSION_CODE "1") + elseif(X86) + set(ANDROID_PLATFORM_VERSION_CODE "3") + elseif(MIPS) + set(ANDROID_PLATFORM_VERSION_CODE "4") + else() + message(WARNING "Can not automatically determine the value for ANDROID_PLATFORM_VERSION_CODE") + endif() + +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${ANDROID_MANIFEST_FILE}" "${OpenCV_BINARY_DIR}/android/service/engine/.build/${ANDROID_MANIFEST_FILE}" @ONLY) + link_directories("${ANDROID_SOURCE_TREE}/out/target/product/generic/system/lib" "${ANDROID_SOURCE_TREE}/out/target/product/${ANDROID_PRODUCT}/system/lib" "${ANDROID_SOURCE_TREE}/bin/${ANDROID_ARCH_NAME}") # -D__SUPPORT_ARMEABI_FEATURES key is also available