|
|
|
@ -27,10 +27,10 @@ However, OpenCV.framework directory is erased and recreated on each run. |
|
|
|
|
|
|
|
|
|
import glob, re, os, os.path, shutil, string, sys |
|
|
|
|
|
|
|
|
|
def build_opencv(srcroot, buildroot, target): |
|
|
|
|
def build_opencv(srcroot, buildroot, target, arch): |
|
|
|
|
"builds OpenCV for device or simulator" |
|
|
|
|
|
|
|
|
|
builddir = os.path.join(buildroot, target) |
|
|
|
|
builddir = os.path.join(buildroot, target + '-' + arch) |
|
|
|
|
if not os.path.isdir(builddir): |
|
|
|
|
os.makedirs(builddir) |
|
|
|
|
currdir = os.getcwd() |
|
|
|
@ -52,8 +52,8 @@ def build_opencv(srcroot, buildroot, target): |
|
|
|
|
if os.path.isfile(wlib): |
|
|
|
|
os.remove(wlib) |
|
|
|
|
|
|
|
|
|
os.system("xcodebuild -parallelizeTargets -jobs 8 -sdk %s -configuration Release -target ALL_BUILD" % target.lower()) |
|
|
|
|
os.system("xcodebuild -sdk %s -configuration Release -target install install" % target.lower()) |
|
|
|
|
os.system("xcodebuild -parallelizeTargets ARCHS=%s -jobs 8 -sdk %s -configuration Release -target ALL_BUILD" % (arch, target.lower())) |
|
|
|
|
os.system("xcodebuild ARCHS=%s -sdk %s -configuration Release -target install install" % (arch, target.lower())) |
|
|
|
|
os.chdir(currdir) |
|
|
|
|
|
|
|
|
|
def put_framework_together(srcroot, dstroot): |
|
|
|
@ -112,8 +112,10 @@ def put_framework_together(srcroot, dstroot): |
|
|
|
|
def build_framework(srcroot, dstroot): |
|
|
|
|
"main function to do all the work" |
|
|
|
|
|
|
|
|
|
for target in ["iPhoneOS", "iPhoneSimulator"]: |
|
|
|
|
build_opencv(srcroot, os.path.join(dstroot, "build"), target) |
|
|
|
|
targets = ["iPhoneOS", "iPhoneOS", "iPhoneSimulator"] |
|
|
|
|
archs = ["armv7", "armv7s", "i386"] |
|
|
|
|
for i in range(len(targets)): |
|
|
|
|
build_opencv(srcroot, os.path.join(dstroot, "build"), targets[i], archs[i]) |
|
|
|
|
|
|
|
|
|
put_framework_together(srcroot, dstroot) |
|
|
|
|
|
|
|
|
@ -123,4 +125,4 @@ if __name__ == "__main__": |
|
|
|
|
print "Usage:\n\t./build_framework.py <outputdir>\n\n" |
|
|
|
|
sys.exit(0) |
|
|
|
|
|
|
|
|
|
build_framework(os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), "..")), os.path.abspath(sys.argv[1])) |
|
|
|
|
build_framework(os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), "..")), os.path.abspath(sys.argv[1])) |