Skip to content

Commit

Permalink
Resolves FoundationDB#91: Stripped debug symbols into separate file
Browse files Browse the repository at this point in the history
  • Loading branch information
senthil4axim committed Sep 24, 2019
1 parent 34cc0b0 commit 281fa55
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -127,5 +127,33 @@ target_compile_options(fdbdoc
-fno-omit-frame-pointer
)

# 91: Strip debug symbols into separate file

set(strip_source_file "${CMAKE_BINARY_DIR}/bin/fdbdoc")

if(APPLE)
set(DSYMUTIL "dsymutil")
set(STRIP "strip")
set(strip_destination_file ${strip_source_file}.dwarf)
add_custom_command(
TARGET fdbdoc
COMMAND ${DSYMUTIL} --flat --minimize ${strip_source_file}
COMMAND ${STRIP} -u -r ${strip_source_file}
)
# set fdbdoc.dwarf file to make clean directory
set_directory_properties(PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${strip_source_file}.dwarf)
else()
set(OBJCOPY "objcopy")
set(strip_destination_file ${strip_source_file}.debug)
add_custom_command(
TARGET fdbdoc
COMMAND ${OBJCOPY} --only-keep-debug ${strip_source_file} ${strip_destination_file}
COMMAND ${OBJCOPY} --strip-unneeded ${strip_source_file}
COMMAND ${OBJCOPY} --add-gnu-debuglink=${strip_destination_file} ${strip_source_file}
)
# set fdbdoc.dwarf file to make clean directory
set_directory_properties(PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${strip_source_file}.debug)
endif()

install(TARGETS fdbdoc RUNTIME DESTINATION bin)
install(PROGRAMS ${FdbMonitor_EXECUTABLE_PATH} DESTINATION lib/foundationdb/document)

0 comments on commit 281fa55

Please sign in to comment.