mirror of
https://gitee.com/xia-chu/ZLMediaKit.git
synced 2026-05-06 10:57:50 +08:00
feat: generating debug files during linux release builds (#4308)
Some checks failed
Android / build (push) Has been cancelled
CodeQL / Analyze (cpp) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
Docker / build (push) Has been cancelled
Linux / build (push) Has been cancelled
macOS / build (push) Has been cancelled
Windows / build (push) Has been cancelled
Some checks failed
Android / build (push) Has been cancelled
CodeQL / Analyze (cpp) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
Docker / build (push) Has been cancelled
Linux / build (push) Has been cancelled
macOS / build (push) Has been cancelled
Windows / build (push) Has been cancelled
linux release构建时生成与MediaServer 匹配的debug文件。 生产环境依然使用小尺寸的MediaServer,在需要gdb调试或者查看coredump文件时可以结合debug文件查看调用栈。
This commit is contained in:
parent
6e125d02dc
commit
7d7320f0b7
@ -198,7 +198,12 @@ if(UNIX)
|
||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
|
||||
set(COMPILE_OPTIONS_DEFAULT ${COMPILE_OPTIONS_DEFAULT} "-g3")
|
||||
else()
|
||||
set(COMPILE_OPTIONS_DEFAULT ${COMPILE_OPTIONS_DEFAULT} "-g0")
|
||||
find_program(OBJCOPY_FOUND objcopy)
|
||||
if (OBJCOPY_FOUND)
|
||||
set(COMPILE_OPTIONS_DEFAULT ${COMPILE_OPTIONS_DEFAULT} "-g3")
|
||||
else()
|
||||
set(COMPILE_OPTIONS_DEFAULT ${COMPILE_OPTIONS_DEFAULT} "-g0")
|
||||
endif()
|
||||
endif()
|
||||
elseif(WIN32)
|
||||
if (MSVC)
|
||||
|
||||
@ -66,3 +66,23 @@ else()
|
||||
endif()
|
||||
|
||||
install(TARGETS MediaServer DESTINATION ${INSTALL_PATH_RUNTIME})
|
||||
|
||||
#relase 类型时额外输出debug调试信息
|
||||
string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_LOWER)
|
||||
if(UNIX)
|
||||
if("${CMAKE_BUILD_TYPE_LOWER}" STREQUAL "release")
|
||||
find_program(OBJCOPY_FOUND objcopy)
|
||||
if (OBJCOPY_FOUND)
|
||||
add_custom_command(TARGET MediaServer
|
||||
POST_BUILD
|
||||
COMMAND objcopy --only-keep-debug ${EXECUTABLE_OUTPUT_PATH}/MediaServer ${EXECUTABLE_OUTPUT_PATH}/MediaServer.debug
|
||||
COMMAND objcopy --strip-all ${EXECUTABLE_OUTPUT_PATH}/MediaServer
|
||||
COMMAND objcopy --add-gnu-debuglink=${EXECUTABLE_OUTPUT_PATH}/MediaServer.debug ${EXECUTABLE_OUTPUT_PATH}/MediaServer
|
||||
)
|
||||
install(FILES ${EXECUTABLE_OUTPUT_PATH}/MediaServer.debug DESTINATION ${INSTALL_PATH_RUNTIME})
|
||||
else()
|
||||
message(STATUS "not found objcopy, generate MediaServer.debug skip")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user