Add Convertor function for windows enviroment

This commit is contained in:
liuwenhao4 2020-08-24 15:47:32 +08:00
parent 2de216961f
commit df44111d87
4 changed files with 41 additions and 5 deletions

View File

@ -29,7 +29,7 @@ IF NOT EXIST %BUILD_PATH%/mindspore (
cd %CD%/mindspore
IF "%2%" == "lite" (
IF "%1%" == "lite" (
call :gene_gtest
call :run_cmake
IF errorlevel 1 (
@ -47,10 +47,10 @@ IF "%2%" == "lite" (
)
cd %BUILD_PATH%/mindspore
IF "%1%" == "" (
cmake --build . -- -j6
IF "%2%" == "" (
cmake --build . --target package -- -j6
) ELSE (
cmake --build . -- -j%1%
cmake --build . --target package -- -j%2%
)
IF errorlevel 1 (
echo "build fail."

View File

@ -41,15 +41,27 @@ elseif (PLATFORM_ARM32)
install(DIRECTORY ${TOP_DIR}/mindspore/lite/include/ DESTINATION ${INC_DIR} COMPONENT ${COMPONENT_NAME} FILES_MATCHING PATTERN "*.h")
install(DIRECTORY ${TOP_DIR}/mindspore/lite/schema/ DESTINATION ${INC_DIR}/schema COMPONENT ${COMPONENT_NAME} FILES_MATCHING PATTERN "*.h" PATTERN "inner" EXCLUDE)
install(DIRECTORY ${TOP_DIR}/third_party/flatbuffers/include DESTINATION ${FLATBF_DIR} COMPONENT ${COMPONENT_NAME})
elseif (CMAKE_SYSTEM_NAME MATCHES "Windows")
get_filename_component(CXX_DIR ${CMAKE_CXX_COMPILER} PATH)
file(GLOB LIB_LIST ${CXX_DIR}/libstdc++-6.dll ${CXX_DIR}/libwinpthread-1.dll ${CXX_DIR}/libssp-0.dll ${CXX_DIR}/libgcc_s_seh-1.dll)
install(FILES ${TOP_DIR}/build/mindspore/tools/converter/converter_lite.exe DESTINATION ${TOP_DIR}/output COMPONENT ${COMPONENT_NAME})
install(FILES ${LIB_LIST} DESTINATION ${TOP_DIR}/output COMPONENT ${COMPONENT_NAME})
install(FILES ${TOP_DIR}/build/mindspore/tools/converter/libconverter_parser.a DESTINATION ${TOP_DIR}/output COMPONENT ${PARSER_NAME})
else ()
install(FILES ${TOP_DIR}/mindspore/lite/build/src/libmindspore-lite.so DESTINATION ${LIB_DIR} COMPONENT ${RUN_X86_COMPONENT_NAME})
install(FILES ${TOP_DIR}/third_party/protobuf/build/lib/libprotobuf.so.19.0.0 DESTINATION ${PROTOBF_DIR}/lib RENAME libprotobuf.so.19 COMPONENT ${COMPONENT_NAME})
endif ()
set(CPACK_GENERATOR TGZ)
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
set(CPACK_GENERATOR ZIP)
else ()
set(CPACK_GENERATOR TGZ)
endif ()
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
if (PLATFORM_ARM64 OR PLATFORM_ARM32)
set(CPACK_COMPONENTS_ALL ${COMPONENT_NAME})
elseif (WIN32)
set(CPACK_COMPONENTS_ALL ${COMPONENT_NAME} ${PARSER_NAME})
else ()
set(CPACK_COMPONENTS_ALL ${COMPONENT_NAME} ${RUN_X86_COMPONENT_NAME})
endif ()

View File

@ -25,6 +25,9 @@ if (PLATFORM_ARM64)
set(COMPONENT_NAME runtime-arm64-${PROCESS_UNIT})
elseif (PLATFORM_ARM32)
set(COMPONENT_NAME runtime-arm32-${PROCESS_UNIT})
elseif (WIN32)
set(PARSER_NAME libconverter-parser-win32-${PROCESS_UNIT})
set(COMPONENT_NAME converter-win32-${PROCESS_UNIT})
else ()
set(COMPONENT_NAME convert-ubuntu)
endif()

View File

@ -168,6 +168,27 @@ add_executable(converter_lite
${LITE_SRC}
)
if (WIN32)
add_library(converter_mid OBJECT
${ANF_SRC}
${CONVERTER_SRC}
${OPS_SRC}
${KERNEL_SRC}
${LITE_SRC}
)
add_library(converter_parser STATIC
$<TARGET_OBJECTS:tflite_parser_mid>
$<TARGET_OBJECTS:caffe_parser_mid>
$<TARGET_OBJECTS:onnx_parser_mid>
$<TARGET_OBJECTS:anf_importer_mid>
$<TARGET_OBJECTS:anf_exporter_mid>
$<TARGET_OBJECTS:graph_pass_mid>
$<TARGET_OBJECTS:fusion_mid>
$<TARGET_OBJECTS:quantizer_mid>
$<TARGET_OBJECTS:converter_mid>
)
endif()
target_link_libraries(converter_lite PRIVATE
tflite_parser_mid
caffe_parser_mid