CMake - Add support for explicitly linking libdrm_amdgpu with rocjpeg (#152)
* CMake - Add support for explicitly linking libdrm_amdgpu with rocjpeg
* clean up
* Add comment
[ROCm/rocjpeg commit: 95d173ee88]
This commit is contained in:
gecommit door
GitHub
bovenliggende
a7ad89e643
commit
d7cf439038
@@ -3,7 +3,7 @@
|
||||
Documentation for rocJPEG is available at
|
||||
[https://rocm.docs.amd.com/projects/rocJPEG/en/latest/](https://rocm.docs.amd.com/projects/rocJPEG/en/latest/)
|
||||
|
||||
## rocJPEG 0.12.1 for ROCm 6.5
|
||||
## rocJPEG 0.12.2 (unreleased)
|
||||
|
||||
## Added
|
||||
* cmake config files
|
||||
@@ -12,6 +12,7 @@ Documentation for rocJPEG is available at
|
||||
## Changed
|
||||
* Readme - cleanup and updates to pre-reqs
|
||||
* The `decode_params` argument of the `rocJpegDecodeBatched` API is now an array of `RocJpegDecodeParams` structs representing the decode parameters for the batch of JPEG images.
|
||||
* `libdrm_amdgpu` is now explicitly linked with rocJPEG.
|
||||
|
||||
## Removed
|
||||
* Dev Package - No longer installs pkg-config
|
||||
|
||||
@@ -42,7 +42,7 @@ endif()
|
||||
|
||||
# rocJPEG Version
|
||||
# NOTE: package version and rocjpeg_version.h is generated with this version
|
||||
set(VERSION "0.12.1")
|
||||
set(VERSION "0.12.2")
|
||||
|
||||
# Set Project Version and Language
|
||||
project(rocjpeg VERSION ${VERSION} LANGUAGES CXX)
|
||||
@@ -135,6 +135,7 @@ option(ROCJPEG_ENABLE_ROCPROFILER_REGISTER "Enable rocprofiler-register support"
|
||||
|
||||
find_package(HIP QUIET)
|
||||
find_package(Libva QUIET)
|
||||
find_package(Libdrm_amdgpu QUIET)
|
||||
|
||||
if(ROCJPEG_ENABLE_ROCPROFILER_REGISTER)
|
||||
find_package(rocprofiler-register QUIET
|
||||
@@ -142,13 +143,16 @@ if(ROCJPEG_ENABLE_ROCPROFILER_REGISTER)
|
||||
PATHS ${ROCM_PATH})
|
||||
endif()
|
||||
|
||||
if(HIP_FOUND AND Libva_FOUND)
|
||||
if(HIP_FOUND AND Libva_FOUND AND Libdrm_amdgpu_FOUND)
|
||||
# HIP
|
||||
set(LINK_LIBRARY_LIST ${LINK_LIBRARY_LIST} hip::device)
|
||||
# LibVA
|
||||
include_directories(${LIBVA_INCLUDE_DIR})
|
||||
set(LINK_LIBRARY_LIST ${LINK_LIBRARY_LIST} ${LIBVA_LIBRARY})
|
||||
set(LINK_LIBRARY_LIST ${LINK_LIBRARY_LIST} ${LIBVA_DRM_LIBRARY})
|
||||
# DRM_AMDGPU
|
||||
include_directories(${LIBDRM_AMDGPU_INCLUDE_DIR})
|
||||
set(LINK_LIBRARY_LIST ${LINK_LIBRARY_LIST} ${LIBDRM_AMDGPU_LIBRARY})
|
||||
|
||||
# rocprofiler
|
||||
if(rocprofiler-register_FOUND)
|
||||
@@ -183,13 +187,6 @@ if(HIP_FOUND AND Libva_FOUND)
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX)
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR})
|
||||
|
||||
# DRM
|
||||
find_path(AMDGPU_DRM_INCLUDE_DIRS libdrm/amdgpu.h
|
||||
PATHS /opt/amdgpu/include /usr/include /usr/ /usr/local/include
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${AMDGPU_DRM_INCLUDE_DIRS})
|
||||
|
||||
# rocprofiler
|
||||
if(rocprofiler-register_FOUND)
|
||||
string(REPLACE "." ";" VERSION_LIST ${VERSION})
|
||||
@@ -447,4 +444,7 @@ else()
|
||||
if(NOT Libva_FOUND)
|
||||
message(FATAL_ERROR "-- ERROR!: libva Not Found - please install libva-amdgpu-dev(DEBIAN)/libva-amdgpu-devel(RPM) package!")
|
||||
endif()
|
||||
if(NOT Libdrm_amdgpu_FOUND)
|
||||
message(FATAL_ERROR "-- ERROR!: libdrm_amdgpu Not Found - please install libdrm-amdgpu-dev(DEBIAN)/libdrm-amdgpu-devel(RPM) package!")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
################################################################################
|
||||
# Copyright (c) 2024 - 2025 Advanced Micro Devices, Inc.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
find_library(LIBDRM_AMDGPU_LIBRARY NAMES drm_amdgpu HINTS /opt/amdgpu/lib/x86_64-linux-gnu /opt/amdgpu/lib64 /usr/lib/x86_64-linux-gnu /usr/lib64)
|
||||
find_path(LIBDRM_AMDGPU_INCLUDE_DIR NAMES libdrm/amdgpu.h libdrm/amdgpu_drm.h PATHS /opt/amdgpu/include /usr/include /usr/ /usr/local/include NO_DEFAULT_PATH)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Libdrm_amdgpu DEFAULT_MSG LIBDRM_AMDGPU_INCLUDE_DIR LIBDRM_AMDGPU_LIBRARY)
|
||||
mark_as_advanced(LIBDRM_AMDGPU_INCLUDE_DIR LIBDRM_AMDGPU_LIBRARY)
|
||||
|
||||
if(Libdrm_amdgpu_FOUND)
|
||||
if(NOT TARGET Libdrm_amdgpu::drm_amdgpu)
|
||||
add_library(Libdrm_amdgpu::drm_amdgpu UNKNOWN IMPORTED)
|
||||
set_target_properties(Libdrm_amdgpu::drm_amdgpu PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LIBDRM_AMDGPU_INCLUDE_DIR}"
|
||||
IMPORTED_LOCATION "${LIBDRM_AMDGPU_LIBRARY}")
|
||||
endif()
|
||||
message("-- ${White}Using Libdrm_amdgpu -- \n\tLibraries:${LIBDRM_AMDGPU_LIBRARY} \n\tIncludes:${LIBDRM_AMDGPU_INCLUDE_DIR} ${ColourReset}")
|
||||
else()
|
||||
if(Libdrm_amdgpu_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "{Red}FindLibdrm_amdgpu -- Libdrm_admgpu NOT FOUND${ColourReset}")
|
||||
endif()
|
||||
endif()
|
||||
Verwijs in nieuw issue
Block a user