Skip to content

Commit

Permalink
try to reduce target size
Browse files Browse the repository at this point in the history
  • Loading branch information
acelyc111 committed Aug 1, 2024
1 parent 1a58d82 commit db92784
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions cmake_modules/BaseFunctions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,17 @@ endfunction()
function(dsn_setup_compiler_flags)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_definitions(-DDSN_BUILD_TYPE=Debug)
add_definitions(-g)
else()
add_definitions(-g)
add_definitions(-O2)
add_definitions(-DDSN_BUILD_TYPE=Release)
endif()
# Reduce the target size when build on GitHub Actions.
if("$ENV{GITHUB_ACTION}" STREQUAL "")
add_definitions(-g)
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Os -ffunction-sections -fdata-sections -fno-unwind-tables -fno-asynchronous-unwind-tables -flto")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-s -Wl,-Bsymbolic -Wl,--gc-sections")
endif()
cmake_host_system_information(RESULT BUILD_HOSTNAME QUERY HOSTNAME)
add_definitions(-DDSN_BUILD_HOSTNAME=${BUILD_HOSTNAME})

Expand Down

0 comments on commit db92784

Please sign in to comment.