Skip to content

Commit

Permalink
Merge pull request #148 from jianzfb/yolo
Browse files Browse the repository at this point in the history
fix grpc deploy
  • Loading branch information
jianzfb authored Nov 4, 2024
2 parents e228956 + 04d05db commit ca33566
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
7 changes: 3 additions & 4 deletions antgo/pipeline/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ def pipeline_cplusplus_package(project, folder='./deploy', **kwargs):
project_plugin_folder = os.path.join(plugin_folder, project)
os.makedirs(project_plugin_folder, exist_ok=True)

# depedent_folder = os.path.join(package_folder, 'dependents')
# os.makedirs(depedent_folder, exist_ok=True)

os.makedirs(os.path.join(package_folder, 'config'), exist_ok=True)
os.makedirs(os.path.join(package_folder, 'models'), exist_ok=True)

Expand Down Expand Up @@ -95,7 +92,7 @@ def pipeline_cplusplus_package(project, folder='./deploy', **kwargs):
# 检查是否需要ffmpeg依赖
if 'ffmpeg' in project_info['eagleeye']:
# 仅对android/windows处理(linux平台下,镜像中默认已经安装)
os.system(f'cp -r {project_info["eagleeye"]["ffmpeg"]}/install/lib/*.so {depedent_folder}')
os.system(f'cp -r {project_info["eagleeye"]["ffmpeg"]}/install/lib/*.so {package_folder}/')

# 检查是否需要rk依赖
if 'rk' in project_info['eagleeye']:
Expand All @@ -109,8 +106,10 @@ def pipeline_cplusplus_package(project, folder='./deploy', **kwargs):
os.system(f'cp -r {project_info["eagleeye"]["rk"]}/rknpu2/runtime/RK3588/Android/librknn_api/arm64-v8a/librknnrt.so {package_folder}/')

# 检查是否需要minio依赖
# 默认minio安装到系统

# 检查是否需要grpc依赖
# 默认grpc安装到系统

# 检查是否需要opencv依赖
if 'opencv' in project_info['eagleeye']:
Expand Down
10 changes: 8 additions & 2 deletions antgo/pipeline/functional/mixins/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -2626,15 +2626,22 @@ def build(self, platform='android/arm64-v8a', output_folder='./deploy', project_
if proto_tool_dir.endswith('/'):
proto_tool_dir = proto_tool_dir[:-1]
proto_out_dir = os.path.join(output_folder, 'proto')
if proto_tool_dir is None:
# 检查系统目录下是否存在protoc工具,如果不存在需要下载并编译
status = os.system('which protoc')
if status != 0:
print('Dont install grpc in system, please set proto tool.')
return

print(f'proto_tool_dir {proto_tool_dir}')
# C++ proto
if proto_tool_dir is not None:
# 非系统目录,用户指定目录
print(f'use proto_tool_dir {proto_tool_dir}')
proto_compile_cmd = f'cd {proto_out_dir}; {proto_tool_dir}/bin/protoc --grpc_out=./ --cpp_out=./ --plugin=protoc-gen-grpc={proto_tool_dir}/bin/grpc_cpp_plugin {project_name.lower()}.proto'
os.system(proto_compile_cmd)
else:
# 系统目录
print(f'use system protoc')
proto_compile_cmd = f'cd {proto_out_dir}; protoc --grpc_out=./ --cpp_out=./ --plugin=protoc-gen-grpc=/usr/local/bin/grpc_cpp_plugin {project_name.lower()}.proto'
os.system(proto_compile_cmd)

Expand Down Expand Up @@ -2764,4 +2771,3 @@ def build(self, platform='android/arm64-v8a', output_folder='./deploy', project_
with open(os.path.join(output_folder, '.project.json'), 'w') as fp:
json.dump(project_info, fp)

return True

0 comments on commit ca33566

Please sign in to comment.