Proper way of enabling libdebuginfod.

This commit is contained in:
Bartosz Taudul 2024-09-27 19:59:40 +02:00
parent 157bf05c50
commit 6721db8600
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
2 changed files with 8 additions and 8 deletions

View File

@ -54,6 +54,13 @@ if(TRACY_LIBUNWIND_BACKTRACE)
target_link_libraries(TracyClient INTERFACE ${unwind_LINK_LIBRARIES}) target_link_libraries(TracyClient INTERFACE ${unwind_LINK_LIBRARIES})
endif() endif()
if(TRACY_DEBUGINFOD)
include(FindPkgConfig)
pkg_check_modules(debuginfod REQUIRED libdebuginfod)
target_include_directories(TracyClient INTERFACE ${debuginfod_INCLUDE_DIRS})
target_link_libraries(TracyClient INTERFACE ${debuginfod_LINK_LIBRARIES})
endif()
add_library(Tracy::TracyClient ALIAS TracyClient) add_library(Tracy::TracyClient ALIAS TracyClient)
macro(set_option option help value) macro(set_option option help value)
@ -91,6 +98,7 @@ set_option(TRACY_TIMER_FALLBACK "Use lower resolution timers" OFF)
set_option(TRACY_LIBUNWIND_BACKTRACE "Use libunwind backtracing where supported" OFF) set_option(TRACY_LIBUNWIND_BACKTRACE "Use libunwind backtracing where supported" OFF)
set_option(TRACY_SYMBOL_OFFLINE_RESOLVE "Instead of full runtime symbol resolution, only resolve the image path and offset to enable offline symbol resolution" OFF) set_option(TRACY_SYMBOL_OFFLINE_RESOLVE "Instead of full runtime symbol resolution, only resolve the image path and offset to enable offline symbol resolution" OFF)
set_option(TRACY_LIBBACKTRACE_ELF_DYNLOAD_SUPPORT "Enable libbacktrace to support dynamically loaded elfs in symbol resolution resolution after the first symbol resolve operation" OFF) set_option(TRACY_LIBBACKTRACE_ELF_DYNLOAD_SUPPORT "Enable libbacktrace to support dynamically loaded elfs in symbol resolution resolution after the first symbol resolve operation" OFF)
set_option(TRACY_DEBUGINFOD "Enable debuginfod support" OFF)
# advanced # advanced
set_option(TRACY_VERBOSE "[advanced] Verbose output from the profiler" OFF) set_option(TRACY_VERBOSE "[advanced] Verbose output from the profiler" OFF)

View File

@ -1,7 +1,5 @@
cmake_minimum_required(VERSION 3.16) cmake_minimum_required(VERSION 3.16)
option(USE_DEBUGINFOD "Compile with debuginfod integration" ON)
include(${CMAKE_CURRENT_LIST_DIR}/../cmake/version.cmake) include(${CMAKE_CURRENT_LIST_DIR}/../cmake/version.cmake)
# we target C++11 for the client part # we target C++11 for the client part
@ -25,15 +23,9 @@ target_link_libraries(tracy-test TracyClient)
# OS-specific options # OS-specific options
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND USE_DEBUGINFOD)
target_compile_definitions(tracy-test PRIVATE TRACY_DEBUGINFOD)
target_link_libraries(tracy-test "debuginfod")
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
target_link_libraries(tracy-test "execinfo") target_link_libraries(tracy-test "execinfo")
endif() endif()
# copy image file in build folder # copy image file in build folder
configure_file(${CMAKE_CURRENT_LIST_DIR}/image.jpg image.jpg COPYONLY) configure_file(${CMAKE_CURRENT_LIST_DIR}/image.jpg image.jpg COPYONLY)