rocprofiler-sdk-codeobj: use pkg-config to find libdw / libelf (#749)
* rocprofiler-sdk-codeobj: use pkg-config to find libdw / libelf
The current version of source/lib/rocprofiler-sdk-codeobj/CMakeLists.txt
adds -ldw and -lelf to target_link_libraries. However, on a system where
libdw-dev / libelf-dev is missing, the cmake configuration phase will
run properly and a compile time error will eventually be raised.
This patch changes the CMakelists.txt to search for libelf libdw and
configures the target as needed. Systems missing the required support
should report an error when running cmake instead of in the middle of
the compilation.
* Use INTERFACE targets
* Resolve issues with Findlib{dw,elf}
---------
Co-authored-by: Jonathan R. Madsen <jonathanrmadsen@gmail.com>
This commit is contained in:
@@ -8,7 +8,6 @@ add_subdirectory(rocprofiler-sdk)
|
||||
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "tools")
|
||||
add_subdirectory(rocprofiler-sdk-tool)
|
||||
add_subdirectory(rocprofiler-sdk-roctx)
|
||||
|
||||
add_subdirectory(rocprofiler-sdk-codeobj)
|
||||
|
||||
if(ROCPROFILER_BUILD_TESTS)
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
# ##############################################################################
|
||||
|
||||
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "codeobj")
|
||||
find_package(amd_comgr REQUIRED)
|
||||
|
||||
set(LIB_CODEOBJ_PARSER_SOURCES code_object_track.cpp code_printing.cpp disassembly.cpp)
|
||||
set(LIB_CODEOBJ_PARSER_HEADERS code_object_track.hpp code_printing.hpp disassembly.hpp
|
||||
@@ -27,28 +26,21 @@ add_library(rocprofiler-sdk-codeobj STATIC)
|
||||
target_sources(rocprofiler-sdk-codeobj PRIVATE ${LIB_CODEOBJ_PARSER_SOURCES})
|
||||
target_link_libraries(
|
||||
rocprofiler-sdk-codeobj
|
||||
PRIVATE amd_comgr dw elf rocprofiler::rocprofiler-build-flags
|
||||
PRIVATE rocprofiler::rocprofiler-amd-comgr rocprofiler::rocprofiler-dw
|
||||
rocprofiler::rocprofiler-elf rocprofiler::rocprofiler-build-flags
|
||||
rocprofiler::rocprofiler-memcheck rocprofiler::rocprofiler-common-library)
|
||||
|
||||
target_include_directories(rocprofiler-sdk-codeobj PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
if(ROCPROFILER_BUILD_CODECOV)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -coverage")
|
||||
target_link_libraries(rocprofiler-sdk-codeobj PUBLIC gcov)
|
||||
endif()
|
||||
target_include_directories(rocprofiler-sdk-codeobj PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
set_target_properties(
|
||||
rocprofiler-sdk-codeobj
|
||||
PROPERTIES LIBRARY_OUTPUT_DIRECTORY
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/rocprofiler-sdk-codeobj
|
||||
SOVERSION ${PROJECT_VERSION_MAJOR}
|
||||
VERSION ${PROJECT_VERSION}
|
||||
BUILD_RPATH "\$ORIGIN:\$ORIGIN/.."
|
||||
INSTALL_RPATH "\$ORIGIN:\$ORIGIN/..")
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/rocprofiler-sdk
|
||||
POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
install(
|
||||
TARGETS rocprofiler-sdk-codeobj
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/rocprofiler-sdk-codeobj
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/rocprofiler-sdk
|
||||
COMPONENT tools
|
||||
EXPORT rocprofiler-sdk-codeobj-targets)
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#
|
||||
# ROCTx Marker Library
|
||||
#
|
||||
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "roctx")
|
||||
|
||||
find_package(rocprofiler-register REQUIRED)
|
||||
|
||||
|
||||
Verwijs in nieuw issue
Block a user