feat: use VisionOCR for apple platform

This commit is contained in:
Hao Guan
2022-10-07 04:53:50 +10:00
parent 37ede9d545
commit f2b461bde6
4 changed files with 19 additions and 1 deletions

3
.gitmodules vendored
View File

@@ -1,3 +1,6 @@
[submodule "test"]
path = test
url = https://github.com/MaaAssistantArknights/MaaTestSet.git
[submodule "3rdparty/VisionOCR"]
path = 3rdparty/VisionOCR
url = https://github.com/hguandl/VisionOCR.git

1
3rdparty/VisionOCR vendored Submodule

Submodule 3rdparty/VisionOCR added at cd18ce5e00

View File

@@ -55,7 +55,17 @@ else ()
target_link_libraries(MeoAssistant range-v3::range-v3)
endif ()
target_link_libraries(MeoAssistant ppocr paddle_inference protobuf cryptopp gflags glog utf8proc xxhash iomp5 mkldnn mklml_intel)
if (APPLE)
add_subdirectory(3rdparty/VisionOCR)
target_link_libraries(MeoAssistant
vnocr
"-framework CoreFoundation"
"-framework CoreGraphics"
"-framework Vision"
)
else ()
target_link_libraries(MeoAssistant ppocr paddle_inference protobuf cryptopp gflags glog utf8proc xxhash iomp5 mkldnn mklml_intel)
endif (APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -idirafter ${PROJECT_SOURCE_DIR}/3rdparty/include")
endif ()

View File

@@ -34,6 +34,10 @@ class Asst:
Asst.__libpath = pathlib.Path(path) / 'MeoAssistant.dll'
os.environ["PATH"] += os.pathsep + str(path)
Asst.__lib = ctypes.WinDLL(str(Asst.__libpath))
if platform.system().lower() == 'darwin':
Asst.__libpath = pathlib.Path(path) / 'libMeoAssistant.dylib'
os.environ['DYLD_LIBRARY_PATH'] += os.pathsep + str(path)
Asst.__lib = ctypes.CDLL(str(Asst.__libpath))
else:
Asst.__libpath = pathlib.Path(path) / 'libMeoAssistant.so'
os.environ['LD_LIBRARY_PATH'] += os.pathsep + str(path)