From 0efa9d4c063401c5e811b4992d912b50d48c6bf5 Mon Sep 17 00:00:00 2001 From: Alexander Smorkalov Date: Fri, 7 Sep 2012 17:22:11 +0400 Subject: [PATCH] Build script for all native cameras added. (cherry picked from commit b16b50d61b552a7f7eb3f86c2b28bcb9d933f0a4) --- android/scripts/camera_build.conf | 16 ++++++ android/scripts/cmake_android_all_cameras.py | 51 ++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 android/scripts/camera_build.conf create mode 100755 android/scripts/cmake_android_all_cameras.py diff --git a/android/scripts/camera_build.conf b/android/scripts/camera_build.conf new file mode 100644 index 0000000000..26fbf81f3e --- /dev/null +++ b/android/scripts/camera_build.conf @@ -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 index 0000000000..5d035c5828 --- /dev/null +++ b/android/scripts/cmake_android_all_cameras.py @@ -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() +