From 120d1b0446f4b075d5d6180a52478aee12b10f45 Mon Sep 17 00:00:00 2001 From: sunsuodong Date: Sat, 15 May 2021 23:12:59 +0800 Subject: [PATCH] lite remove gvar so --- cmake/package_lite.cmake | 7 +------ mindspore/core/CMakeLists.txt | 6 +++--- mindspore/core/gvar/CMakeLists.txt | 6 +++++- .../examples/train_lenet/model/prepare_model.sh | 3 +-- .../transfer_learning/model/prepare_model.sh | 3 +-- mindspore/lite/test/CMakeLists.txt | 13 ++++++++++--- 6 files changed, 21 insertions(+), 17 deletions(-) diff --git a/cmake/package_lite.cmake b/cmake/package_lite.cmake index a9cc207ffe0..c2dfb03ba9c 100644 --- a/cmake/package_lite.cmake +++ b/cmake/package_lite.cmake @@ -229,8 +229,6 @@ elseif(WIN32) install(TARGETS converter_lite RUNTIME DESTINATION ${CONVERTER_ROOT_DIR}/converter COMPONENT ${RUNTIME_COMPONENT_NAME}) install(FILES ${LIB_LIST} DESTINATION ${CONVERTER_ROOT_DIR}/lib COMPONENT ${RUNTIME_COMPONENT_NAME}) - install(FILES ${TOP_DIR}/build/mindspore/tools/converter/mindspore_core/gvar/libmindspore_gvar.dll - DESTINATION ${CONVERTER_ROOT_DIR}/lib COMPONENT ${RUNTIME_COMPONENT_NAME}) install(FILES ${TOP_DIR}/build/mindspore/tools/converter/registry/libmslite_converter_plugin_reg.dll DESTINATION ${CONVERTER_ROOT_DIR}/lib COMPONENT ${RUNTIME_COMPONENT_NAME}) install(FILES ${glog_LIBPATH}/../bin/libglog.dll DESTINATION ${CONVERTER_ROOT_DIR}/lib @@ -300,12 +298,9 @@ else() if(ENABLE_CONVERTER) install(TARGETS converter_lite RUNTIME DESTINATION ${CONVERTER_ROOT_DIR}/converter COMPONENT ${RUNTIME_COMPONENT_NAME}) - install(FILES ${TOP_DIR}/mindspore/lite/build/tools/converter/mindspore_core/gvar/libmindspore_gvar.so - DESTINATION ${CONVERTER_ROOT_DIR}/lib COMPONENT ${RUNTIME_COMPONENT_NAME}) install(FILES ${TOP_DIR}/mindspore/lite/build/tools/converter/registry/libmslite_converter_plugin_reg.so DESTINATION ${CONVERTER_ROOT_DIR}/lib COMPONENT ${RUNTIME_COMPONENT_NAME}) - install(FILES ${glog_LIBPATH}/libglog.so.0.4.0 - DESTINATION ${CONVERTER_ROOT_DIR}/third_party/glog/lib RENAME libglog.so.0 + install(FILES ${glog_LIBPATH}/libglog.so.0.4.0 DESTINATION ${CONVERTER_ROOT_DIR}/lib RENAME libglog.so.0 COMPONENT ${RUNTIME_COMPONENT_NAME}) file(GLOB NNACL_FILES GLOB ${NNACL_DIR}/*.h) install(FILES ${NNACL_FILES} DESTINATION ${CODEGEN_ROOT_DIR}/include/nnacl COMPONENT ${RUNTIME_COMPONENT_NAME}) diff --git a/mindspore/core/CMakeLists.txt b/mindspore/core/CMakeLists.txt index 2282a9c2015..ba862401fbe 100644 --- a/mindspore/core/CMakeLists.txt +++ b/mindspore/core/CMakeLists.txt @@ -8,7 +8,7 @@ if("${ENABLE_HIDDEN}" STREQUAL "OFF") string(REPLACE " -fvisibility=hidden" " -fvisibility=default" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") endif() -if(NOT(COMPILE_LITE)) +if(NOT(BUILD_LITE)) add_subdirectory(mindrt) endif() @@ -24,7 +24,7 @@ file(GLOB_RECURSE CORE_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ) file(GLOB_RECURSE PROTO_FILE RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "proto/*.proto") -if(NOT(COMPILE_LITE)) +if(NOT(BUILD_LITE)) ms_protobuf_generate_py(PROTO_SRCS PY_HDRS PY_PYS ${PROTO_FILE}) else() ms_protobuf_generate(PROTO_SRCS PROTO_HDRS ${PROTO_FILE}) @@ -41,7 +41,7 @@ endif() set_property(SOURCE ${CORE_SRC_LIST} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_CORE) add_library(mindspore_core STATIC ${CORE_SRC_LIST} ${PROTO_SRCS}) target_link_libraries(mindspore_core PRIVATE mindspore_gvar) -if(NOT(COMPILE_LITE)) +if(NOT(BUILD_LITE)) target_link_libraries(mindspore_core PRIVATE mindrt_mid) endif() diff --git a/mindspore/core/gvar/CMakeLists.txt b/mindspore/core/gvar/CMakeLists.txt index fbb87dbf61a..a3709521efd 100644 --- a/mindspore/core/gvar/CMakeLists.txt +++ b/mindspore/core/gvar/CMakeLists.txt @@ -9,7 +9,11 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wuser-defined-warnings -Winconsistent-missing-override") endif() -add_library(mindspore_gvar SHARED ${MS_GVAR_SRC_LIST}) +if(BUILD_LITE) + add_library(mindspore_gvar STATIC ${MS_GVAR_SRC_LIST}) +else() + add_library(mindspore_gvar SHARED ${MS_GVAR_SRC_LIST}) +endif() if(APPLE) set_target_properties(mindspore_gvar PROPERTIES MACOSX_RPATH ON) diff --git a/mindspore/lite/examples/train_lenet/model/prepare_model.sh b/mindspore/lite/examples/train_lenet/model/prepare_model.sh index 5656233b554..207e04ee145 100755 --- a/mindspore/lite/examples/train_lenet/model/prepare_model.sh +++ b/mindspore/lite/examples/train_lenet/model/prepare_model.sh @@ -14,8 +14,7 @@ CONVERTER="../../../build/tools/converter/converter_lite" if [ ! -f "$CONVERTER" ]; then if ! command -v converter_lite &> /dev/null then - tar -xzf ../../../../../output/mindspore-lite-*-train-linux-x64.tar.gz --strip-components 4 --wildcards --no-anchored converter_lite libmindspore_gvar.so - tar -xzf ../../../../../output/mindspore-lite-*-train-linux-x64.tar.gz --strip-components 6 --wildcards --no-anchored libglog.so.0 + tar -xzf ../../../../../output/mindspore-lite-*-train-linux-x64.tar.gz --strip-components 4 --wildcards --no-anchored converter_lite libglog.so.0 if [ -f ./converter_lite ]; then CONVERTER=./converter_lite else diff --git a/mindspore/lite/examples/transfer_learning/model/prepare_model.sh b/mindspore/lite/examples/transfer_learning/model/prepare_model.sh index cc049cf48a3..f66b25a4c74 100755 --- a/mindspore/lite/examples/transfer_learning/model/prepare_model.sh +++ b/mindspore/lite/examples/transfer_learning/model/prepare_model.sh @@ -19,8 +19,7 @@ CONVERTER="../../../build/tools/converter/converter_lite" if [ ! -f "$CONVERTER" ]; then if ! command -v converter_lite &> /dev/null then - tar -xzf ../../../../../output/mindspore-lite-*-train-linux-x64.tar.gz --strip-components 4 --wildcards --no-anchored converter_lite libmindspore_gvar.so - tar -xzf ../../../../../output/mindspore-lite-*-train-linux-x64.tar.gz --strip-components 6 --wildcards --no-anchored libglog.so.0 + tar -xzf ../../../../../output/mindspore-lite-*-train-linux-x64.tar.gz --strip-components 4 --wildcards --no-anchored converter_lite libglog.so.0 if [ -f ./converter_lite ]; then CONVERTER=./converter_lite else diff --git a/mindspore/lite/test/CMakeLists.txt b/mindspore/lite/test/CMakeLists.txt index 0a5ac862769..f6a7b1a78a8 100644 --- a/mindspore/lite/test/CMakeLists.txt +++ b/mindspore/lite/test/CMakeLists.txt @@ -163,11 +163,18 @@ set(TEST_LITE_SRC ${LITE_DIR}/src/common/dynamic_library_loader.cc ${LITE_DIR}/src/common/string_util.cc ${LITE_DIR}/src/common/quant_utils.cc - ${LITE_DIR}/tools/common/flag_parser.cc - ${LITE_DIR}/tools/benchmark/benchmark.cc - ${LITE_DIR}/test/st/benchmark_test.cc ${LITE_DIR}/src/errorcode.cc ) + +if(ENABLE_TOOLS) + set(TEST_LITE_SRC + ${TEST_LITE_SRC} + ${LITE_DIR}/tools/common/flag_parser.cc + ${LITE_DIR}/tools/benchmark/benchmark.cc + ${LITE_DIR}/test/st/benchmark_test.cc + ) +endif() + ### gpu runtime if(SUPPORT_GPU STREQUAL opencl) include_directories(${CMAKE_BINARY_DIR}/_deps/opencl-headers-src)