diff --git a/build.bat b/build.bat index 59aaee07782..0eb5c0598d7 100644 --- a/build.bat +++ b/build.bat @@ -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." diff --git a/cmake/package_lite.cmake b/cmake/package_lite.cmake index 3b295ceb6f8..72e8d9a06b2 100644 --- a/cmake/package_lite.cmake +++ b/cmake/package_lite.cmake @@ -42,15 +42,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_RUN_X86} 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 () diff --git a/mindspore/lite/CMakeLists.txt b/mindspore/lite/CMakeLists.txt index efc10127029..53968004e58 100644 --- a/mindspore/lite/CMakeLists.txt +++ b/mindspore/lite/CMakeLists.txt @@ -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() diff --git a/mindspore/lite/tools/converter/CMakeLists.txt b/mindspore/lite/tools/converter/CMakeLists.txt index d6fb0e150f6..5c149b98855 100644 --- a/mindspore/lite/tools/converter/CMakeLists.txt +++ b/mindspore/lite/tools/converter/CMakeLists.txt @@ -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 + $ + $ + $ + $ + $ + $ + $ + $ + $ + ) +endif() + target_link_libraries(converter_lite PRIVATE tflite_parser_mid caffe_parser_mid