2020-08-18 21:01:18 +08:00
|
|
|
include(CMakePackageConfigHelpers)
|
|
|
|
|
2020-08-25 14:53:59 +08:00
|
|
|
set(LIB_DIR ${MAIN_DIR}-${COMPONENT_NAME}/lib)
|
|
|
|
set(INC_DIR ${MAIN_DIR}-${COMPONENT_NAME}/include)
|
|
|
|
set(TURBO_DIR ${MAIN_DIR}-${COMPONENT_NAME}/third_party/libjpeg-turbo)
|
|
|
|
set(OPENCV_DIR ${MAIN_DIR}-${COMPONENT_NAME}/third_party/opencv)
|
|
|
|
set(PROTOBF_DIR ${MAIN_DIR}-${COMPONENT_NAME}/third_party/protobuf)
|
|
|
|
set(FLATBF_DIR ${MAIN_DIR}-${COMPONENT_NAME}/third_party/flatbuffers)
|
2020-08-18 21:01:18 +08:00
|
|
|
|
2020-08-25 14:53:59 +08:00
|
|
|
set(LIB_DIR_RUN_X86 ${MAIN_DIR}-${RUN_X86_COMPONENT_NAME}/lib)
|
2020-08-27 10:23:24 +08:00
|
|
|
set(INC_DIR_RUN_X86 ${MAIN_DIR}-${RUN_X86_COMPONENT_NAME}/include)
|
|
|
|
set(TURBO_DIR_RUN_X86 ${MAIN_DIR}-${RUN_X86_COMPONENT_NAME}/third_party/libjpeg-turbo)
|
|
|
|
set(OPENCV_DIR_RUN_X86 ${MAIN_DIR}-${RUN_X86_COMPONENT_NAME}/third_party/opencv)
|
|
|
|
set(PROTOBF_DIR_RUN_X86 ${MAIN_DIR}-${RUN_X86_COMPONENT_NAME}/third_party/protobuf)
|
|
|
|
set(FLATBF_DIR_RUN_X86 ${MAIN_DIR}-${RUN_X86_COMPONENT_NAME}/third_party/flatbuffers)
|
2020-08-18 21:01:18 +08:00
|
|
|
if (BUILD_MINDDATA)
|
2020-08-20 19:27:48 +08:00
|
|
|
install(DIRECTORY ${TOP_DIR}/mindspore/ccsrc/minddata/dataset/include/ DESTINATION ${INC_DIR} COMPONENT ${COMPONENT_NAME} FILES_MATCHING PATTERN "*.h")
|
2020-08-18 21:01:18 +08:00
|
|
|
install(FILES ${TOP_DIR}/mindspore/lite/build/minddata/libminddata-lite.so DESTINATION ${LIB_DIR} COMPONENT ${COMPONENT_NAME})
|
|
|
|
|
|
|
|
install(FILES ${TOP_DIR}/third_party/libjpeg-turbo/lib/libjpeg.so DESTINATION ${TURBO_DIR}/lib COMPONENT ${COMPONENT_NAME})
|
|
|
|
install(FILES ${TOP_DIR}/third_party/libjpeg-turbo/lib/libturbojpeg.so DESTINATION ${TURBO_DIR}/lib COMPONENT ${COMPONENT_NAME})
|
|
|
|
if (PLATFORM_ARM64)
|
|
|
|
install(FILES ${TOP_DIR}/third_party/opencv/build/lib/arm64-v8a/libopencv_core.so DESTINATION ${OPENCV_DIR}/lib/arm64-v8a COMPONENT ${COMPONENT_NAME})
|
|
|
|
install(FILES ${TOP_DIR}/third_party/opencv/build/lib/arm64-v8a/libopencv_imgcodecs.so DESTINATION ${OPENCV_DIR}/lib/arm64-v8a COMPONENT ${COMPONENT_NAME})
|
|
|
|
install(FILES ${TOP_DIR}/third_party/opencv/build/lib/arm64-v8a/libopencv_imgproc.so DESTINATION ${OPENCV_DIR}/lib/arm64-v8a COMPONENT ${COMPONENT_NAME})
|
|
|
|
elseif (PLATFORM_ARM32)
|
|
|
|
install(FILES ${TOP_DIR}/third_party/opencv/build/lib/armeabi-v7a/libopencv_core.so DESTINATION ${OPENCV_DIR}/lib/armeabi-v7a COMPONENT ${COMPONENT_NAME})
|
|
|
|
install(FILES ${TOP_DIR}/third_party/opencv/build/lib/armeabi-v7a/libopencv_imgcodecs.so DESTINATION ${OPENCV_DIR}/lib/armeabi-v7a COMPONENT ${COMPONENT_NAME})
|
|
|
|
install(FILES ${TOP_DIR}/third_party/opencv/build/lib/armeabi-v7a/libopencv_imgproc.so DESTINATION ${OPENCV_DIR}/lib/armeabi-v7a COMPONENT ${COMPONENT_NAME})
|
|
|
|
else ()
|
|
|
|
install(FILES ${TOP_DIR}/third_party/opencv/build/lib/libopencv_core.so DESTINATION ${OPENCV_DIR}/lib COMPONENT ${COMPONENT_NAME})
|
|
|
|
install(FILES ${TOP_DIR}/third_party/opencv/build/lib/libopencv_imgcodecs.so DESTINATION ${OPENCV_DIR}/lib COMPONENT ${COMPONENT_NAME})
|
|
|
|
install(FILES ${TOP_DIR}/third_party/opencv/build/lib/libopencv_imgproc.so DESTINATION ${OPENCV_DIR}/lib COMPONENT ${COMPONENT_NAME})
|
|
|
|
endif ()
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
if (PLATFORM_ARM64)
|
2020-08-22 17:34:07 +08:00
|
|
|
install(FILES ${TOP_DIR}/mindspore/lite/build/src/libmindspore-lite.so DESTINATION ${LIB_DIR} COMPONENT ${COMPONENT_NAME})
|
2020-08-20 19:27:48 +08:00
|
|
|
install(FILES ${TOP_DIR}/mindspore/core/ir/dtype/type_id.h DESTINATION ${INC_DIR}/ir/dtype COMPONENT ${COMPONENT_NAME})
|
|
|
|
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)
|
2020-08-22 16:43:15 +08:00
|
|
|
install(FILES ${TOP_DIR}/mindspore/lite/build/nnacl/liboptimize.so DESTINATION ${LIB_DIR} COMPONENT ${COMPONENT_NAME})
|
2020-08-20 19:27:48 +08:00
|
|
|
install(DIRECTORY ${TOP_DIR}/third_party/flatbuffers/include DESTINATION ${FLATBF_DIR} COMPONENT ${COMPONENT_NAME})
|
|
|
|
elseif (PLATFORM_ARM32)
|
2020-08-22 17:34:07 +08:00
|
|
|
install(FILES ${TOP_DIR}/mindspore/lite/build/src/libmindspore-lite.so DESTINATION ${LIB_DIR} COMPONENT ${COMPONENT_NAME})
|
2020-08-20 19:27:48 +08:00
|
|
|
install(FILES ${TOP_DIR}/mindspore/core/ir/dtype/type_id.h DESTINATION ${INC_DIR}/ir/dtype COMPONENT ${COMPONENT_NAME})
|
|
|
|
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})
|
2020-08-24 15:47:32 +08:00
|
|
|
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)
|
2020-08-26 14:13:58 +08:00
|
|
|
install(FILES ${TOP_DIR}/build/mindspore/tools/converter/converter_lite.exe DESTINATION ${TOP_DIR}/build/mindspore/package COMPONENT ${COMPONENT_NAME})
|
|
|
|
install(FILES ${LIB_LIST} DESTINATION ${TOP_DIR}/build/mindspore/package COMPONENT ${COMPONENT_NAME})
|
|
|
|
install(FILES ${TOP_DIR}/build/mindspore/tools/converter/libconverter_parser.a DESTINATION ${TOP_DIR}/build/mindspore/package COMPONENT ${PARSER_NAME})
|
2020-08-20 19:27:48 +08:00
|
|
|
else ()
|
2020-08-27 10:23:24 +08:00
|
|
|
install(DIRECTORY ${TOP_DIR}/mindspore/lite/include/ DESTINATION ${INC_DIR_RUN_X86} COMPONENT ${RUN_X86_COMPONENT_NAME} FILES_MATCHING PATTERN "*.h")
|
|
|
|
install(DIRECTORY ${TOP_DIR}/mindspore/lite/schema/ DESTINATION ${INC_DIR_RUN_X86}/schema COMPONENT ${RUN_X86_COMPONENT_NAME} FILES_MATCHING PATTERN "*.h" PATTERN "inner" EXCLUDE)
|
|
|
|
install(FILES ${TOP_DIR}/mindspore/core/ir/dtype/type_id.h DESTINATION ${INC_DIR_RUN_X86}/ir/dtype COMPONENT ${RUN_X86_COMPONENT_NAME})
|
|
|
|
install(DIRECTORY ${TOP_DIR}/third_party/flatbuffers/include DESTINATION ${FLATBF_DIR_RUN_X86} COMPONENT ${RUN_X86_COMPONENT_NAME})
|
2020-08-25 14:53:59 +08:00
|
|
|
install(FILES ${TOP_DIR}/mindspore/lite/build/src/libmindspore-lite.so DESTINATION ${LIB_DIR_RUN_X86} COMPONENT ${RUN_X86_COMPONENT_NAME})
|
2020-08-27 10:23:24 +08:00
|
|
|
|
2020-08-18 21:01:18 +08:00
|
|
|
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})
|
2020-08-20 19:27:48 +08:00
|
|
|
endif ()
|
2020-08-18 21:01:18 +08:00
|
|
|
|
2020-08-24 15:47:32 +08:00
|
|
|
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
|
|
|
|
set(CPACK_GENERATOR ZIP)
|
|
|
|
else ()
|
|
|
|
set(CPACK_GENERATOR TGZ)
|
|
|
|
endif ()
|
2020-08-18 21:01:18 +08:00
|
|
|
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
|
2020-08-22 17:34:07 +08:00
|
|
|
if (PLATFORM_ARM64 OR PLATFORM_ARM32)
|
|
|
|
set(CPACK_COMPONENTS_ALL ${COMPONENT_NAME})
|
2020-08-24 15:47:32 +08:00
|
|
|
elseif (WIN32)
|
2020-08-26 14:13:58 +08:00
|
|
|
set(CPACK_COMPONENTS_ALL ${COMPONENT_NAME})
|
2020-08-22 17:34:07 +08:00
|
|
|
else ()
|
|
|
|
set(CPACK_COMPONENTS_ALL ${COMPONENT_NAME} ${RUN_X86_COMPONENT_NAME})
|
|
|
|
endif ()
|
2020-08-18 21:01:18 +08:00
|
|
|
set(CPACK_PACKAGE_FILE_NAME ${MAIN_DIR})
|
2020-08-26 14:13:58 +08:00
|
|
|
if (WIN32)
|
|
|
|
set(CPACK_PACKAGE_DIRECTORY ${TOP_DIR}/output)
|
|
|
|
else ()
|
|
|
|
set(CPACK_PACKAGE_DIRECTORY ${TOP_DIR}/output/tmp)
|
|
|
|
endif()
|
2020-08-18 21:01:18 +08:00
|
|
|
set(CPACK_PACKAGE_CHECKSUM SHA256)
|
|
|
|
include(CPack)
|