Commit da31e12f authored by Alexander Smorkalov's avatar Alexander Smorkalov

CMake for OpenCV Manager updated;

Some repo normalization problems fixed;
Deprecated cmake keys removed;
Warning fixed.
parent d495daf1
...@@ -157,7 +157,7 @@ OCV_OPTION(BUILD_TESTS "Build accuracy & regression tests" ...@@ -157,7 +157,7 @@ OCV_OPTION(BUILD_TESTS "Build accuracy & regression tests"
OCV_OPTION(BUILD_WITH_DEBUG_INFO "Include debug info into debug libs (not MSCV only)" ON ) OCV_OPTION(BUILD_WITH_DEBUG_INFO "Include debug info into debug libs (not MSCV only)" ON )
OCV_OPTION(BUILD_WITH_STATIC_CRT "Enables use of staticaly linked CRT for staticaly linked OpenCV" ON IF MSVC ) OCV_OPTION(BUILD_WITH_STATIC_CRT "Enables use of staticaly linked CRT for staticaly linked OpenCV" ON IF MSVC )
OCV_OPTION(BUILD_FAT_JAVA_LIB "Create fat java wrapper containing the whole OpenCV library" ON IF ANDROID AND NOT BUILD_SHARED_LIBS AND CMAKE_COMPILER_IS_GNUCXX ) OCV_OPTION(BUILD_FAT_JAVA_LIB "Create fat java wrapper containing the whole OpenCV library" ON IF ANDROID AND NOT BUILD_SHARED_LIBS AND CMAKE_COMPILER_IS_GNUCXX )
OCV_OPTION(BUILD_ANDROID_SERVICE "Build OpenCV Manager for Google Play" OFF IF ANDROID AND ANDROID_USE_STLPORT AND ANDROID_SOURCE_TREE ) OCV_OPTION(BUILD_ANDROID_SERVICE "Build OpenCV Manager for Google Play" OFF IF ANDROID AND ANDROID_SOURCE_TREE )
OCV_OPTION(BUILD_ANDROID_PACKAGE "Build platform-specific package for Google Play" OFF IF ANDROID ) OCV_OPTION(BUILD_ANDROID_PACKAGE "Build platform-specific package for Google Play" OFF IF ANDROID )
# 3rd party libs # 3rd party libs
......
...@@ -22,13 +22,16 @@ for s in ConfFile.readlines(): ...@@ -22,13 +22,16 @@ for s in ConfFile.readlines():
AndroidTreeRoot = str.strip(AndroidTreeRoot, "\n") AndroidTreeRoot = str.strip(AndroidTreeRoot, "\n")
print("Building %s for %s" % (MakeTarget, Arch)) print("Building %s for %s" % (MakeTarget, Arch))
BuildDir = os.path.join(HomeDir, MakeTarget + "_" + Arch) BuildDir = os.path.join(HomeDir, MakeTarget + "_" + Arch)
if (os.path.exists(BuildDir)): if (os.path.exists(BuildDir)):
shutil.rmtree(BuildDir) shutil.rmtree(BuildDir)
try: try:
os.mkdir(BuildDir) os.mkdir(BuildDir)
except: except:
print("Error: cannot create direcotry \"%s\"" % BuildDir) print("Error: cannot create direcotry \"%s\"" % BuildDir)
continue continue
shutil.rmtree(os.path.join(AndroidTreeRoot, "out", "target", "product", "generic", "system"), ignore_errors=True) shutil.rmtree(os.path.join(AndroidTreeRoot, "out", "target", "product", "generic", "system"), ignore_errors=True)
if (Arch == "x86"): if (Arch == "x86"):
shutil.copytree(os.path.join(AndroidTreeRoot, "bin_x86", "system"), os.path.join(AndroidTreeRoot, "out", "target", "product", "generic", "system")) shutil.copytree(os.path.join(AndroidTreeRoot, "bin_x86", "system"), os.path.join(AndroidTreeRoot, "out", "target", "product", "generic", "system"))
...@@ -36,13 +39,14 @@ for s in ConfFile.readlines(): ...@@ -36,13 +39,14 @@ for s in ConfFile.readlines():
shutil.copytree(os.path.join(AndroidTreeRoot, "bin_mips", "system"), os.path.join(AndroidTreeRoot, "out", "target", "product", "generic", "system")) shutil.copytree(os.path.join(AndroidTreeRoot, "bin_mips", "system"), os.path.join(AndroidTreeRoot, "out", "target", "product", "generic", "system"))
else: else:
shutil.copytree(os.path.join(AndroidTreeRoot, "bin_arm", "system"), os.path.join(AndroidTreeRoot, "out", "target", "product", "generic", "system")) shutil.copytree(os.path.join(AndroidTreeRoot, "bin_arm", "system"), os.path.join(AndroidTreeRoot, "out", "target", "product", "generic", "system"))
os.chdir(BuildDir) os.chdir(BuildDir)
BuildLog = os.path.join(BuildDir, "build.log") BuildLog = os.path.join(BuildDir, "build.log")
CmakeCmdLine = "cmake -DCMAKE_TOOLCHAIN_FILE=../android.toolchain.cmake -DANDROID_SOURCE_TREE=\"%s\" -DANDROID_NATIVE_API_LEVEL=\"%s\" -DANDROID_ABI=\"%s\" -DANDROID_USE_STLPORT=ON ../../ > \"%s\" 2>&1" % (AndroidTreeRoot, NativeApiLevel, Arch, BuildLog) CmakeCmdLine = "cmake -DCMAKE_TOOLCHAIN_FILE=../android.toolchain.cmake -DANDROID_SOURCE_TREE=\"%s\" -DANDROID_NATIVE_API_LEVEL=\"%s\" -DANDROID_ABI=\"%s\" -DANDROID_STL=stlport_static ../../ > \"%s\" 2>&1" % (AndroidTreeRoot, NativeApiLevel, Arch, BuildLog)
MakeCmdLine = "make %s >> \"%s\" 2>&1" % (MakeTarget, BuildLog); MakeCmdLine = "make %s >> \"%s\" 2>&1" % (MakeTarget, BuildLog);
#print(CmakeCmdLine) print(CmakeCmdLine)
os.system(CmakeCmdLine) os.system(CmakeCmdLine)
#print(MakeCmdLine) print(MakeCmdLine)
os.system(MakeCmdLine) os.system(MakeCmdLine)
os.chdir(HomeDir) os.chdir(HomeDir)
CameraLib = os.path.join(BuildDir, "lib", Arch, "lib" + MakeTarget + ".so") CameraLib = os.path.join(BuildDir, "lib", Arch, "lib" + MakeTarget + ".so")
...@@ -54,5 +58,5 @@ for s in ConfFile.readlines(): ...@@ -54,5 +58,5 @@ for s in ConfFile.readlines():
print("Building %s for %s\t[\033[91mFAILED\033[0m]" % (MakeTarget, Arch)); print("Building %s for %s\t[\033[91mFAILED\033[0m]" % (MakeTarget, Arch));
else: else:
print("Building %s for %s\t[\033[91mFAILED\033[0m]" % (MakeTarget, Arch)); print("Building %s for %s\t[\033[91mFAILED\033[0m]" % (MakeTarget, Arch));
ConfFile.close()
ConfFile.close()
...@@ -4,5 +4,5 @@ cd `dirname $0`/.. ...@@ -4,5 +4,5 @@ cd `dirname $0`/..
mkdir -p build_service mkdir -p build_service
cd build_service cd build_service
cmake -DCMAKE_TOOLCHAIN_FILE=../android.toolchain.cmake -DANDROID_USE_STLPORT=ON -DBUILD_ANDROID_SERVICE=ON -DANDROID_SOURCE_TREE=~/Projects/AndroidSource/2.2.2/ $@ ../.. cmake -DCMAKE_TOOLCHAIN_FILE=../android.toolchain.cmake -DANDROID_STL=stlport_static -DANDROID_STL_FORCE_FEATURES=OFF -DBUILD_ANDROID_SERVICE=ON -DANDROID_SOURCE_TREE=~/Projects/AndroidSource/ServiceStub/ $@ ../..
set(engine OpenCVEngine) set(engine OpenCVEngine)
set(JNI_LIB_NAME ${engine} ${engine}_jni) 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) add_android_project(opencv_engine "${CMAKE_CURRENT_SOURCE_DIR}" SDK_TARGET 8 ${ANDROID_SDK_TARGET} IGNORE_JAVA ON)
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}/system/lib") 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
add_definitions(-DPLATFORM_ANDROID -D__SUPPORT_ARMEABI_V7A_FEATURES -D__SUPPORT_TEGRA3 -D__SUPPORT_MIPS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti -fno-exceptions")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-allow-shlib-undefined") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-allow-shlib-undefined")
file(GLOB engine_files "jni/BinderComponent/*.cpp" "jni/BinderComponent/*.h" "jni/include/*.h") file(GLOB engine_files "jni/BinderComponent/*.cpp" "jni/BinderComponent/*.h" "jni/include/*.h")
include_directories(jni/BinderComponent jni/include) include_directories(jni/BinderComponent jni/include)
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
#include <jni.h> #include <jni.h>
#include <string> #include <string>
JNIEXPORT jint JNICALL Java_org_opencv_engine_HardwareDetector_GetCpuID(JNIEnv* env, jclass) JNIEXPORT jint JNICALL Java_org_opencv_engine_HardwareDetector_GetCpuID(JNIEnv* , jclass)
{ {
return GetCpuID(); return GetCpuID();
} }
...@@ -14,12 +14,12 @@ JNIEXPORT jstring JNICALL Java_org_opencv_engine_HardwareDetector_GetPlatformNam ...@@ -14,12 +14,12 @@ JNIEXPORT jstring JNICALL Java_org_opencv_engine_HardwareDetector_GetPlatformNam
return env->NewStringUTF(hardware_name.c_str()); return env->NewStringUTF(hardware_name.c_str());
} }
JNIEXPORT jint JNICALL Java_org_opencv_engine_HardwareDetector_GetProcessorCount(JNIEnv* env, jclass) JNIEXPORT jint JNICALL Java_org_opencv_engine_HardwareDetector_GetProcessorCount(JNIEnv* , jclass)
{ {
return GetProcessorCount(); return GetProcessorCount();
} }
JNIEXPORT jint JNICALL Java_org_opencv_engine_HardwareDetector_DetectKnownPlatforms(JNIEnv* env, jclass) JNIEXPORT jint JNICALL Java_org_opencv_engine_HardwareDetector_DetectKnownPlatforms(JNIEnv* , jclass)
{ {
return DetectKnownPlatforms(); return DetectKnownPlatforms();
} }
\ No newline at end of file
...@@ -30,7 +30,7 @@ JNIEXPORT jobject JNICALL Java_org_opencv_engine_BinderConnector_Connect(JNIEnv* ...@@ -30,7 +30,7 @@ JNIEXPORT jobject JNICALL Java_org_opencv_engine_BinderConnector_Connect(JNIEnv*
return javaObjectForIBinder(env, OpenCVEngineBinder); return javaObjectForIBinder(env, OpenCVEngineBinder);
} }
JNIEXPORT jboolean JNICALL Java_org_opencv_engine_BinderConnector_Init(JNIEnv* env, jobject thiz, jobject market) JNIEXPORT jboolean JNICALL Java_org_opencv_engine_BinderConnector_Init(JNIEnv* env, jobject , jobject market)
{ {
LOGD("Java_org_opencv_engine_BinderConnector_Init"); LOGD("Java_org_opencv_engine_BinderConnector_Init");
......
...@@ -363,7 +363,7 @@ InstallPath(install_path) ...@@ -363,7 +363,7 @@ InstallPath(install_path)
} }
else else
{ {
LOGE("Library loading error (%x, %x): \"%s\"", name_func, revision_func, error); LOGE("Library loading error (%p, %p): \"%s\"", name_func, revision_func, error);
} }
} }
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment