コード例 #1
0
        xcframework_path = "{}/{}.xcframework".format(args.out,
                                                      args.framework_name)
        print_header("Building {}".format(xcframework_path))

        # Remove the xcframework if it exists, otherwise the existing
        # file will cause the xcodebuild command to fail.
        with contextlib.suppress(FileNotFoundError):
            shutil.rmtree(xcframework_path)
            print(
                "Removed existing xcframework at {}".format(xcframework_path))

        xcframework_build_command = [
            "xcodebuild",
            "-create-xcframework",
            "-output",
            xcframework_path,
        ]
        for folder in build_folders:
            xcframework_build_command += [
                "-framework", "{}/{}.framework".format(folder,
                                                       args.framework_name)
            ]
        execute(xcframework_build_command, cwd=os.getcwd())

        print("")
        print_header("Finished building {}".format(xcframework_path))
    except Exception as e:
        print_error(e)
        traceback.print_exc(file=sys.stderr)
        sys.exit(1)
コード例 #2
0
ファイル: build_framework.py プロジェクト: GerHobbelt/opencv
    if args.iphonesimulator_archs:
        iphonesimulator_archs = args.iphonesimulator_archs.split(',')
    elif not args.build_only_specified_archs:
        # Supply defaults
        iphonesimulator_archs = ["x86_64"]
    print('Using iPhoneSimulator ARCHS=' + str(iphonesimulator_archs))

    # Prevent the build from happening if the same architecture is specified for multiple platforms.
    # When `lipo` is run to stitch the frameworks together into a fat framework, it'll fail, so it's
    # better to stop here while we're ahead.
    if iphoneos_archs and iphonesimulator_archs:
        duplicate_archs = set(iphoneos_archs).intersection(
            iphonesimulator_archs)
        if duplicate_archs:
            print_error(
                "Cannot have the same architecture for multiple platforms in a fat framework! Consider using build_xcframework.py in the apple platform folder instead. Duplicate archs are %s"
                % duplicate_archs)
            exit(1)

    if args.legacy_build:
        args.framework_name = "opencv2"
        if not "objc" in args.without:
            args.without.append("objc")

    targets = []
    if os.environ.get('BUILD_PRECOMMIT', None):
        if not iphoneos_archs:
            print_error("--iphoneos_archs must have at least one value")
            sys.exit(1)
        targets.append((iphoneos_archs, "iPhoneOS"))
    else:
コード例 #3
0
        macos_archs = ["x86_64"]
    print('Using MacOS ARCHS=' + str(macos_archs))

    catalyst_archs = None
    if args.catalyst_archs:
        catalyst_archs = args.catalyst_archs.split(',')
    # TODO: To avoid breaking existing CI, catalyst_archs has no defaults. When we can make a breaking change, this should specify a default arch.
    print('Using Catalyst ARCHS=' + str(catalyst_archs))

    # Prevent the build from happening if the same architecture is specified for multiple platforms.
    # When `lipo` is run to stitch the frameworks together into a fat framework, it'll fail, so it's
    # better to stop here while we're ahead.
    if macos_archs and catalyst_archs:
        duplicate_archs = set(macos_archs).intersection(catalyst_archs)
        if duplicate_archs:
            print_error("Cannot have the same architecture for multiple platforms in a fat framework! Consider using build_xcframework.py in the apple platform folder instead. Duplicate archs are %s" % duplicate_archs)
            exit(1)

    if args.legacy_build:
        args.framework_name = "opencv2"
        if not "objc" in args.without:
            args.without.append("objc")

    targets = []
    if not macos_archs and not catalyst_archs:
        print_error("--macos_archs and --catalyst_archs are undefined; nothing will be built.")
        sys.exit(1)
    if macos_archs:
        targets.append((macos_archs, "MacOSX"))
    if catalyst_archs:
        targets.append((catalyst_archs, "Catalyst")),