mirror of https://github.com/opencv/opencv.git
parent
d822989c8b
commit
6a13c9efc0
13 changed files with 127 additions and 88 deletions
@ -0,0 +1,15 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
package="org.opencv.lib_v@OPENCV_VERSION_MAJOR@@OPENCV_VERSION_MINOR@_@ANDROID_PACKAGE_PLATFORM@" |
||||||
|
android:versionCode="@OPENCV_VERSION_PATCH@@ANDROID_PACKAGE_RELEASE@" |
||||||
|
android:versionName="@OPENCV_VERSION_PATCH@.@ANDROID_PACKAGE_RELEASE@" > |
||||||
|
|
||||||
|
<uses-sdk android:minSdkVersion="@ANDROID_SDK_VERSION@" /> |
||||||
|
<uses-feature android:name="android.hardware.touchscreen" android:required="false"/> |
||||||
|
|
||||||
|
<application |
||||||
|
android:icon="@drawable/icon" |
||||||
|
android:label="@string/app_name" > |
||||||
|
</application> |
||||||
|
|
||||||
|
</manifest> |
@ -1,2 +1,93 @@ |
|||||||
#tbd |
if(NOT ANDROID_PACKAGE_RELEASE) |
||||||
add_subdirectory(info_lib) |
set(ANDROID_PACKAGE_RELEASE 1) |
||||||
|
endif() |
||||||
|
|
||||||
|
if(NOT ANDROID_PACKAGE_PLATFORM) |
||||||
|
if(ARMEABI_V7A) |
||||||
|
if(NEON) |
||||||
|
set(ANDROID_PACKAGE_PLATFORM armv7a_neon) |
||||||
|
else() |
||||||
|
set(ANDROID_PACKAGE_PLATFORM armv7a) |
||||||
|
endif() |
||||||
|
elseif(ARMEABI_V6) |
||||||
|
set(ANDROID_PACKAGE_PLATFORM armv6) |
||||||
|
elseif(ARMEABI) |
||||||
|
set(ANDROID_PACKAGE_PLATFORM armv5) |
||||||
|
elseif(X86) |
||||||
|
set(ANDROID_PACKAGE_PLATFORM x86) |
||||||
|
elseif(MIPS) |
||||||
|
set(ANDROID_PACKAGE_PLATFORM mips) |
||||||
|
else() |
||||||
|
message(ERROR "Can not automatically determine the value for ANDROID_PACKAGE_PLATFORM") |
||||||
|
endif() |
||||||
|
endif() |
||||||
|
|
||||||
|
if(NOT ANDROID_PACKAGE_PLATFORM_NAME) |
||||||
|
if(ARMEABI_V7A) |
||||||
|
if(NEON) |
||||||
|
set(ANDROID_PACKAGE_PLATFORM_NAME "armeabi-v7a with NEON") |
||||||
|
else() |
||||||
|
set(ANDROID_PACKAGE_PLATFORM_NAME "armeabi-v7a") |
||||||
|
endif() |
||||||
|
elseif(ARMEABI_V6) |
||||||
|
set(ANDROID_PACKAGE_PLATFORM_NAME "armeabi-v6") |
||||||
|
elseif(ARMEABI) |
||||||
|
set(ANDROID_PACKAGE_PLATFORM_NAME "armeabi") |
||||||
|
elseif(X86) |
||||||
|
set(ANDROID_PACKAGE_PLATFORM_NAME "x86") |
||||||
|
elseif(MIPS) |
||||||
|
set(ANDROID_PACKAGE_PLATFORM_NAME "mips") |
||||||
|
else() |
||||||
|
message(ERROR "Can not automatically determine the value for ANDROID_PACKAGE_PLATFORM_NAME") |
||||||
|
endif() |
||||||
|
endif() |
||||||
|
|
||||||
|
if("${ANDROID_NATIVE_API_LEVEL}" MATCHES "[1-9][0-9]*$") |
||||||
|
set(ANDROID_SDK_VERSION ${CMAKE_MATCH_0}) |
||||||
|
endif() |
||||||
|
|
||||||
|
if(NOT ANDROID_SDK_VERSION GREATER 7) |
||||||
|
set(ANDROID_SDK_VERSION 8) |
||||||
|
endif() |
||||||
|
|
||||||
|
set(PACKAGE_DIR "${OpenCV_BINARY_DIR}/package") |
||||||
|
|
||||||
|
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${ANDROID_MANIFEST_FILE}" "${PACKAGE_DIR}/${ANDROID_MANIFEST_FILE}" @ONLY) |
||||||
|
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/res/values/strings.xml" "${PACKAGE_DIR}/res/values/strings.xml" @ONLY) |
||||||
|
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/res/drawable/icon.png" "${PACKAGE_DIR}/res/drawable/icon.png" COPYONLY) |
||||||
|
|
||||||
|
set(target_name "OpenCV_${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}.${OPENCV_VERSION_PATCH}_binary_pack_${ANDROID_PACKAGE_PLATFORM}") |
||||||
|
get_target_property(opencv_java_location opencv_java LOCATION) |
||||||
|
|
||||||
|
set(android_proj_target_files ${ANDROID_PROJECT_FILES}) |
||||||
|
ocv_list_add_prefix(android_proj_target_files "${PACKAGE_DIR}/") |
||||||
|
android_get_compatible_target(android_proj_sdk_target ${ANDROID_SDK_VERSION}) |
||||||
|
set(APK_NAME "${PACKAGE_DIR}/bin/${target_name}-release-unsigned.apk") |
||||||
|
|
||||||
|
file(GLOB camera_wrappers "${OpenCV_SOURCE_DIR}/3rdparty/lib/${ANDROID_NDK_ABI_NAME}/libnative_camera_r*.so") |
||||||
|
set(CAMERA_LIB_COMMANDS "") |
||||||
|
|
||||||
|
foreach(wrapper ${camera_wrappers}) |
||||||
|
list(APPEND CAMERA_LIB_COMMANDS COMMAND ${CMAKE_COMMAND} -E copy "${wrapper}" "${PACKAGE_DIR}/libs/${ANDROID_NDK_ABI_NAME}/") |
||||||
|
endforeach() |
||||||
|
|
||||||
|
add_custom_command( |
||||||
|
OUTPUT "${APK_NAME}" |
||||||
|
COMMAND ${CMAKE_COMMAND} -E remove_directory "${PACKAGE_DIR}/libs" |
||||||
|
COMMAND ${CMAKE_COMMAND} -E remove_directory "${PACKAGE_DIR}/bin" |
||||||
|
COMMAND ${CMAKE_COMMAND} -E remove_directory "${PACKAGE_DIR}/gen" |
||||||
|
COMMAND ${CMAKE_COMMAND} -E remove ${android_proj_target_files} |
||||||
|
COMMAND ${CMAKE_COMMAND} -E make_directory "${PACKAGE_DIR}/src" |
||||||
|
COMMAND ${CMAKE_COMMAND} -E make_directory "${PACKAGE_DIR}/libs/${ANDROID_NDK_ABI_NAME}/" |
||||||
|
${CAMERA_LIB_COMMANDS} |
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy "${opencv_java_location}" "${PACKAGE_DIR}/libs/${ANDROID_NDK_ABI_NAME}/" |
||||||
|
COMMAND ${ANDROID_EXECUTABLE} --silent update project --path "${PACKAGE_DIR}" --target "${android_proj_sdk_target}" --name "${target_name}" |
||||||
|
COMMAND ${ANT_EXECUTABLE} -q -noinput -k release |
||||||
|
COMMAND ${CMAKE_COMMAND} -E touch "${APK_NAME}" |
||||||
|
WORKING_DIRECTORY "${PACKAGE_DIR}" |
||||||
|
MAIN_DEPENDENCY "${opencv_java_location}" |
||||||
|
DEPENDS "${PACKAGE_DIR}/${ANDROID_MANIFEST_FILE}" "${PACKAGE_DIR}/res/values/strings.xml" "${PACKAGE_DIR}/res/drawable/icon.png" ${camera_wrappers} |
||||||
|
) |
||||||
|
|
||||||
|
add_custom_target(android_package ALL SOURCES "${APK_NAME}" ) |
||||||
|
add_dependencies(android_package opencv_java) |
@ -1 +0,0 @@ |
|||||||
#tbd |
|
@ -1,17 +0,0 @@ |
|||||||
LOCAL_PATH := $(call my-dir)
|
|
||||||
include $(CLEAR_VARS) |
|
||||||
|
|
||||||
LOCAL_MODULE_TAGS := optional
|
|
||||||
|
|
||||||
LOCAL_SRC_FILES := \
|
|
||||||
src/info.c
|
|
||||||
|
|
||||||
LOCAL_C_INCLUDES := \
|
|
||||||
$(LOCAL_PATH)/include \
|
|
||||||
$(TOP)/frameworks/base/core/jni
|
|
||||||
|
|
||||||
LOCAL_PRELINK_MODULE := false
|
|
||||||
|
|
||||||
LOCAL_MODULE := libopencvinfo
|
|
||||||
|
|
||||||
include $(BUILD_SHARED_LIBRARY) |
|
@ -1,2 +0,0 @@ |
|||||||
APP_ABI := armeabi-v7a x86
|
|
||||||
APP_PLATFORM := android-8
|
|
@ -1,3 +0,0 @@ |
|||||||
// Function return list of shared libs seporated with ";" symbol
|
|
||||||
// in load order
|
|
||||||
const char* GetLibraryList(); |
|
@ -1,31 +0,0 @@ |
|||||||
/* DO NOT EDIT THIS FILE - it is machine generated */ |
|
||||||
#include <jni.h> |
|
||||||
/* Header for class org_opencv_android_OpenCVLoader */ |
|
||||||
|
|
||||||
#ifndef _Included_org_opencv_android_OpenCVLoader |
|
||||||
#define _Included_org_opencv_android_OpenCVLoader |
|
||||||
#ifdef __cplusplus |
|
||||||
extern "C" { |
|
||||||
#endif |
|
||||||
#undef org_opencv_android_OpenCVLoader_Success |
|
||||||
#define org_opencv_android_OpenCVLoader_Success 0L |
|
||||||
#undef org_opencv_android_OpenCVLoader_NoService |
|
||||||
#define org_opencv_android_OpenCVLoader_NoService 1L |
|
||||||
#undef org_opencv_android_OpenCVLoader_RestartRequired |
|
||||||
#define org_opencv_android_OpenCVLoader_RestartRequired 2L |
|
||||||
#undef org_opencv_android_OpenCVLoader_MarketError |
|
||||||
#define org_opencv_android_OpenCVLoader_MarketError 3L |
|
||||||
#undef org_opencv_android_OpenCVLoader_InitFailed |
|
||||||
#define org_opencv_android_OpenCVLoader_InitFailed 255L |
|
||||||
/*
|
|
||||||
* Class: org_opencv_android_OpenCVLoader |
|
||||||
* Method: GetLibraryList |
|
||||||
* Signature: ()Ljava/lang/String; |
|
||||||
*/ |
|
||||||
JNIEXPORT jstring JNICALL Java_org_opencv_android_StaticHelper_getLibraryList |
|
||||||
(JNIEnv *, jclass); |
|
||||||
|
|
||||||
#ifdef __cplusplus |
|
||||||
} |
|
||||||
#endif |
|
||||||
#endif |
|
@ -1,18 +0,0 @@ |
|||||||
#include "info.h" |
|
||||||
#include <jni.h> |
|
||||||
|
|
||||||
#ifndef LIB_STRING |
|
||||||
#define LIB_STRING "libtbb.so;libopencv_java.so" |
|
||||||
#endif |
|
||||||
|
|
||||||
const char* GetLibraryList() |
|
||||||
{ |
|
||||||
return LIB_STRING; |
|
||||||
} |
|
||||||
|
|
||||||
JNIEXPORT jstring JNICALL Java_org_opencv_android_StaticHelper_getLibraryList(JNIEnv* jenv, jclass clazz) |
|
||||||
{ |
|
||||||
jstring result = (*jenv)->NewStringUTF(jenv, LIB_STRING); |
|
||||||
|
|
||||||
return result; |
|
||||||
} |
|
After Width: | Height: | Size: 5.6 KiB |
@ -0,0 +1,6 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<resources> |
||||||
|
|
||||||
|
<string name="app_name">OCV @OPENCV_VERSION_MAJOR@.@OPENCV_VERSION_MINOR@ binary pack for @ANDROID_PACKAGE_PLATFORM_NAME@</string> |
||||||
|
|
||||||
|
</resources> |
@ -1,2 +1,6 @@ |
|||||||
|
if(BUILD_ANDROID_PACKAGE) |
||||||
|
ocv_module_disable(nonfree) |
||||||
|
endif() |
||||||
|
|
||||||
set(the_description "Functionality with possible limitations on the use") |
set(the_description "Functionality with possible limitations on the use") |
||||||
ocv_define_module(nonfree opencv_imgproc opencv_features2d) |
ocv_define_module(nonfree opencv_imgproc opencv_features2d) |
||||||
|
Loading…
Reference in new issue