From 34c5971960141ad835e9c1f6b0f13097bfb9bf69 Mon Sep 17 00:00:00 2001 From: hexia Date: Wed, 15 Jul 2020 14:27:14 +0800 Subject: [PATCH] add ms_serving to whl and uncoupling third_party grpc --- cmake/mind_expression.cmake | 2 +- cmake/package.cmake | 14 ++++++++++++++ serving/CMakeLists.txt | 10 +++++++++- setup.py | 3 +++ 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/cmake/mind_expression.cmake b/cmake/mind_expression.cmake index 9f8faf261e5..9002c239761 100644 --- a/cmake/mind_expression.cmake +++ b/cmake/mind_expression.cmake @@ -15,7 +15,7 @@ include(${CMAKE_SOURCE_DIR}/cmake/external_libs/json.cmake) include(${CMAKE_SOURCE_DIR}/cmake/dependency_securec.cmake) include(${CMAKE_SOURCE_DIR}/cmake/external_libs/protobuf.cmake) -if (ENABLE_DEBUGGER) +if (ENABLE_DEBUGGER OR ENABLE_SERVING) # build dependencies of gRPC include(${CMAKE_SOURCE_DIR}/cmake/external_libs/absl.cmake) include(${CMAKE_SOURCE_DIR}/cmake/external_libs/c-ares.cmake) diff --git a/cmake/package.cmake b/cmake/package.cmake index 2034b550406..62366f707a9 100644 --- a/cmake/package.cmake +++ b/cmake/package.cmake @@ -257,3 +257,17 @@ if (EXISTS ${CMAKE_SOURCE_DIR}/mindspore/dataset) COMPONENT mindspore ) endif () + +if (ENABLE_SERVING) + install( + TARGETS ms_serving + DESTINATION ${INSTALL_BASE_DIR} + COMPONENT mindspore + ) + + install( + TARGETS inference + DESTINATION ${INSTALL_LIB_DIR} + COMPONENT mindspore + ) +endif () diff --git a/serving/CMakeLists.txt b/serving/CMakeLists.txt index 3c1c08ece08..4529323fe14 100644 --- a/serving/CMakeLists.txt +++ b/serving/CMakeLists.txt @@ -13,7 +13,6 @@ add_library(protobuf::libprotobuf ALIAS protobuf::protobuf) add_executable(protobuf::libprotoc ALIAS protobuf::protoc) set(_PROTOBUF_LIBPROTOBUF protobuf::libprotobuf) -set(_REFLECTION gRPC::grpc++_reflection) if(CMAKE_CROSSCOMPILING) find_program(_PROTOBUF_PROTOC protoc) else() @@ -22,10 +21,19 @@ endif() # Find gRPC installation # Looks for gRPCConfig.cmake file installed by gRPC's cmake installation. +if (EXISTS ${grpc_ROOT}/lib64) + set(gRPC_DIR "${grpc_ROOT}/lib64/cmake/grpc") +else() + set(gRPC_DIR "${grpc_ROOT}/lib/cmake/grpc") +endif() +message("serving using grpc_DIR : " ${gPRC_DIR}) + find_package(gRPC CONFIG REQUIRED) message(STATUS "Using gRPC ${gRPC_VERSION}") set(_GRPC_GRPCPP gRPC::grpc++) +set(_REFLECTION gRPC::grpc++_reflection) + if(CMAKE_CROSSCOMPILING) find_program(_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin) else() diff --git a/setup.py b/setup.py index 2840eb3b14b..bf16c9106be 100644 --- a/setup.py +++ b/setup.py @@ -103,6 +103,7 @@ package_data = { 'lib/*.so*', 'lib/*.a', '.commit_id', + 'ms_serving' ] } @@ -125,6 +126,8 @@ def update_permissions(path): for filename in filenames: file_fullpath = os.path.join(dirpath, filename) os.chmod(file_fullpath, stat.S_IREAD) + if filename == "ms_serving": + os.chmod(file_fullpath, stat.S_IREAD | stat.S_IEXEC) class EggInfo(egg_info):