deepin-ocr/3rdparty/opencv-4.5.4/platforms/apple/cv_build_utils.py
wangzhengyang 718c41634f feat: 切换后端至PaddleOCR-NCNN,切换工程为CMake
1.项目后端整体迁移至PaddleOCR-NCNN算法,已通过基本的兼容性测试
2.工程改为使用CMake组织,后续为了更好地兼容第三方库,不再提供QMake工程
3.重整权利声明文件,重整代码工程,确保最小化侵权风险

Log: 切换后端至PaddleOCR-NCNN,切换工程为CMake
Change-Id: I4d5d2c5d37505a4a24b389b1a4c5d12f17bfa38c
2022-05-10 10:22:11 +08:00

66 lines
2.1 KiB
Python

#!/usr/bin/env python
"""
Common utilities. These should be compatible with Python 2 and 3.
"""
from __future__ import print_function
import sys, re
from subprocess import check_call, check_output, CalledProcessError
def execute(cmd, cwd = None):
print("Executing: %s in %s" % (cmd, cwd), file=sys.stderr)
print('Executing: ' + ' '.join(cmd))
retcode = check_call(cmd, cwd = cwd)
if retcode != 0:
raise Exception("Child returned:", retcode)
def print_header(text):
print("="*60)
print(text)
print("="*60)
def print_error(text):
print("="*60, file=sys.stderr)
print("ERROR: %s" % text, file=sys.stderr)
print("="*60, file=sys.stderr)
def get_xcode_major():
ret = check_output(["xcodebuild", "-version"]).decode('utf-8')
m = re.match(r'Xcode\s+(\d+)\..*', ret, flags=re.IGNORECASE)
if m:
return int(m.group(1))
else:
raise Exception("Failed to parse Xcode version")
def get_xcode_version():
"""
Returns the major and minor version of the current Xcode
command line tools as a tuple of (major, minor)
"""
ret = check_output(["xcodebuild", "-version"]).decode('utf-8')
m = re.match(r'Xcode\s+(\d+)\.(\d+)', ret, flags=re.IGNORECASE)
if m:
return (int(m.group(1)), int(m.group(2)))
else:
raise Exception("Failed to parse Xcode version")
def get_xcode_setting(var, projectdir):
ret = check_output(["xcodebuild", "-showBuildSettings"], cwd = projectdir).decode('utf-8')
m = re.search("\s" + var + " = (.*)", ret)
if m:
return m.group(1)
else:
raise Exception("Failed to parse Xcode settings")
def get_cmake_version():
"""
Returns the major and minor version of the current CMake
command line tools as a tuple of (major, minor, revision)
"""
ret = check_output(["cmake", "--version"]).decode('utf-8')
m = re.match(r'cmake\sversion\s+(\d+)\.(\d+).(\d+)', ret, flags=re.IGNORECASE)
if m:
return (int(m.group(1)), int(m.group(2)), int(m.group(3)))
else:
raise Exception("Failed to parse CMake version")