forked from mindspore-Ecosystem/mindspore
dump debuginfo files when compile with -f option
Signed-off-by: zhoufeng <zhoufeng54@huawei.com>
This commit is contained in:
parent
9a81a0e969
commit
c1fdcb9dd7
|
@ -113,4 +113,13 @@ if(ENABLE_AKG AND CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(ENABLE_SYM_FILE)
|
||||||
|
set(CPACK_CUSTOM_INSTALL_VARIABLES)
|
||||||
|
list(APPEND CPACK_CUSTOM_INSTALL_VARIABLES MS_PACK_ROOT_DIR=${CPACK_PACKAGE_DIRECTORY})
|
||||||
|
list(APPEND CPACK_CUSTOM_INSTALL_VARIABLES
|
||||||
|
MS_INSTALL_DIR=${CPACK_PACKAGE_DIRECTORY}/_CPack_Packages/${CMAKE_HOST_SYSTEM_NAME}/${CPACK_GENERATOR})
|
||||||
|
list(APPEND CPACK_CUSTOM_INSTALL_VARIABLES MS_PACKAGE_FILE_NAME=${CPACK_PACKAGE_FILE_NAME})
|
||||||
|
install(SCRIPT ${CMAKE_SOURCE_DIR}/cmake/plugin_debuginfo_script.cmake)
|
||||||
|
endif()
|
||||||
|
|
||||||
include(CPack)
|
include(CPack)
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
set(CMAKE_OBJCOPY $ENV{CROSS_COMPILE}objcopy)
|
||||||
|
set(CMAKE_STRIP $ENV{CROSS_COMPILE}strip)
|
||||||
|
|
||||||
|
file(GLOB ALL_BINARIES
|
||||||
|
${MS_INSTALL_DIR}/${MS_PACKAGE_FILE_NAME}/*.so
|
||||||
|
${MS_INSTALL_DIR}/${MS_PACKAGE_FILE_NAME}/lib/*.so
|
||||||
|
${MS_INSTALL_DIR}/${MS_PACKAGE_FILE_NAME}/lib/plugin/*.so*
|
||||||
|
${MS_INSTALL_DIR}/${MS_PACKAGE_FILE_NAME}/lib/plugin/*/*.so
|
||||||
|
)
|
||||||
|
|
||||||
|
foreach(item ${ALL_BINARIES})
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${CMAKE_OBJCOPY} --only-keep-debug ${item} ${item}.sym
|
||||||
|
WORKING_DIRECTORY ${MS_PACK_ROOT_DIR}
|
||||||
|
)
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${CMAKE_STRIP} ${item}
|
||||||
|
WORKING_DIRECTORY ${MS_PACK_ROOT_DIR}
|
||||||
|
)
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
file(GLOB DEBUG_SYM_FILE
|
||||||
|
${MS_INSTALL_DIR}/${MS_PACKAGE_FILE_NAME}/*.sym
|
||||||
|
${MS_INSTALL_DIR}/${MS_PACKAGE_FILE_NAME}/lib/*.sym
|
||||||
|
${MS_INSTALL_DIR}/${MS_PACKAGE_FILE_NAME}/lib/plugin/*.sym
|
||||||
|
${MS_INSTALL_DIR}/${MS_PACKAGE_FILE_NAME}/lib/plugin/*/*.sym
|
||||||
|
)
|
||||||
|
|
||||||
|
file(MAKE_DIRECTORY ${MS_PACK_ROOT_DIR}/debug_info)
|
||||||
|
file(COPY ${DEBUG_SYM_FILE} DESTINATION ${MS_PACK_ROOT_DIR}/debug_info/)
|
||||||
|
file(REMOVE_RECURSE ${DEBUG_SYM_FILE})
|
||||||
|
execute_process(COMMAND ${CMAKE_COMMAND} -E tar cfv ${MS_PACKAGE_FILE_NAME}.debuginfo.zip debug_info/
|
||||||
|
--format=zip WORKING_DIRECTORY ${MS_PACK_ROOT_DIR})
|
||||||
|
file(REMOVE_RECURSE ${MS_PACK_ROOT_DIR}/debug_info)
|
|
@ -11,6 +11,11 @@ set(CMAKE_C_COMPILER ${TOOLCHAIN_PATH}/hcc/bin/aarch64-target-linux-gnu-gcc)
|
||||||
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PATH}/hcc/bin/aarch64-target-linux-gnu-g++)
|
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PATH}/hcc/bin/aarch64-target-linux-gnu-g++)
|
||||||
|
|
||||||
if(EXISTS ${CMAKE_C_COMPILER} AND EXISTS ${CMAKE_CXX_COMPILER})
|
if(EXISTS ${CMAKE_C_COMPILER} AND EXISTS ${CMAKE_CXX_COMPILER})
|
||||||
|
if(ENABLE_SYM_FILE)
|
||||||
|
string(REPLACE "-ggdb" " " CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
|
||||||
|
string(REPLACE "-g" " " CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
|
||||||
|
endif()
|
||||||
|
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/dependency_securec_arm.cmake)
|
include(${CMAKE_SOURCE_DIR}/cmake/dependency_securec_arm.cmake)
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/protobuf_arm.cmake)
|
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/protobuf_arm.cmake)
|
||||||
|
|
||||||
|
|
|
@ -57,4 +57,3 @@ install(TARGETS mindspore_cpu_kernels OPTIONAL
|
||||||
EXPORT mindspore_cpu_kernels-targets
|
EXPORT mindspore_cpu_kernels-targets
|
||||||
LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}/ascend
|
LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}/ascend
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue