Build script for all native cameras added.
authorAlexander Smorkalov <alexander.smorkalov@itseez.com>
Fri, 7 Sep 2012 13:22:11 +0000 (17:22 +0400)
committerAlexander Smorkalov <alexander.smorkalov@itseez.com>
Fri, 7 Sep 2012 13:22:48 +0000 (17:22 +0400)
android/scripts/camera_build.conf [new file with mode: 0644]
android/scripts/cmake_android_all_cameras.py [new file with mode: 0755]

diff --git a/android/scripts/camera_build.conf b/android/scripts/camera_build.conf
new file mode 100644 (file)
index 0000000..26fbf81
--- /dev/null
@@ -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
\ No newline at end of file
diff --git a/android/scripts/cmake_android_all_cameras.py b/android/scripts/cmake_android_all_cameras.py
new file mode 100755 (executable)
index 0000000..5d035c5
--- /dev/null
@@ -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()
+