修复release编译产出文件过大的问题

(cherry picked from commit 046bdecd1e)
This commit is contained in:
xia-chu
2025-10-11 18:52:41 +08:00
parent 7828c03d16
commit 697992201f
3 changed files with 6 additions and 5 deletions

View File

@@ -60,6 +60,8 @@ option(ENABLE_WEPOLL "Enable wepoll" ON)
option(ENABLE_VIDEOSTACK "Enable video stack" OFF)
option(DISABLE_REPORT "Disable report to report.zlmediakit.com" OFF)
option(USE_SOLUTION_FOLDERS "Enable solution dir supported" ON)
option(ENABLE_OBJCOPY "Enable use objcopy to generate debug info file" ON)
##############################################################################
# 设置socket默认缓冲区大小为256k.如果设置为0则不设置socket的默认缓冲区大小,使用系统内核默认值(设置为0仅对linux有效)
# Set the default buffer size of the socket to 256k. If set to 0, the default buffer size of the socket will not be set,
@@ -199,10 +201,8 @@ if(UNIX)
set(COMPILE_OPTIONS_DEFAULT ${COMPILE_OPTIONS_DEFAULT} "-g3")
else()
find_program(OBJCOPY_FOUND objcopy)
if (OBJCOPY_FOUND)
if (OBJCOPY_FOUND AND ENABLE_OBJCOPY)
set(COMPILE_OPTIONS_DEFAULT ${COMPILE_OPTIONS_DEFAULT} "-g3")
else()
set(COMPILE_OPTIONS_DEFAULT ${COMPILE_OPTIONS_DEFAULT} "-g0")
endif()
endif()
elseif(WIN32)

View File

@@ -84,7 +84,8 @@ if(MSVC)
endif()
#relase 类型时额外输出debug调试信息
if(UNIX)
string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_LOWER)
if(UNIX AND ENABLE_OBJCOPY)
if("${CMAKE_BUILD_TYPE_LOWER}" STREQUAL "release")
find_program(OBJCOPY_FOUND objcopy)
if (OBJCOPY_FOUND)

View File

@@ -69,7 +69,7 @@ install(TARGETS MediaServer DESTINATION ${INSTALL_PATH_RUNTIME})
#relase 类型时额外输出debug调试信息
string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_LOWER)
if(UNIX)
if(UNIX AND ENABLE_OBJCOPY)
if("${CMAKE_BUILD_TYPE_LOWER}" STREQUAL "release")
find_program(OBJCOPY_FOUND objcopy)
if (OBJCOPY_FOUND)