android -> plarforms/android
This commit is contained in:
228
platforms/android/scripts/ABI_compat_generator.py
Executable file
228
platforms/android/scripts/ABI_compat_generator.py
Executable file
@@ -0,0 +1,228 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
from optparse import OptionParser
|
||||
from shutil import rmtree
|
||||
import os
|
||||
|
||||
|
||||
architecture = 'armeabi'
|
||||
excludedHeaders = set(['hdf5.h', 'cap_ios.h',
|
||||
'eigen.hpp', 'cxeigen.hpp' #TOREMOVE
|
||||
])
|
||||
systemIncludes = ['sources/cxx-stl/gnu-libstdc++/4.6/include', \
|
||||
'/opt/android-ndk-r8c/platforms/android-8/arch-arm', # TODO: check if this one could be passed as command line arg
|
||||
'sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include']
|
||||
targetLibs = ['libopencv_java.so']
|
||||
preamble = ['Eigen/Core']
|
||||
# TODO: get gcc_options automatically
|
||||
gcc_options = ['-fexceptions', '-frtti', '-Wno-psabi', '--sysroot=/opt/android-ndk-r8c/platforms/android-8/arch-arm', '-fpic', '-D__ARM_ARCH_5__', '-D__ARM_ARCH_5T__', '-D__ARM_ARCH_5E__', '-D__ARM_ARCH_5TE__', '-fsigned-char', '-march=armv5te', '-mtune=xscale', '-msoft-float', '-fdata-sections', '-ffunction-sections', '-Wa,--noexecstack ', '-W', '-Wall', '-Werror=return-type', '-Werror=address', '-Werror=sequence-point', '-Wformat', '-Werror=format-security', '-Wmissing-declarations', '-Wundef', '-Winit-self', '-Wpointer-arith', '-Wshadow', '-Wsign-promo', '-Wno-narrowing', '-fdiagnostics-show-option', '-fomit-frame-pointer', '-mthumb', '-fomit-frame-pointer', '-O3', '-DNDEBUG ', '-DNDEBUG']
|
||||
excludedOptionsPrefix = '-W'
|
||||
|
||||
|
||||
|
||||
def GetHeaderFiles(root):
|
||||
headers = []
|
||||
for path in os.listdir(root):
|
||||
if not os.path.isdir(os.path.join(root, path)) \
|
||||
and os.path.splitext(path)[1] in ['.h', '.hpp'] \
|
||||
and not path in excludedHeaders:
|
||||
headers.append(os.path.join(root, path))
|
||||
return sorted(headers)
|
||||
|
||||
|
||||
|
||||
def GetClasses(root, prefix):
|
||||
classes = []
|
||||
if ('' != prefix):
|
||||
prefix = prefix + '.'
|
||||
for path in os.listdir(root):
|
||||
currentPath = os.path.join(root, path)
|
||||
if (os.path.isdir(currentPath)):
|
||||
classes += GetClasses(currentPath, prefix + path)
|
||||
else:
|
||||
name = str.split(path, '.')[0]
|
||||
ext = str.split(path, '.')[1]
|
||||
if (ext == 'class'):
|
||||
classes.append(prefix + name)
|
||||
return classes
|
||||
|
||||
|
||||
|
||||
def GetJavaHHeaders():
|
||||
print('\nGenerating JNI headers for Java API ...')
|
||||
|
||||
javahHeaders = os.path.join(managerDir, 'javah_generated_headers')
|
||||
if os.path.exists(javahHeaders):
|
||||
rmtree(javahHeaders)
|
||||
os.makedirs(os.path.join(os.getcwd(), javahHeaders))
|
||||
|
||||
AndroidJavaDeps = os.path.join(SDK_path, 'platforms/android-11/android.jar')
|
||||
|
||||
classPath = os.path.join(managerDir, 'sdk/java/bin/classes')
|
||||
if not os.path.exists(classPath):
|
||||
print('Error: no Java classes found in \'%s\'' % classPath)
|
||||
quit()
|
||||
|
||||
allJavaClasses = GetClasses(classPath, '')
|
||||
if not allJavaClasses:
|
||||
print('Error: no Java classes found')
|
||||
quit()
|
||||
|
||||
for currentClass in allJavaClasses:
|
||||
os.system('javah -d %s -classpath %s:%s %s' % (javahHeaders, classPath, \
|
||||
AndroidJavaDeps, currentClass))
|
||||
|
||||
print('\nBuilding JNI headers list ...')
|
||||
jniHeaders = GetHeaderFiles(javahHeaders)
|
||||
|
||||
return jniHeaders
|
||||
|
||||
|
||||
|
||||
def GetImmediateSubdirs(dir):
|
||||
return [name for name in os.listdir(dir)
|
||||
if os.path.isdir(os.path.join(dir, name))]
|
||||
|
||||
|
||||
|
||||
def GetOpenCVModules():
|
||||
makefile = open(os.path.join(managerDir, 'sdk/native/jni/OpenCV.mk'), 'r')
|
||||
makefileStr = makefile.read()
|
||||
left = makefileStr.find('OPENCV_MODULES:=') + len('OPENCV_MODULES:=')
|
||||
right = makefileStr[left:].find('\n')
|
||||
modules = makefileStr[left:left+right].split()
|
||||
modules = filter(lambda x: x != 'ts' and x != 'androidcamera', modules)
|
||||
return modules
|
||||
|
||||
|
||||
|
||||
def FindHeaders():
|
||||
headers = []
|
||||
|
||||
print('\nBuilding Native OpenCV header list ...')
|
||||
|
||||
cppHeadersFolder = os.path.join(managerDir, 'sdk/native/jni/include/opencv2')
|
||||
|
||||
modulesFolders = GetImmediateSubdirs(cppHeadersFolder)
|
||||
modules = GetOpenCVModules()
|
||||
|
||||
cppHeaders = []
|
||||
for m in modules:
|
||||
for f in modulesFolders:
|
||||
moduleHeaders = []
|
||||
if f == m:
|
||||
moduleHeaders += GetHeaderFiles(os.path.join(cppHeadersFolder, f))
|
||||
if m == 'flann':
|
||||
flann = os.path.join(cppHeadersFolder, f, 'flann.hpp')
|
||||
moduleHeaders.remove(flann)
|
||||
moduleHeaders.insert(0, flann)
|
||||
cppHeaders += moduleHeaders
|
||||
|
||||
|
||||
cppHeaders += GetHeaderFiles(cppHeadersFolder)
|
||||
headers += cppHeaders
|
||||
|
||||
cHeaders = GetHeaderFiles(os.path.join(managerDir, \
|
||||
'sdk/native/jni/include/opencv'))
|
||||
headers += cHeaders
|
||||
|
||||
headers += GetJavaHHeaders()
|
||||
|
||||
return headers
|
||||
|
||||
|
||||
|
||||
def FindLibraries():
|
||||
libraries = []
|
||||
for lib in targetLibs:
|
||||
libraries.append(os.path.join(managerDir, 'sdk/native/libs', architecture, lib))
|
||||
return libraries
|
||||
|
||||
|
||||
|
||||
def FindIncludes():
|
||||
includes = [os.path.join(managerDir, 'sdk', 'native', 'jni', 'include'),
|
||||
os.path.join(managerDir, 'sdk', 'native', 'jni', 'include', 'opencv'),
|
||||
os.path.join(managerDir, 'sdk', 'native', 'jni', 'include', 'opencv2')]
|
||||
|
||||
for inc in systemIncludes:
|
||||
includes.append(os.path.join(NDK_path, inc))
|
||||
|
||||
return includes
|
||||
|
||||
|
||||
|
||||
def FilterGCCOptions():
|
||||
gcc = filter(lambda x: not x.startswith(excludedOptionsPrefix), gcc_options)
|
||||
return sorted(gcc)
|
||||
|
||||
|
||||
|
||||
def WriteXml(version, headers, includes, libraries):
|
||||
xmlName = version + '.xml'
|
||||
|
||||
print '\noutput file: ' + xmlName
|
||||
try:
|
||||
xml = open(xmlName, 'w')
|
||||
except:
|
||||
print 'Error: Cannot open output file "%s" for writing' % xmlName
|
||||
quit()
|
||||
|
||||
xml.write('<descriptor>')
|
||||
|
||||
xml.write('\n\n<version>')
|
||||
xml.write('\n\t%s' % version)
|
||||
xml.write('\n</version>')
|
||||
|
||||
xml.write('\n\n<headers>')
|
||||
xml.write('\n\t%s' % '\n\t'.join(headers))
|
||||
xml.write('\n</headers>')
|
||||
|
||||
xml.write('\n\n<include_paths>')
|
||||
xml.write('\n\t%s' % '\n\t'.join(includes))
|
||||
xml.write('\n</include_paths>')
|
||||
|
||||
# TODO: uncomment when Eigen problem is solved
|
||||
# xml.write('\n\n<include_preamble>')
|
||||
# xml.write('\n\t%s' % '\n\t'.join(preamble))
|
||||
# xml.write('\n</include_preamble>')
|
||||
|
||||
xml.write('\n\n<libs>')
|
||||
xml.write('\n\t%s' % '\n\t'.join(libraries))
|
||||
xml.write('\n</libs>')
|
||||
|
||||
xml.write('\n\n<gcc_options>')
|
||||
xml.write('\n\t%s' % '\n\t'.join(gcc_options))
|
||||
xml.write('\n</gcc_options>')
|
||||
|
||||
xml.write('\n\n</descriptor>')
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
usage = '%prog <OpenCV_Manager install directory> <OpenCV_Manager version>'
|
||||
parser = OptionParser(usage = usage)
|
||||
|
||||
args = parser.parse_args()
|
||||
if 2 != len(args):
|
||||
parser.print_help()
|
||||
quit()
|
||||
|
||||
managerDir = args[1][0]
|
||||
version = args[1][1]
|
||||
|
||||
NDK_path = '/opt/android-ndk-r8c'
|
||||
print '\nUsing Android NDK from "%s"' % NDK_path
|
||||
|
||||
SDK_path = '~/NVPACK/android-sdk-linux'
|
||||
print '\nUsing Android SDK from "%s"' % SDK_path
|
||||
|
||||
headers = FindHeaders()
|
||||
|
||||
includes = FindIncludes()
|
||||
|
||||
libraries = FindLibraries()
|
||||
|
||||
gcc_options = FilterGCCOptions()
|
||||
|
||||
WriteXml(version, headers, includes, libraries)
|
90
platforms/android/scripts/build.cmd
Normal file
90
platforms/android/scripts/build.cmd
Normal file
@@ -0,0 +1,90 @@
|
||||
@ECHO OFF
|
||||
|
||||
:: enable command extensions
|
||||
VERIFY BADVALUE 2>NUL
|
||||
SETLOCAL ENABLEEXTENSIONS || (ECHO Unable to enable command extensions. & EXIT \B)
|
||||
|
||||
:: build environment
|
||||
SET SOURCE_DIR=%cd%
|
||||
IF EXIST .\android.toolchain.cmake (SET BUILD_OPENCV=1) ELSE (SET BUILD_OPENCV=0)
|
||||
IF EXIST .\jni\nul (SET BUILD_JAVA_PART=1) ELSE (SET BUILD_JAVA_PART=0)
|
||||
|
||||
:: load configuration
|
||||
PUSHD %~dp0
|
||||
SET SCRIPTS_DIR=%cd%
|
||||
IF EXIST .\wincfg.cmd CALL .\wincfg.cmd
|
||||
POPD
|
||||
|
||||
:: inherit old names
|
||||
IF NOT DEFINED CMAKE SET CMAKE=%CMAKE_EXE%
|
||||
IF NOT DEFINED MAKE SET MAKE=%MAKE_EXE%
|
||||
|
||||
:: defaults
|
||||
IF NOT DEFINED BUILD_DIR SET BUILD_DIR=build
|
||||
IF NOT DEFINED ANDROID_ABI SET ANDROID_ABI=armeabi-v7a
|
||||
SET OPENCV_BUILD_DIR=%SCRIPTS_DIR%\..\%BUILD_DIR%
|
||||
|
||||
:: check that all required variables defined
|
||||
PUSHD .
|
||||
IF NOT DEFINED ANDROID_NDK (ECHO. & ECHO You should set an environment variable ANDROID_NDK to the full path to your copy of Android NDK & GOTO end)
|
||||
(CD "%ANDROID_NDK%") || (ECHO. & ECHO Directory "%ANDROID_NDK%" specified by ANDROID_NDK variable does not exist & GOTO end)
|
||||
|
||||
IF NOT EXIST "%CMAKE%" (ECHO. & ECHO You should set an environment variable CMAKE to the full path to cmake executable & GOTO end)
|
||||
IF NOT EXIST "%MAKE%" (ECHO. & ECHO You should set an environment variable MAKE to the full path to native port of make executable & GOTO end)
|
||||
|
||||
IF NOT %BUILD_JAVA_PART%==1 GOTO required_variables_checked
|
||||
|
||||
IF NOT DEFINED ANDROID_SDK (ECHO. & ECHO You should set an environment variable ANDROID_SDK to the full path to your copy of Android SDK & GOTO end)
|
||||
(CD "%ANDROID_SDK%" 2>NUL) || (ECHO. & ECHO Directory "%ANDROID_SDK%" specified by ANDROID_SDK variable does not exist & GOTO end)
|
||||
|
||||
IF NOT DEFINED ANT_DIR (ECHO. & ECHO You should set an environment variable ANT_DIR to the full path to Apache Ant root & GOTO end)
|
||||
(CD "%ANT_DIR%" 2>NUL) || (ECHO. & ECHO Directory "%ANT_DIR%" specified by ANT_DIR variable does not exist & GOTO end)
|
||||
|
||||
IF NOT DEFINED JAVA_HOME (ECHO. & ECHO You should set an environment variable JAVA_HOME to the full path to JDK & GOTO end)
|
||||
(CD "%JAVA_HOME%" 2>NUL) || (ECHO. & ECHO Directory "%JAVA_HOME%" specified by JAVA_HOME variable does not exist & GOTO end)
|
||||
|
||||
:required_variables_checked
|
||||
POPD
|
||||
|
||||
:: check for ninja
|
||||
echo "%MAKE%"|findstr /i ninja >nul:
|
||||
IF %errorlevel%==1 (SET BUILD_WITH_NINJA=0) ELSE (SET BUILD_WITH_NINJA=1)
|
||||
IF %BUILD_WITH_NINJA%==1 (SET CMAKE_GENERATOR=Ninja) ELSE (SET CMAKE_GENERATOR=MinGW Makefiles)
|
||||
|
||||
:: create build dir
|
||||
IF DEFINED REBUILD rmdir /S /Q "%BUILD_DIR%" 2>NUL
|
||||
MKDIR "%BUILD_DIR%" 2>NUL
|
||||
PUSHD "%BUILD_DIR%" || (ECHO. & ECHO Directory "%BUILD_DIR%" is not found & GOTO end)
|
||||
|
||||
:: run cmake
|
||||
ECHO. & ECHO Runnning cmake...
|
||||
ECHO ANDROID_ABI=%ANDROID_ABI%
|
||||
ECHO.
|
||||
IF NOT %BUILD_OPENCV%==1 GOTO other-cmake
|
||||
:opencv-cmake
|
||||
("%CMAKE%" -G"%CMAKE_GENERATOR%" -DANDROID_ABI="%ANDROID_ABI%" -DCMAKE_TOOLCHAIN_FILE="%SOURCE_DIR%"\android.toolchain.cmake -DCMAKE_MAKE_PROGRAM="%MAKE%" %* "%SOURCE_DIR%\..") && GOTO cmakefin
|
||||
ECHO. & ECHO cmake failed & GOTO end
|
||||
:other-cmake
|
||||
("%CMAKE%" -G"%CMAKE_GENERATOR%" -DANDROID_ABI="%ANDROID_ABI%" -DOpenCV_DIR="%OPENCV_BUILD_DIR%" -DCMAKE_TOOLCHAIN_FILE="%OPENCV_BUILD_DIR%\..\android.toolchain.cmake" -DCMAKE_MAKE_PROGRAM="%MAKE%" %* "%SOURCE_DIR%") && GOTO cmakefin
|
||||
ECHO. & ECHO cmake failed & GOTO end
|
||||
:cmakefin
|
||||
|
||||
:: run make
|
||||
ECHO. & ECHO Building native libs...
|
||||
IF %BUILD_WITH_NINJA%==0 ("%MAKE%" -j %NUMBER_OF_PROCESSORS% VERBOSE=%VERBOSE%) || (ECHO. & ECHO make failed & GOTO end)
|
||||
IF %BUILD_WITH_NINJA%==1 ("%MAKE%") || (ECHO. & ECHO ninja failed & GOTO end)
|
||||
|
||||
IF NOT %BUILD_JAVA_PART%==1 GOTO end
|
||||
POPD && PUSHD %SOURCE_DIR%
|
||||
|
||||
:: configure java part
|
||||
ECHO. & ECHO Updating Android project...
|
||||
(CALL "%ANDROID_SDK%\tools\android" update project --name %PROJECT_NAME% --path .) || (ECHO. & ECHO failed to update android project & GOTO end)
|
||||
|
||||
:: compile java part
|
||||
ECHO. & ECHO Compiling Android project...
|
||||
(CALL "%ANT_DIR%\bin\ant" debug) || (ECHO. & ECHO failed to compile android project & GOTO end)
|
||||
|
||||
:end
|
||||
POPD
|
||||
ENDLOCAL
|
23
platforms/android/scripts/camera_build.conf
Normal file
23
platforms/android/scripts/camera_build.conf
Normal file
@@ -0,0 +1,23 @@
|
||||
# make target; arch; API level; Android Source Code Root
|
||||
native_camera_r2.2.0; armeabi; 8; /home/alexander/Projects/AndroidSource/2.2.2
|
||||
native_camera_r2.2.0; armeabi-v7a; 8; /home/alexander/Projects/AndroidSource/2.2.2
|
||||
native_camera_r2.3.3; armeabi; 9; /home/alexander/Projects/AndroidSource/2.3.3
|
||||
native_camera_r2.3.3; armeabi-v7a; 9; /home/alexander/Projects/AndroidSource/2.3.3
|
||||
native_camera_r2.3.3; x86; 9; /home/alexander/Projects/AndroidSource/2.3.3
|
||||
native_camera_r3.0.1; armeabi; 9; /home/alexander/Projects/AndroidSource/3.0.1
|
||||
native_camera_r3.0.1; armeabi-v7a; 9; /home/alexander/Projects/AndroidSource/3.0.1
|
||||
native_camera_r3.0.1; x86; 9; /home/alexander/Projects/AndroidSource/3.0.1
|
||||
native_camera_r4.0.3; armeabi; 14; /home/alexander/Projects/AndroidSource/4.0.3
|
||||
native_camera_r4.0.3; armeabi-v7a; 14; /home/alexander/Projects/AndroidSource/4.0.3
|
||||
native_camera_r4.0.3; x86; 14; /home/alexander/Projects/AndroidSource/4.0.3
|
||||
native_camera_r4.0.3; mips; 14; /home/alexander/Projects/AndroidSource/4.0.3_mips
|
||||
native_camera_r4.0.0; armeabi; 14; /home/alexander/Projects/AndroidSource/4.0.0
|
||||
native_camera_r4.0.0; armeabi-v7a; 14; /home/alexander/Projects/AndroidSource/4.0.0
|
||||
native_camera_r4.1.1; armeabi; 14; /home/alexander/Projects/AndroidSource/4.1.1
|
||||
native_camera_r4.1.1; armeabi-v7a; 14; /home/alexander/Projects/AndroidSource/4.1.1
|
||||
native_camera_r4.1.1; x86; 14; /home/alexander/Projects/AndroidSource/4.1.1
|
||||
native_camera_r4.1.1; mips; 14; /home/alexander/Projects/AndroidSource/4.1.1_mips
|
||||
native_camera_r4.2.0; armeabi-v7a; 14; /home/alexander/Projects/AndroidSource/4.2
|
||||
native_camera_r4.2.0; armeabi; 14; /home/alexander/Projects/AndroidSource/4.2
|
||||
native_camera_r4.2.0; x86; 14; /home/alexander/Projects/AndroidSource/4.2
|
||||
native_camera_r4.2.0; mips; 14; /home/alexander/Projects/AndroidSource/4.2
|
5
platforms/android/scripts/cmake_android.cmd
Normal file
5
platforms/android/scripts/cmake_android.cmd
Normal file
@@ -0,0 +1,5 @@
|
||||
@ECHO OFF
|
||||
|
||||
PUSHD %~dp0..
|
||||
CALL .\scripts\build.cmd %* -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON
|
||||
POPD
|
8
platforms/android/scripts/cmake_android.sh
Executable file
8
platforms/android/scripts/cmake_android.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
cd `dirname $0`/..
|
||||
|
||||
mkdir -p build
|
||||
cd build
|
||||
|
||||
cmake -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON -DCMAKE_TOOLCHAIN_FILE=../android.toolchain.cmake $@ ../../..
|
||||
|
69
platforms/android/scripts/cmake_android_all_cameras.py
Executable file
69
platforms/android/scripts/cmake_android_all_cameras.py
Executable file
@@ -0,0 +1,69 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import os
|
||||
import sys
|
||||
import shutil
|
||||
|
||||
ScriptHome = os.path.split(sys.argv[0])[0]
|
||||
ConfFile = open(os.path.join(ScriptHome, "camera_build.conf"), "rt")
|
||||
HomeDir = os.getcwd()
|
||||
for s in ConfFile.readlines():
|
||||
s = s[0:s.find("#")]
|
||||
if (not s):
|
||||
continue
|
||||
keys = s.split(";")
|
||||
if (len(keys) < 4):
|
||||
print("Error: invalid config line: \"%s\"" % s)
|
||||
continue
|
||||
MakeTarget = str.strip(keys[0])
|
||||
Arch = str.strip(keys[1])
|
||||
NativeApiLevel = str.strip(keys[2])
|
||||
AndroidTreeRoot = str.strip(keys[3])
|
||||
AndroidTreeRoot = str.strip(AndroidTreeRoot, "\n")
|
||||
print("Building %s for %s" % (MakeTarget, Arch))
|
||||
BuildDir = os.path.join(HomeDir, MakeTarget + "_" + Arch)
|
||||
|
||||
if (os.path.exists(BuildDir)):
|
||||
shutil.rmtree(BuildDir)
|
||||
|
||||
try:
|
||||
os.mkdir(BuildDir)
|
||||
except:
|
||||
print("Error: cannot create direcotry \"%s\"" % BuildDir)
|
||||
continue
|
||||
|
||||
shutil.rmtree(os.path.join(AndroidTreeRoot, "out", "target", "product", "generic", "system"), ignore_errors=True)
|
||||
|
||||
LinkerLibs = os.path.join(AndroidTreeRoot, "bin_arm", "system")
|
||||
if (Arch == "x86"):
|
||||
LinkerLibs = os.path.join(AndroidTreeRoot, "bin_x86", "system")
|
||||
elif (Arch == "mips"):
|
||||
LinkerLibs = os.path.join(AndroidTreeRoot, "bin_mips", "system")
|
||||
|
||||
if (not os.path.exists(LinkerLibs)):
|
||||
print("Error: Paltform libs for linker in path \"%s\" not found" % LinkerLibs)
|
||||
print("Building %s for %s\t[\033[91mFAILED\033[0m]" % (MakeTarget, Arch))
|
||||
continue
|
||||
|
||||
shutil.copytree(LinkerLibs, os.path.join(AndroidTreeRoot, "out", "target", "product", "generic", "system"))
|
||||
|
||||
os.chdir(BuildDir)
|
||||
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_STL=stlport_static ../../../ > \"%s\" 2>&1" % (AndroidTreeRoot, NativeApiLevel, Arch, BuildLog)
|
||||
MakeCmdLine = "make %s >> \"%s\" 2>&1" % (MakeTarget, BuildLog);
|
||||
#print(CmakeCmdLine)
|
||||
os.system(CmakeCmdLine)
|
||||
#print(MakeCmdLine)
|
||||
os.system(MakeCmdLine)
|
||||
os.chdir(HomeDir)
|
||||
CameraLib = os.path.join(BuildDir, "lib", Arch, "lib" + MakeTarget + ".so")
|
||||
if (os.path.exists(CameraLib)):
|
||||
try:
|
||||
shutil.copyfile(CameraLib, os.path.join("..", "..", "3rdparty", "lib", Arch, "lib" + MakeTarget + ".so"))
|
||||
print("Building %s for %s\t[\033[92mOK\033[0m]" % (MakeTarget, Arch));
|
||||
except:
|
||||
print("Building %s for %s\t[\033[91mFAILED\033[0m]" % (MakeTarget, Arch));
|
||||
else:
|
||||
print("Building %s for %s\t[\033[91mFAILED\033[0m]" % (MakeTarget, Arch));
|
||||
|
||||
ConfFile.close()
|
8
platforms/android/scripts/cmake_android_armeabi.sh
Executable file
8
platforms/android/scripts/cmake_android_armeabi.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
cd `dirname $0`/..
|
||||
|
||||
mkdir -p build_armeabi
|
||||
cd build_armeabi
|
||||
|
||||
cmake -DANDROID_ABI=armeabi -DCMAKE_TOOLCHAIN_FILE=../android.toolchain.cmake $@ ../../..
|
||||
|
8
platforms/android/scripts/cmake_android_debug.sh
Executable file
8
platforms/android/scripts/cmake_android_debug.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
cd `dirname $0`/..
|
||||
|
||||
mkdir -p build_debug
|
||||
cd build_debug
|
||||
|
||||
cmake -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=../android.toolchain.cmake $@ ../../..
|
||||
|
8
platforms/android/scripts/cmake_android_mips.sh
Executable file
8
platforms/android/scripts/cmake_android_mips.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
cd `dirname $0`/..
|
||||
|
||||
mkdir -p build_mips
|
||||
cd build_mips
|
||||
|
||||
cmake -DANDROID_ABI=mips -DCMAKE_TOOLCHAIN_FILE=../android.toolchain.cmake $@ ../../..
|
||||
|
8
platforms/android/scripts/cmake_android_neon.sh
Executable file
8
platforms/android/scripts/cmake_android_neon.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
cd `dirname $0`/..
|
||||
|
||||
mkdir -p build_neon
|
||||
cd build_neon
|
||||
|
||||
cmake -DANDROID_ABI="armeabi-v7a with NEON" -DCMAKE_TOOLCHAIN_FILE=../android.toolchain.cmake $@ ../../..
|
||||
|
7
platforms/android/scripts/cmake_android_service.sh
Executable file
7
platforms/android/scripts/cmake_android_service.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
cd `dirname $0`/..
|
||||
|
||||
mkdir -p build_service
|
||||
cd build_service
|
||||
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE=../android.toolchain.cmake -DANDROID_TOOLCHAIN_NAME="arm-linux-androideabi-4.4.3" -DANDROID_STL=stlport_static -DANDROID_STL_FORCE_FEATURES=OFF -DBUILD_ANDROID_SERVICE=ON -DANDROID_SOURCE_TREE=~/Projects/AndroidSource/ServiceStub/ $@ ../../..
|
8
platforms/android/scripts/cmake_android_service_x86.sh
Executable file
8
platforms/android/scripts/cmake_android_service_x86.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
cd `dirname $0`/..
|
||||
|
||||
mkdir -p build_service_x86
|
||||
cd build_service_x86
|
||||
|
||||
cmake -DANDROID_ABI=x86 -DCMAKE_TOOLCHAIN_FILE=../android.toolchain.cmake -DANDROID_TOOLCHAIN_NAME="x86-4.4.3" -DANDROID_STL=stlport_static -DANDROID_STL_FORCE_FEATURES=OFF -DBUILD_ANDROID_SERVICE=ON -DANDROID_SOURCE_TREE=~/Projects/AndroidSource/ServiceStub/ $@ ../../..
|
||||
|
9
platforms/android/scripts/cmake_android_x86.sh
Executable file
9
platforms/android/scripts/cmake_android_x86.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
cd `dirname $0`/..
|
||||
|
||||
mkdir -p build_x86
|
||||
cd build_x86
|
||||
|
||||
cmake -DANDROID_ABI=x86 -DCMAKE_TOOLCHAIN_FILE=../android.toolchain.cmake $@ ../../..
|
||||
|
30
platforms/android/scripts/wincfg.cmd.tmpl
Normal file
30
platforms/android/scripts/wincfg.cmd.tmpl
Normal file
@@ -0,0 +1,30 @@
|
||||
:: variables required for OpenCV build ::
|
||||
:: Note: all pathes should be specified without tailing slashes!
|
||||
SET ANDROID_NDK=C:\full\path\to\your\copy\of\android\NDK\android-ndk-r7b
|
||||
SET CMAKE_EXE=C:\full\path\to\cmake\utility\cmake.exe
|
||||
SET MAKE_EXE=%ANDROID_NDK%\prebuilt\windows\bin\make.exe
|
||||
|
||||
:: variables required for android-opencv build ::
|
||||
SET ANDROID_SDK=C:\full\path\to\your\copy\of\android\SDK\android-sdk-windows
|
||||
SET ANT_DIR=C:\full\path\to\ant\directory\apache-ant-1.8.2
|
||||
SET JAVA_HOME=C:\full\path\to\JDK\jdk1.6.0_25
|
||||
|
||||
:: configuration options ::
|
||||
:::: general ARM-V7 settings
|
||||
SET ANDROID_ABI=armeabi-v7a
|
||||
SET BUILD_DIR=build
|
||||
|
||||
:::: uncomment following lines to compile for old emulator or old device
|
||||
::SET ANDROID_ABI=armeabi
|
||||
::SET BUILD_DIR=build_armeabi
|
||||
|
||||
:::: uncomment following lines to compile for ARM-V7 with NEON support
|
||||
::SET ANDROID_ABI=armeabi-v7a with NEON
|
||||
::SET BUILD_DIR=build_neon
|
||||
|
||||
:::: uncomment following lines to compile for x86
|
||||
::SET ANDROID_ABI=x86
|
||||
::SET BUILD_DIR=build_x86
|
||||
|
||||
:::: other options
|
||||
::SET ANDROID_NATIVE_API_LEVEL=8 &:: android-3 is enough for native part of OpenCV but android-8 is required for Java API
|
Reference in New Issue
Block a user