Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolves #91: Stripped debug symbols into separate file #216

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 for make clean command
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.debug file for make clean command
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)