Build script for all native cameras added.

(cherry picked from commit b16b50d61b)
pull/39/head
Alexander Smorkalov 12 years ago committed by Andrey Pavlenko
parent a12baf180a
commit 0efa9d4c06
  1. 16
      android/scripts/camera_build.conf
  2. 51
      android/scripts/cmake_android_all_cameras.py

@ -0,0 +1,16 @@
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.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

@ -0,0 +1,51 @@
#!/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():
keys = s.split(";")
if (len(keys) < 4):
print("Error: invalid config line: \"%s\"" % s)
continue
MakeTarget = keys[0]
Arch = keys[1]
NativeApiLevel = keys[2]
AndroidTreeRoot = 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)
if (Arch == "x86"):
shutil.copytree(os.path.join(AndroidTreeRoot, "bin_x86", "system"), os.path.join(AndroidTreeRoot, "out", "target", "product", "generic", "system"))
else:
shutil.copytree(os.path.join(AndroidTreeRoot, "bin_arm", "system"), 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_USE_STLPORT=ON ../../ > \"%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[OK]" % (MakeTarget, Arch));
except:
print("Building %s for %s\t[FAILED]" % (MakeTarget, Arch));
ConfFile.close()
Loading…
Cancel
Save