opencv/platforms/scripts/cmake_android_all_cameras.py
Roman Donchenko bae85660da Merge remote-tracking branch 'origin/2.4'
Pull requests:
	#943 from jet47:cuda-5.5-support
	#944 from jet47:cmake-2.8.11-cuda-fix
	#912 from SpecLad:contributing
	#934 from SpecLad:parallel-for
	#931 from jet47:gpu-test-fixes
	#932 from bitwangyaoyao:2.4_fixBFM
	#918 from bitwangyaoyao:2.4_samples
	#924 from pengx17:2.4_arithm_fix
	#925 from pengx17:2.4_canny_tmp_fix
	#927 from bitwangyaoyao:2.4_perf
	#930 from pengx17:2.4_haar_ext
	#928 from apavlenko:bugfix_3027
	#920 from asmorkalov:android_move
	#910 from pengx17:2.4_oclgfft
	#913 from janm399:2.4
	#916 from bitwangyaoyao:2.4_fixPyrLK
	#919 from abidrahmank:2.4
	#923 from pengx17:2.4_macfix

Conflicts:
	modules/calib3d/src/stereobm.cpp
	modules/features2d/src/detectors.cpp
	modules/gpu/src/error.cpp
	modules/gpu/src/precomp.hpp
	modules/imgproc/src/distransform.cpp
	modules/imgproc/src/morph.cpp
	modules/ocl/include/opencv2/ocl/ocl.hpp
	modules/ocl/perf/perf_color.cpp
	modules/ocl/perf/perf_imgproc.cpp
	modules/ocl/perf/perf_match_template.cpp
	modules/ocl/perf/precomp.cpp
	modules/ocl/perf/precomp.hpp
	modules/ocl/src/arithm.cpp
	modules/ocl/src/canny.cpp
	modules/ocl/src/filtering.cpp
	modules/ocl/src/haar.cpp
	modules/ocl/src/hog.cpp
	modules/ocl/src/imgproc.cpp
	modules/ocl/src/opencl/haarobjectdetect.cl
	modules/ocl/src/pyrlk.cpp
	modules/video/src/bgfg_gaussmix2.cpp
	modules/video/src/lkpyramid.cpp
	platforms/linux/scripts/cmake_arm_gnueabi_hardfp.sh
	platforms/linux/scripts/cmake_arm_gnueabi_softfp.sh
	platforms/scripts/ABI_compat_generator.py
	samples/ocl/facedetect.cpp
2013-06-05 15:42:07 +04:00

81 lines
2.9 KiB
Python
Executable File

#!/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()
stub = ""
try:
stub = os.environ["ANDROID_STUB_ROOT"]
except:
None
if (stub == ""):
print("Warning: ANDROID_STUB_ROOT environment variable is not set")
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")
AndroidTreeRoot = os.path.expandvars(AndroidTreeRoot)
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/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()