3 The script builds OpenCV.framework for OSX.
6 from __future__ import print_function
7 import os, os.path, sys, argparse, traceback, multiprocessing
10 sys.path.insert(0, os.path.abspath(os.path.abspath(os.path.dirname(__file__))+'/../ios'))
11 from build_framework import Builder
13 class OSXBuilder(Builder):
15 def getToolchain(self, arch, target):
18 def getBuildCommand(self, archs, target):
21 "MACOSX_DEPLOYMENT_TARGET=10.9",
22 "ARCHS=%s" % archs[0],
23 "-sdk", target.lower(),
24 "-configuration", "Release",
25 "-parallelizeTargets",
26 "-jobs", str(multiprocessing.cpu_count())
30 def getInfoPlist(self, builddirs):
31 return os.path.join(builddirs[0], "osx", "Info.plist")
34 if __name__ == "__main__":
35 folder = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), "../.."))
36 parser = argparse.ArgumentParser(description='The script builds OpenCV.framework for OSX.')
37 parser.add_argument('out', metavar='OUTDIR', help='folder to put built framework')
38 parser.add_argument('--opencv', metavar='DIR', default=folder, help='folder with opencv repository (default is "../.." relative to script location)')
39 parser.add_argument('--contrib', metavar='DIR', default=None, help='folder with opencv_contrib repository (default is "None" - build only main framework)')
40 parser.add_argument('--without', metavar='MODULE', default=[], action='append', help='OpenCV modules to exclude from the framework')
41 args = parser.parse_args()
43 b = OSXBuilder(args.opencv, args.contrib, False, False, args.without,
45 (["x86_64"], "MacOSX")