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

separate debug symbols into a dbg file #1476

Merged
merged 7 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ option(TBB_DISABLE_HWLOC_AUTOMATIC_SEARCH "Disable HWLOC automatic search by pkg
option(TBB_ENABLE_IPO "Enable Interprocedural Optimization (IPO) during the compilation" ON)
option(TBB_FUZZ_TESTING "Enable fuzz testing" OFF)
option(TBB_INSTALL "Enable installation" ON)
if(LINUX)
option(TBB_LINUX_SEPARATE_DBG "Enable separation of the debug symbols during the build" OFF)
endif()
if(APPLE)
option(TBB_BUILD_APPLE_FRAMEWORKS "Build as Apple Frameworks" OFF)
endif()
Expand Down
23 changes: 22 additions & 1 deletion src/tbb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,21 @@ target_link_libraries(tbb
${TBB_COMMON_LINK_LIBS}
)

#strip symbols to a separate dbg file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#strip symbols to a separate dbg file
# Strip debug symbols into a separate .dbg file

if(TBB_LINUX_SEPARATE_DBG)
find_program(OBJCOPY_COMMAND objcopy)
if(NOT OBJCOPY_COMMAND)
message(STATUS "objcopy command not found in the system")
isaevil marked this conversation as resolved.
Show resolved Hide resolved
else()
add_custom_command(TARGET tbb POST_BUIL
isaevil marked this conversation as resolved.
Show resolved Hide resolved
COMMAND objcopy --only-keep-debug $<TARGET_FILE:tbb> $<TARGET_FILE:tbb>.dbg
COMMAND objcopy --strip-debug $<TARGET_FILE:tbb>
COMMAND objcopy --add-gnu-debuglink=$<TARGET_FILE:tbb>.dbg $<TARGET_FILE:tbb>
COMMENT "Creating and associating .dbg file with tbb"
)
endif()
endif()

if(TBB_BUILD_APPLE_FRAMEWORKS)
set_target_properties(tbb PROPERTIES
FRAMEWORK TRUE
Expand Down Expand Up @@ -158,7 +173,13 @@ if (TBB_INSTALL)
COMPONENT devel
)
endif()

if(TBB_LINUX_SEPARATE_DBG)
install(FILES
$<TARGET_FILE:tbb>.dbg
DESTINATION lib
isaevil marked this conversation as resolved.
Show resolved Hide resolved
COMPONENT devel
)
endif()
set(_tbb_pc_lib_name tbb)

if (WIN32)
Expand Down
Loading