Manually search for rocdecode and rocjpeg libraries in cmake (#294)

* Manually search for rocdecode ad rocjpeg libraries

* Update examples/jpegdecode/CMakeLists.txt

Fix typo.

Co-authored-by: David Galiffi <David.Galiffi@amd.com>

---------

Co-authored-by: David Galiffi <David.Galiffi@amd.com>

[ROCm/rocprofiler-systems commit: f4e9846e1c]
Этот коммит содержится в:
Sajina PK
2025-07-21 14:07:00 -04:00
коммит произвёл GitHub
родитель 1a57db0395
Коммит aa9b265302
2 изменённых файлов: 86 добавлений и 6 удалений
+44 -4
Просмотреть файл
@@ -60,7 +60,47 @@ if(ROCPROFSYS_DISABLE_EXAMPLES)
endif()
endif()
find_package(rocjpeg QUIET)
# find rocJPEG - library and headers
find_path(
rocjpeg_ROOT_DIR
NAMES include/rocjpeg/rocjpeg.h
HINTS ${ROCmVersion_DIR} ${ROCM_PATH}
PATHS ${ROCmVersion_DIR} ${ROCM_PATH}
)
mark_as_advanced(rocjpeg_ROOT_DIR)
find_path(
rocjpeg_INCLUDE_DIR
NAMES rocjpeg/rocjpeg.h
HINTS ${rocjpeg_ROOT_DIR}
PATHS ${rocjpeg_ROOT_DIR}
PATH_SUFFIXES include
)
find_library(
rocjpeg_LIBRARY
NAMES rocjpeg
HINTS ${rocjpeg_ROOT_DIR}
PATHS ${rocjpeg_ROOT_DIR}
PATH_SUFFIXES lib
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
rocjpeg
FOUND_VAR rocjpeg_FOUND
REQUIRED_VARS rocjpeg_INCLUDE_DIR rocjpeg_LIBRARY
)
if(rocjpeg_FOUND)
if(NOT TARGET rocjpeg::rocjpeg)
add_library(rocjpeg::rocjpeg INTERFACE IMPORTED)
target_link_libraries(rocjpeg::rocjpeg INTERFACE ${rocjpeg_LIBRARY})
target_include_directories(rocjpeg::rocjpeg INTERFACE ${rocjpeg_INCLUDE_DIR})
endif()
endif()
find_package(rocprofiler-register QUIET)
# Copy image files to build directory
@@ -107,7 +147,7 @@ if(HIP_FOUND AND rocjpeg_FOUND AND Threads_FOUND AND rocprofiler-register_FOUND)
set(LINK_LIBRARY_LIST ${LINK_LIBRARY_LIST} rocprofiler-register::rocprofiler-register)
# rocJPEG
message(STATUS "RocJPEG library found: ${rocjpeg_LIBRARIES}")
message(STATUS "RocJPEG library found: ${rocjpeg_LIBRARY}")
include_directories(${rocjpeg_INCLUDE_DIR})
set(LINK_LIBRARY_LIST ${LINK_LIBRARY_LIST} rocjpeg::rocjpeg)
list(APPEND SOURCES ${PROJECT_SOURCE_DIR} jpegdecodeperf.cpp)
@@ -136,11 +176,11 @@ else()
message(WARNING "-- ERROR!: rocJPEG Not Found! - please install rocJPEG!")
endif()
if(NOT Threads_FOUND)
message(FATAL_ERROR "-- ERROR!: Threads Not Found! - please insatll Threads!")
message(WARNING "-- ERROR!: Threads Not Found! - please install Threads!")
endif()
if(NOT rocprofiler-register_FOUND)
message(
FATAL_ERROR
WARNING
"-- ERROR!: rocprofiler-register Not Found! - please install rocprofiler-register!"
)
endif()
+42 -2
Просмотреть файл
@@ -54,8 +54,48 @@ function(videodecode_message _MSG_TYPE)
endfunction()
# Find RocDecode
find_package(rocdecode QUIET)
if(NOT rocdecode_FOUND)
find_path(
rocdecode_ROOT_DIR
NAMES include/rocdecode/rocdecode.h
HINTS ${ROCmVersion_DIR} ${ROCM_PATH}
PATHS ${ROCmVersion_DIR} ${ROCM_PATH}
)
mark_as_advanced(rocdecode_ROOT_DIR)
find_path(
rocdecode_INCLUDE_DIR
NAMES rocdecode/rocdecode.h
HINTS ${rocdecode_ROOT_DIR}
PATHS ${rocdecode_ROOT_DIR}
PATH_SUFFIXES include
)
find_library(
rocdecode_LIBRARY
NAMES rocdecode
HINTS ${rocdecode_ROOT_DIR}
PATHS ${rocdecode_ROOT_DIR}
PATH_SUFFIXES lib
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
rocdecode
FOUND_VAR rocdecode_FOUND
REQUIRED_VARS rocdecode_INCLUDE_DIR rocdecode_LIBRARY
)
if(rocdecode_FOUND)
if(NOT TARGET rocdecode::rocdecode)
add_library(rocdecode::rocdecode INTERFACE IMPORTED)
target_link_libraries(rocdecode::rocdecode INTERFACE ${rocdecode_LIBRARY})
target_include_directories(
rocdecode::rocdecode
INTERFACE ${rocdecode_INCLUDE_DIR}
)
endif()
else()
videodecode_message(AUTHOR_WARNING "${PROJECT_NAME} skipped. Missing RocDecode...")
return()
endif()