Skip to content

Commit

Permalink
Update perfparser and use configure_file to generate config-perfparser.h
Browse files Browse the repository at this point in the history
This also fixes the build error if libdebuginfod is installed but
not libdebuginfo-devel, i.e. if debuginfod.h is missing.
  • Loading branch information
dfaure committed Oct 9, 2023
1 parent fe691c3 commit da55129
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
17 changes: 13 additions & 4 deletions 3rdparty/perfparser.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@ check_submodule_exists(perfparser perfparser/app/perfdata.h)
include(CheckSymbolExists)
set(CMAKE_REQUIRED_INCLUDES ${LIBELF_INCLUDE_DIRS} ${LIBDW_INCLUDE_DIR}/elfutils ${LIBDWARF_INCLUDE_DIRS})
set(CMAKE_REQUIRED_LIBRARIES ${LIBDW_LIBRARIES} ${LIBELF_LIBRARIES})
check_symbol_exists(dwfl_get_debuginfod_client "libdwfl.h" HAVE_DWFL_GET_DEBUGINFOD_CLIENT)
check_symbol_exists(dwfl_get_debuginfod_client "libdwfl.h" HAVE_DWFL_GET_DEBUGINFOD_CLIENT_SYMBOL)
set(CMAKE_REQUIRED_LIBRARIES ${LIBDEBUGINFOD_LIBRARIES})
check_symbol_exists(debuginfod_set_user_data "debuginfod.h" HAVE_DEBUGINFOD_SET_USER_DATA)



include_directories(
${LIBELF_INCLUDE_DIRS}
${LIBDW_INCLUDE_DIR}/elfutils
${LIBDWARF_INCLUDE_DIRS}
perfparser/app
${CMAKE_CURRENT_BINARY_DIR}/perfparser/app
)

add_library(libhotspot-perfparser STATIC
Expand Down Expand Up @@ -41,14 +46,18 @@ PUBLIC
if (Zstd_FOUND)
target_include_directories(libhotspot-perfparser PUBLIC ${Zstd_INCLUDE_DIR})
target_link_libraries(libhotspot-perfparser PUBLIC ${Zstd_LIBRARY})
target_compile_definitions(libhotspot-perfparser PUBLIC HAVE_ZSTD=1)
set(HAVE_ZSTD 1)
endif()

if (HAVE_DWFL_GET_DEBUGINFOD_CLIENT AND LIBDEBUGINFOD_LIBRARIES)
if (HAVE_DWFL_GET_DEBUGINFOD_CLIENT_SYMBOL AND HAVE_DEBUGINFOD_SET_USER_DATA)
target_link_libraries(libhotspot-perfparser PRIVATE ${LIBDEBUGINFOD_LIBRARIES})
target_compile_definitions(libhotspot-perfparser PRIVATE HAVE_DWFL_GET_DEBUGINFOD_CLIENT=1)
set(HAVE_DWFL_GET_DEBUGINFOD_CLIENT 1)
endif()

add_feature_info(debuginfod HAVE_DWFL_GET_DEBUGINFOD_CLIENT "libdwfl and libdebuginfod are useful for on-demand fetching of debug symbols")

configure_file(perfparser/app/config-perfparser.h.in perfparser/app/config-perfparser.h)

add_executable(hotspot-perfparser
perfparser/app/main.cpp
)
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,6 @@ set_package_properties(
TYPE OPTIONAL
)

feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)

include(KDEInstallDirs)
include(KDECMakeSettings)
include(ECMAddTests)
Expand Down Expand Up @@ -173,3 +171,5 @@ install(
FILES com.kdab.Hotspot.appdata.xml
DESTINATION ${KDE_INSTALL_METAINFODIR}
)
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)

0 comments on commit da55129

Please sign in to comment.