Rollup of build changes needed for compat with TheRock. (#1086)
* Rollup of build changes needed for compat with TheRock. * When built for a non-default ROCM location, the HIP headers can't be found by a few targets. * Uses pkg_check for DRM libraries like ROCR-Runtime does (which avoids accidental fallback to system versions). * Robust fix for nolink targets * nolink targets essentially exist for include directories * all nolink targets are automatically added to rocprofiler-sdk-headers with a $<BUILD_INTERFACE:...> generator expression * Re-add previously used mechanism to find drm libs --------- Co-authored-by: Marius Brehler <marius.brehler@amd.com> Co-authored-by: Stella Laurenzo <stellaraccident@gmail.com> Co-authored-by: Jonathan R. Madsen <jonathanrmadsen@gmail.com>
This commit is contained in:
@@ -252,35 +252,48 @@ rocprofiler_config_nolink_target(rocprofiler-sdk-hsakmt-nolink hsakmt::hsakmt)
|
|||||||
#
|
#
|
||||||
# ----------------------------------------------------------------------------------------#
|
# ----------------------------------------------------------------------------------------#
|
||||||
|
|
||||||
find_path(
|
find_package(PkgConfig)
|
||||||
drm_INCLUDE_DIR
|
|
||||||
NAMES drm.h
|
|
||||||
HINTS ${rocm_version_DIR} ${ROCM_PATH} /opt/amdgpu
|
|
||||||
PATHS ${rocm_version_DIR} ${ROCM_PATH} /opt/amdgpu
|
|
||||||
PATH_SUFFIXES include/drm include/libdrm include REQUIRED)
|
|
||||||
|
|
||||||
find_path(
|
if(PkgConfig_FOUND)
|
||||||
xf86drm_INCLUDE_DIR
|
pkg_check_modules(DRM REQUIRED IMPORTED_TARGET libdrm)
|
||||||
NAMES xf86drm.h
|
pkg_check_modules(DRM_AMDGPU REQUIRED IMPORTED_TARGET libdrm_amdgpu)
|
||||||
HINTS ${rocm_version_DIR} ${ROCM_PATH} /opt/amdgpu
|
|
||||||
PATHS ${rocm_version_DIR} ${ROCM_PATH} /opt/amdgpu
|
|
||||||
PATH_SUFFIXES include/drm include/libdrm include REQUIRED)
|
|
||||||
|
|
||||||
find_library(
|
target_include_directories(rocprofiler-sdk-drm SYSTEM
|
||||||
drm_LIBRARY
|
INTERFACE ${DRM_INCLUDE_DIRS} ${DRM_AMDGPU_INCLUDE_DIRS})
|
||||||
NAMES drm
|
target_link_libraries(rocprofiler-sdk-drm INTERFACE PkgConfig::DRM
|
||||||
HINTS ${rocm_version_DIR} ${ROCM_PATH} /opt/amdgpu
|
PkgConfig::DRM_AMDGPU)
|
||||||
PATHS ${rocm_version_DIR} ${ROCM_PATH} /opt/amdgpu REQUIRED)
|
else()
|
||||||
|
find_path(
|
||||||
|
drm_INCLUDE_DIR
|
||||||
|
NAMES drm.h
|
||||||
|
HINTS ${rocm_version_DIR} ${ROCM_PATH} /opt/amdgpu
|
||||||
|
PATHS ${rocm_version_DIR} ${ROCM_PATH} /opt/amdgpu
|
||||||
|
PATH_SUFFIXES include/drm include/libdrm include REQUIRED)
|
||||||
|
|
||||||
find_library(
|
find_path(
|
||||||
drm_amdgpu_LIBRARY
|
xf86drm_INCLUDE_DIR
|
||||||
NAMES drm_amdgpu
|
NAMES xf86drm.h
|
||||||
HINTS ${rocm_version_DIR} ${ROCM_PATH} /opt/amdgpu
|
HINTS ${rocm_version_DIR} ${ROCM_PATH} /opt/amdgpu
|
||||||
PATHS ${rocm_version_DIR} ${ROCM_PATH} /opt/amdgpu REQUIRED)
|
PATHS ${rocm_version_DIR} ${ROCM_PATH} /opt/amdgpu
|
||||||
|
PATH_SUFFIXES include/drm include/libdrm include REQUIRED)
|
||||||
|
|
||||||
target_include_directories(rocprofiler-sdk-drm SYSTEM INTERFACE ${drm_INCLUDE_DIR}
|
find_library(
|
||||||
${xf86drm_INCLUDE_DIR})
|
drm_LIBRARY
|
||||||
target_link_libraries(rocprofiler-sdk-drm INTERFACE ${drm_LIBRARY} ${drm_amdgpu_LIBRARY})
|
NAMES drm
|
||||||
|
HINTS ${rocm_version_DIR} ${ROCM_PATH} /opt/amdgpu
|
||||||
|
PATHS ${rocm_version_DIR} ${ROCM_PATH} /opt/amdgpu REQUIRED)
|
||||||
|
|
||||||
|
find_library(
|
||||||
|
drm_amdgpu_LIBRARY
|
||||||
|
NAMES drm_amdgpu
|
||||||
|
HINTS ${rocm_version_DIR} ${ROCM_PATH} /opt/amdgpu
|
||||||
|
PATHS ${rocm_version_DIR} ${ROCM_PATH} /opt/amdgpu REQUIRED)
|
||||||
|
|
||||||
|
target_include_directories(rocprofiler-sdk-drm SYSTEM
|
||||||
|
INTERFACE ${drm_INCLUDE_DIR} ${xf86drm_INCLUDE_DIR})
|
||||||
|
target_link_libraries(rocprofiler-sdk-drm INTERFACE ${drm_LIBRARY}
|
||||||
|
${drm_amdgpu_LIBRARY})
|
||||||
|
endif()
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------------------#
|
# ----------------------------------------------------------------------------------------#
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -92,21 +92,20 @@ rocprofiler_add_interface_library(rocprofiler-sdk-drm "drm (amdgpu) library" INT
|
|||||||
# runtime library
|
# runtime library
|
||||||
#
|
#
|
||||||
|
|
||||||
rocprofiler_add_interface_library(
|
rocprofiler_add_nolink_interface_library(
|
||||||
rocprofiler-sdk-hip-nolink "rocprofiler-sdk-hip without linking to HIP library"
|
rocprofiler-sdk-hip-nolink "rocprofiler-sdk-hip without linking to HIP library"
|
||||||
IMPORTED)
|
IMPORTED)
|
||||||
rocprofiler_add_interface_library(
|
rocprofiler_add_nolink_interface_library(
|
||||||
rocprofiler-sdk-hsa-runtime-nolink
|
rocprofiler-sdk-hsa-runtime-nolink
|
||||||
"rocprofiler-sdk-hsa-runtime without linking to HSA library" IMPORTED)
|
"rocprofiler-sdk-hsa-runtime without linking to HSA library" IMPORTED)
|
||||||
rocprofiler_add_interface_library(
|
rocprofiler_add_nolink_interface_library(
|
||||||
rocprofiler-sdk-hsakmt-nolink
|
rocprofiler-sdk-hsakmt-nolink
|
||||||
"rocprofiler-sdk-hsakmt without linking to HSAKMT library" IMPORTED)
|
"rocprofiler-sdk-hsakmt without linking to HSAKMT library" IMPORTED)
|
||||||
rocprofiler_add_interface_library(rocprofiler-sdk-rccl-nolink
|
rocprofiler_add_nolink_interface_library(
|
||||||
"RCCL headers without linking to RCCL library" IMPORTED)
|
rocprofiler-sdk-rccl-nolink "RCCL headers without linking to RCCL library" IMPORTED)
|
||||||
rocprofiler_add_interface_library(
|
rocprofiler_add_nolink_interface_library(
|
||||||
rocprofiler-sdk-rocdecode-nolink
|
rocprofiler-sdk-rocdecode-nolink
|
||||||
"ROCDECODE headers without linking to ROCDECODE library" IMPORTED)
|
"ROCDECODE headers without linking to ROCDECODE library" IMPORTED)
|
||||||
|
rocprofiler_add_nolink_interface_library(
|
||||||
rocprofiler_add_interface_library(
|
|
||||||
rocprofiler-sdk-rocjpeg-nolink "ROCJPEG headers without linking to ROCJPEG library"
|
rocprofiler-sdk-rocjpeg-nolink "ROCJPEG headers without linking to ROCJPEG library"
|
||||||
IMPORTED)
|
IMPORTED)
|
||||||
|
|||||||
@@ -350,6 +350,16 @@ function(ROCPROFILER_ADD_INTERFACE_LIBRARY _TARGET _DESCRIPT)
|
|||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------------------------#
|
||||||
|
# macro to add an interface lib for nolink targets
|
||||||
|
#
|
||||||
|
function(ROCPROFILER_ADD_NOLINK_INTERFACE_LIBRARY _TARGET _DESCRIPT)
|
||||||
|
rocprofiler_add_interface_library(${_TARGET} "${_DESCRIPT}" ${ARGN})
|
||||||
|
# this is a nolink target so it's include dirs, etc. should propagate to the headers
|
||||||
|
# target
|
||||||
|
target_link_libraries(rocprofiler-sdk-headers INTERFACE $<BUILD_INTERFACE:${_TARGET}>)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
# -----------------------------------------------------------------------
|
# -----------------------------------------------------------------------
|
||||||
# function add_feature(<NAME> <DOCSTRING>) Add a project feature, whose activation is
|
# function add_feature(<NAME> <DOCSTRING>) Add a project feature, whose activation is
|
||||||
# specified by the existence of the variable <NAME>, to the list of enabled/disabled
|
# specified by the existence of the variable <NAME>, to the list of enabled/disabled
|
||||||
|
|||||||
@@ -60,18 +60,12 @@ add_subdirectory(ompt)
|
|||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
rocprofiler-sdk-object-library
|
rocprofiler-sdk-object-library
|
||||||
PUBLIC rocprofiler-sdk::rocprofiler-sdk-headers
|
PUBLIC rocprofiler-sdk::rocprofiler-sdk-headers
|
||||||
rocprofiler-sdk::rocprofiler-sdk-hip-nolink
|
|
||||||
rocprofiler-sdk::rocprofiler-sdk-hsa-runtime-nolink
|
|
||||||
rocprofiler-sdk::rocprofiler-sdk-rccl-nolink
|
|
||||||
rocprofiler-sdk::rocprofiler-sdk-rocdecode-nolink
|
|
||||||
rocprofiler-sdk::rocprofiler-sdk-rocjpeg-nolink
|
|
||||||
PRIVATE rocprofiler-sdk::rocprofiler-sdk-build-flags
|
PRIVATE rocprofiler-sdk::rocprofiler-sdk-build-flags
|
||||||
rocprofiler-sdk::rocprofiler-sdk-memcheck
|
rocprofiler-sdk::rocprofiler-sdk-memcheck
|
||||||
rocprofiler-sdk::rocprofiler-sdk-common-library
|
rocprofiler-sdk::rocprofiler-sdk-common-library
|
||||||
rocprofiler-sdk::rocprofiler-sdk-amd-comgr
|
rocprofiler-sdk::rocprofiler-sdk-amd-comgr
|
||||||
rocprofiler-sdk::rocprofiler-sdk-hsa-aql
|
rocprofiler-sdk::rocprofiler-sdk-hsa-aql
|
||||||
rocprofiler-sdk::rocprofiler-sdk-drm
|
rocprofiler-sdk::rocprofiler-sdk-drm
|
||||||
rocprofiler-sdk::rocprofiler-sdk-hsakmt-nolink
|
|
||||||
rocprofiler-sdk::rocprofiler-sdk-dw)
|
rocprofiler-sdk::rocprofiler-sdk-dw)
|
||||||
|
|
||||||
target_compile_definitions(rocprofiler-sdk-object-library PRIVATE rocprofiler_EXPORTS=1)
|
target_compile_definitions(rocprofiler-sdk-object-library PRIVATE rocprofiler_EXPORTS=1)
|
||||||
@@ -95,12 +89,8 @@ target_sources(
|
|||||||
shared_library.cpp)
|
shared_library.cpp)
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
rocprofiler-sdk-shared-library
|
rocprofiler-sdk-shared-library
|
||||||
INTERFACE rocprofiler-sdk::rocprofiler-sdk-headers
|
PUBLIC rocprofiler-sdk::rocprofiler-sdk-headers
|
||||||
$<BUILD_INTERFACE:rocprofiler-sdk::rocprofiler-sdk-hsa-runtime-nolink>
|
PRIVATE rocprofiler-sdk::rocprofiler-sdk-build-flags
|
||||||
$<BUILD_INTERFACE:rocprofiler-sdk::rocprofiler-sdk-hip-nolink>
|
|
||||||
PRIVATE rocprofiler-sdk::rocprofiler-sdk-hsa-runtime-nolink
|
|
||||||
rocprofiler-sdk::rocprofiler-sdk-hip-nolink
|
|
||||||
rocprofiler-sdk::rocprofiler-sdk-build-flags
|
|
||||||
rocprofiler-sdk::rocprofiler-sdk-memcheck
|
rocprofiler-sdk::rocprofiler-sdk-memcheck
|
||||||
rocprofiler-sdk::rocprofiler-sdk-common-library
|
rocprofiler-sdk::rocprofiler-sdk-common-library
|
||||||
rocprofiler-sdk::rocprofiler-sdk-cxx-filesystem
|
rocprofiler-sdk::rocprofiler-sdk-cxx-filesystem
|
||||||
@@ -140,8 +130,6 @@ target_sources(rocprofiler-sdk-static-library
|
|||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
rocprofiler-sdk-static-library
|
rocprofiler-sdk-static-library
|
||||||
PUBLIC rocprofiler-sdk::rocprofiler-sdk-headers
|
PUBLIC rocprofiler-sdk::rocprofiler-sdk-headers
|
||||||
rocprofiler-sdk::rocprofiler-sdk-hsa-runtime-nolink
|
|
||||||
rocprofiler-sdk::rocprofiler-sdk-hip-nolink
|
|
||||||
$<BUILD_INTERFACE:rocprofiler-sdk::rocprofiler-sdk-dw>
|
$<BUILD_INTERFACE:rocprofiler-sdk::rocprofiler-sdk-dw>
|
||||||
PRIVATE rocprofiler-sdk::rocprofiler-sdk-common-library
|
PRIVATE rocprofiler-sdk::rocprofiler-sdk-common-library
|
||||||
rocprofiler-sdk::rocprofiler-sdk-object-library)
|
rocprofiler-sdk::rocprofiler-sdk-object-library)
|
||||||
|
|||||||
Reference in New Issue
Block a user