2021-06-26 09:41:46 +08:00
|
|
|
# include dependency
|
|
|
|
include(CMakePackageConfigHelpers)
|
|
|
|
include(GNUInstallDirs)
|
|
|
|
|
|
|
|
# set package information
|
|
|
|
set(CPACK_PACKAGE_NAME ${PROJECT_NAME})
|
|
|
|
set(CPACK_GENERATOR "External")
|
|
|
|
set(CPACK_CMAKE_GENERATOR "Ninja")
|
|
|
|
set(CPACK_EXTERNAL_PACKAGE_SCRIPT ${CMAKE_SOURCE_DIR}/cmake/package_script.cmake)
|
|
|
|
set(CPACK_EXTERNAL_ENABLE_STAGING true)
|
|
|
|
set(CPACK_TEMPORARY_PACKAGE_FILE_NAME ${CMAKE_SOURCE_DIR}/build/package/mindspore)
|
|
|
|
set(CPACK_TEMPORARY_INSTALL_DIRECTORY ${CMAKE_SOURCE_DIR}/build/package/mindspore)
|
2021-07-08 08:24:33 +08:00
|
|
|
set(CPACK_PACK_ROOT_DIR ${BUILD_PATH}/package/)
|
|
|
|
set(CPACK_CMAKE_SOURCE_DIR ${CMAKE_SOURCE_DIR})
|
2021-11-04 19:25:08 +08:00
|
|
|
set(CPACK_PYTHON_EXE ${Python3_EXECUTABLE})
|
|
|
|
set(CPACK_PYTHON_VERSION ${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR})
|
2021-06-26 09:41:46 +08:00
|
|
|
|
|
|
|
if(ENABLE_GPU)
|
|
|
|
set(CPACK_MS_BACKEND "ms")
|
|
|
|
elseif(ENABLE_CPU)
|
|
|
|
set(CPACK_MS_BACKEND "ms")
|
|
|
|
else()
|
|
|
|
set(CPACK_MS_BACKEND "debug")
|
2022-11-16 14:51:04 +08:00
|
|
|
endif()
|
|
|
|
if(BUILD_DEV_MODE)
|
|
|
|
set(CPACK_MS_PACKAGE_NAME "mindspore_dev")
|
|
|
|
else()
|
|
|
|
set(CPACK_MS_PACKAGE_NAME "mindspore")
|
2021-06-26 09:41:46 +08:00
|
|
|
endif()
|
|
|
|
include(CPack)
|
|
|
|
|
|
|
|
# set install path
|
|
|
|
set(INSTALL_LIB_DIR ${CMAKE_INSTALL_LIBDIR} CACHE PATH "Installation directory for libraries")
|
|
|
|
set(INSTALL_PY_DIR ".")
|
|
|
|
set(INSTALL_BASE_DIR ".")
|
|
|
|
set(INSTALL_BIN_DIR "bin")
|
|
|
|
set(INSTALL_CFG_DIR "config")
|
2022-09-16 15:21:12 +08:00
|
|
|
set(INSTALL_PLUGIN_DIR ".")
|
2021-06-26 09:41:46 +08:00
|
|
|
|
|
|
|
set(INSTALL_LIB_DIR ".")
|
|
|
|
set(onednn_LIBPATH ${onednn_LIBPATH}/../bin/)
|
|
|
|
set(glog_LIBPATH ${glog_LIBPATH}/../bin/)
|
|
|
|
set(opencv_LIBPATH ${opencv_LIBPATH}/../bin/)
|
|
|
|
set(jpeg_turbo_LIBPATH ${jpeg_turbo_LIBPATH}/../bin/)
|
|
|
|
set(sqlite_LIBPATH ${sqlite_LIBPATH}/../bin/)
|
|
|
|
set(tinyxml2_LIBPATH ${tinyxml2_LIBPATH}/../bin/)
|
|
|
|
|
|
|
|
message("offline debugger does not support windows system temporarily")
|
|
|
|
|
2022-08-24 15:54:20 +08:00
|
|
|
file(GLOB PROTO_PY_PB2_LST ${CMAKE_SOURCE_DIR}/build/mindspore/proto_py/proto/*_pb2.py)
|
|
|
|
file(COPY ${PROTO_PY_PB2_LST} DESTINATION ${CMAKE_SOURCE_DIR}/mindspore/python/mindspore/train)
|
|
|
|
|
2021-06-26 09:41:46 +08:00
|
|
|
# set package files
|
|
|
|
install(
|
|
|
|
TARGETS _c_expression
|
|
|
|
DESTINATION ${INSTALL_BASE_DIR}
|
|
|
|
COMPONENT mindspore
|
|
|
|
)
|
|
|
|
|
|
|
|
install(
|
|
|
|
TARGETS mindspore_shared_lib
|
|
|
|
DESTINATION ${INSTALL_LIB_DIR}
|
|
|
|
COMPONENT mindspore
|
|
|
|
)
|
|
|
|
|
|
|
|
install(
|
2022-03-04 16:40:06 +08:00
|
|
|
TARGETS mindspore_core mindspore_common mindspore_backend
|
2021-06-26 09:41:46 +08:00
|
|
|
DESTINATION ${INSTALL_LIB_DIR}
|
|
|
|
COMPONENT mindspore
|
|
|
|
)
|
|
|
|
|
2022-10-24 21:17:42 +08:00
|
|
|
if(MSVC AND DEBUG_MODE)
|
|
|
|
install(
|
|
|
|
FILES $<TARGET_PDB_FILE:_c_expression>
|
|
|
|
DESTINATION ${INSTALL_BASE_DIR}
|
|
|
|
COMPONENT mindspore
|
|
|
|
)
|
|
|
|
|
|
|
|
install(
|
|
|
|
FILES $<TARGET_PDB_FILE:mindspore_shared_lib>
|
|
|
|
DESTINATION ${INSTALL_LIB_DIR}
|
|
|
|
COMPONENT mindspore
|
|
|
|
)
|
|
|
|
|
|
|
|
install(
|
|
|
|
FILES $<TARGET_PDB_FILE:mindspore_core> $<TARGET_PDB_FILE:mindspore_common> $<TARGET_PDB_FILE:mindspore_backend>
|
|
|
|
DESTINATION ${INSTALL_LIB_DIR}
|
|
|
|
COMPONENT mindspore
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2021-06-26 09:41:46 +08:00
|
|
|
if(USE_GLOG)
|
2022-08-26 10:48:53 +08:00
|
|
|
if(MSVC)
|
2022-10-08 20:16:44 +08:00
|
|
|
if(DEBUG_MODE)
|
|
|
|
file(GLOB_RECURSE GLOG_LIB_LIST ${glog_LIBPATH}/mindspore_glogd.dll)
|
|
|
|
else()
|
|
|
|
file(GLOB_RECURSE GLOG_LIB_LIST ${glog_LIBPATH}/mindspore_glog.dll)
|
|
|
|
endif()
|
2022-08-26 10:48:53 +08:00
|
|
|
else()
|
|
|
|
file(GLOB_RECURSE GLOG_LIB_LIST ${glog_LIBPATH}/libmindspore_glog.dll)
|
|
|
|
endif()
|
2021-06-26 09:41:46 +08:00
|
|
|
install(
|
|
|
|
FILES ${GLOG_LIB_LIST}
|
|
|
|
DESTINATION ${INSTALL_LIB_DIR}
|
|
|
|
COMPONENT mindspore
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(ENABLE_MINDDATA)
|
|
|
|
message("icu4c does not support windows system temporarily")
|
|
|
|
install(
|
|
|
|
TARGETS _c_dataengine _c_mindrecord
|
|
|
|
DESTINATION ${INSTALL_BASE_DIR}
|
|
|
|
COMPONENT mindspore
|
|
|
|
)
|
2022-10-24 21:17:42 +08:00
|
|
|
if(MSVC AND DEBUG_MODE)
|
|
|
|
install(
|
|
|
|
FILES $<TARGET_PDB_FILE:_c_dataengine> $<TARGET_PDB_FILE:_c_mindrecord>
|
|
|
|
DESTINATION ${INSTALL_BASE_DIR}
|
|
|
|
COMPONENT mindspore
|
|
|
|
)
|
|
|
|
endif()
|
2022-08-26 10:48:53 +08:00
|
|
|
if(MSVC)
|
|
|
|
file(GLOB_RECURSE OPENCV_LIB_LIST
|
|
|
|
${opencv_LIBPATH}/opencv_core*
|
|
|
|
${opencv_LIBPATH}/opencv_imgcodecs*
|
|
|
|
${opencv_LIBPATH}/opencv_imgproc*
|
|
|
|
)
|
|
|
|
else()
|
|
|
|
file(GLOB_RECURSE OPENCV_LIB_LIST
|
|
|
|
${opencv_LIBPATH}/libopencv_core*
|
|
|
|
${opencv_LIBPATH}/libopencv_imgcodecs*
|
|
|
|
${opencv_LIBPATH}/libopencv_imgproc*
|
|
|
|
)
|
|
|
|
endif()
|
2021-06-26 09:41:46 +08:00
|
|
|
install(
|
|
|
|
FILES ${OPENCV_LIB_LIST}
|
|
|
|
DESTINATION ${INSTALL_LIB_DIR}
|
|
|
|
COMPONENT mindspore
|
|
|
|
)
|
2022-08-26 10:48:53 +08:00
|
|
|
|
|
|
|
if(MSVC)
|
2022-10-08 20:16:44 +08:00
|
|
|
if(DEBUG_MODE)
|
|
|
|
file(GLOB_RECURSE TINYXML2_LIB_LIST ${tinyxml2_LIBPATH}/tinyxml2d.dll)
|
|
|
|
else()
|
|
|
|
file(GLOB_RECURSE TINYXML2_LIB_LIST ${tinyxml2_LIBPATH}/tinyxml2.dll)
|
|
|
|
endif()
|
2022-08-26 10:48:53 +08:00
|
|
|
else()
|
|
|
|
file(GLOB_RECURSE TINYXML2_LIB_LIST ${tinyxml2_LIBPATH}/libtinyxml2.dll)
|
|
|
|
endif()
|
|
|
|
|
2021-06-26 09:41:46 +08:00
|
|
|
install(
|
|
|
|
FILES ${TINYXML2_LIB_LIST}
|
|
|
|
DESTINATION ${INSTALL_LIB_DIR}
|
|
|
|
COMPONENT mindspore
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(ENABLE_CPU)
|
|
|
|
file(GLOB_RECURSE DNNL_LIB_LIST ${onednn_LIBPATH}/dnnl.dll)
|
|
|
|
install(
|
|
|
|
FILES ${DNNL_LIB_LIST}
|
|
|
|
DESTINATION ${INSTALL_LIB_DIR}
|
|
|
|
COMPONENT mindspore
|
|
|
|
)
|
|
|
|
install(
|
|
|
|
TARGETS nnacl
|
|
|
|
DESTINATION ${INSTALL_LIB_DIR}
|
|
|
|
COMPONENT mindspore
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(ENABLE_MPI)
|
|
|
|
if(ENABLE_CPU)
|
|
|
|
install(
|
|
|
|
TARGETS mpi_adapter
|
|
|
|
DESTINATION ${INSTALL_LIB_DIR}
|
|
|
|
COMPONENT mindspore
|
|
|
|
)
|
2021-11-09 09:41:49 +08:00
|
|
|
install(
|
|
|
|
TARGETS mpi_collective
|
|
|
|
DESTINATION ${INSTALL_LIB_DIR}
|
|
|
|
COMPONENT mindspore
|
|
|
|
)
|
2021-06-26 09:41:46 +08:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(ENABLE_GPU)
|
|
|
|
if(ENABLE_MPI)
|
2021-11-09 09:41:49 +08:00
|
|
|
install(
|
|
|
|
TARGETS nvidia_collective
|
|
|
|
DESTINATION ${INSTALL_LIB_DIR}
|
|
|
|
COMPONENT mindspore
|
|
|
|
)
|
2021-06-26 09:41:46 +08:00
|
|
|
endif()
|
|
|
|
install(
|
2022-08-26 10:48:53 +08:00
|
|
|
TARGETS cuda_ops
|
2021-06-26 09:41:46 +08:00
|
|
|
DESTINATION ${INSTALL_LIB_DIR}
|
|
|
|
COMPONENT mindspore
|
|
|
|
)
|
2022-09-14 15:14:16 +08:00
|
|
|
install(
|
2023-02-02 15:45:43 +08:00
|
|
|
TARGETS mindspore_gpu
|
2022-09-14 15:14:16 +08:00
|
|
|
DESTINATION ${INSTALL_PLUGIN_DIR}
|
|
|
|
COMPONENT mindspore
|
|
|
|
)
|
2021-06-26 09:41:46 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
get_filename_component(CXX_DIR ${CMAKE_CXX_COMPILER} PATH)
|
|
|
|
file(GLOB CXX_LIB_LIST ${CXX_DIR}/*.dll)
|
|
|
|
|
|
|
|
string(REPLACE "\\" "/" SystemRoot $ENV{SystemRoot})
|
|
|
|
file(GLOB VC_LIB_LIST ${SystemRoot}/System32/msvcp140.dll ${SystemRoot}/System32/vcomp140.dll)
|
|
|
|
|
|
|
|
file(GLOB JPEG_LIB_LIST ${jpeg_turbo_LIBPATH}/*.dll)
|
2022-08-26 10:48:53 +08:00
|
|
|
|
2021-06-26 09:41:46 +08:00
|
|
|
install(
|
2022-08-26 10:48:53 +08:00
|
|
|
FILES ${CXX_LIB_LIST} ${JPEG_LIB_LIST} ${VC_LIB_LIST}
|
2021-06-26 09:41:46 +08:00
|
|
|
DESTINATION ${INSTALL_LIB_DIR}
|
|
|
|
COMPONENT mindspore
|
|
|
|
)
|
|
|
|
|
2022-08-26 10:48:53 +08:00
|
|
|
if(NOT MSVC)
|
|
|
|
file(GLOB SQLITE_LIB_LIST ${sqlite_LIBPATH}/*.dll)
|
|
|
|
install(
|
|
|
|
FILES ${SQLITE_LIB_LIST}
|
|
|
|
DESTINATION ${INSTALL_LIB_DIR}
|
|
|
|
COMPONENT mindspore
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2021-06-26 09:41:46 +08:00
|
|
|
# set python files
|
2021-12-15 10:33:16 +08:00
|
|
|
file(GLOB MS_PY_LIST ${CMAKE_SOURCE_DIR}/mindspore/python/mindspore/*.py)
|
2021-06-26 09:41:46 +08:00
|
|
|
install(
|
|
|
|
FILES ${MS_PY_LIST}
|
|
|
|
DESTINATION ${INSTALL_PY_DIR}
|
|
|
|
COMPONENT mindspore
|
|
|
|
)
|
|
|
|
|
|
|
|
install(
|
|
|
|
DIRECTORY
|
2021-12-15 10:33:16 +08:00
|
|
|
${CMAKE_SOURCE_DIR}/mindspore/python/mindspore/nn
|
|
|
|
${CMAKE_SOURCE_DIR}/mindspore/python/mindspore/_extends
|
|
|
|
${CMAKE_SOURCE_DIR}/mindspore/python/mindspore/parallel
|
|
|
|
${CMAKE_SOURCE_DIR}/mindspore/python/mindspore/mindrecord
|
|
|
|
${CMAKE_SOURCE_DIR}/mindspore/python/mindspore/numpy
|
|
|
|
${CMAKE_SOURCE_DIR}/mindspore/python/mindspore/train
|
|
|
|
${CMAKE_SOURCE_DIR}/mindspore/python/mindspore/boost
|
|
|
|
${CMAKE_SOURCE_DIR}/mindspore/python/mindspore/common
|
|
|
|
${CMAKE_SOURCE_DIR}/mindspore/python/mindspore/ops
|
|
|
|
${CMAKE_SOURCE_DIR}/mindspore/python/mindspore/communication
|
|
|
|
${CMAKE_SOURCE_DIR}/mindspore/python/mindspore/profiler
|
2022-04-09 18:36:50 +08:00
|
|
|
${CMAKE_SOURCE_DIR}/mindspore/python/mindspore/rewrite
|
2021-12-15 10:33:16 +08:00
|
|
|
${CMAKE_SOURCE_DIR}/mindspore/python/mindspore/run_check
|
2022-09-16 11:08:56 +08:00
|
|
|
${CMAKE_SOURCE_DIR}/mindspore/python/mindspore/experimental
|
2021-06-26 09:41:46 +08:00
|
|
|
DESTINATION ${INSTALL_PY_DIR}
|
|
|
|
COMPONENT mindspore
|
|
|
|
)
|
|
|
|
|
2021-12-15 10:33:16 +08:00
|
|
|
if(EXISTS ${CMAKE_SOURCE_DIR}/mindspore/python/mindspore/dataset)
|
2021-06-26 09:41:46 +08:00
|
|
|
install(
|
2021-12-15 10:33:16 +08:00
|
|
|
DIRECTORY ${CMAKE_SOURCE_DIR}/mindspore/python/mindspore/dataset
|
2021-06-26 09:41:46 +08:00
|
|
|
DESTINATION ${INSTALL_PY_DIR}
|
|
|
|
COMPONENT mindspore
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
## Public header files
|
|
|
|
install(
|
|
|
|
DIRECTORY ${CMAKE_SOURCE_DIR}/include
|
|
|
|
DESTINATION ${INSTALL_BASE_DIR}
|
|
|
|
COMPONENT mindspore
|
|
|
|
)
|
|
|
|
|
|
|
|
## Public header files for minddata
|
|
|
|
install(
|
|
|
|
FILES ${CMAKE_SOURCE_DIR}/mindspore/ccsrc/minddata/dataset/include/dataset/config.h
|
|
|
|
${CMAKE_SOURCE_DIR}/mindspore/ccsrc/minddata/dataset/include/dataset/constants.h
|
|
|
|
${CMAKE_SOURCE_DIR}/mindspore/ccsrc/minddata/dataset/include/dataset/execute.h
|
|
|
|
${CMAKE_SOURCE_DIR}/mindspore/ccsrc/minddata/dataset/include/dataset/text.h
|
|
|
|
${CMAKE_SOURCE_DIR}/mindspore/ccsrc/minddata/dataset/include/dataset/transforms.h
|
|
|
|
${CMAKE_SOURCE_DIR}/mindspore/ccsrc/minddata/dataset/include/dataset/vision.h
|
|
|
|
${CMAKE_SOURCE_DIR}/mindspore/ccsrc/minddata/dataset/include/dataset/vision_lite.h
|
|
|
|
${CMAKE_SOURCE_DIR}/mindspore/ccsrc/minddata/dataset/include/dataset/vision_ascend.h
|
|
|
|
DESTINATION ${INSTALL_BASE_DIR}/include/dataset
|
|
|
|
COMPONENT mindspore
|
|
|
|
)
|
|
|
|
|
|
|
|
## config files
|
|
|
|
install(
|
|
|
|
FILES ${CMAKE_SOURCE_DIR}/config/op_info.config
|
|
|
|
DESTINATION ${INSTALL_CFG_DIR}
|
|
|
|
COMPONENT mindspore
|
|
|
|
)
|