From 6b026af1511265c29ec8ecebcc375098aa340d8a Mon Sep 17 00:00:00 2001 From: Kiriti Gowda Date: Mon, 17 Mar 2025 11:38:01 -0500 Subject: [PATCH] CMake config - updates and fixes (#532) * CMake Config - updates and fixes * Version - Updates * Changelog - updates * Update CHANGELOG.md Co-authored-by: spolifroni-amd --------- Co-authored-by: spolifroni-amd --- .Doxyfile | 4 +- .gitignore | 3 +- CHANGELOG.md | 3 +- CMakeLists.txt | 57 +++++++++++++- api/amd_detail/rocdecode_api_trace.h | 6 +- api/{ => rocdecode}/roc_bitstream_reader.h | 2 +- api/{ => rocdecode}/rocdecode.h | 1 - api/{ => rocdecode}/rocparser.h | 2 +- ...ecode_version.h => rocdecode_version.h.in} | 19 +++-- cmake/FindrocDecode.cmake | 77 ------------------- cmake_modules/rocdecode-config.cmake.in | 22 ++++++ docs/doxygen/Doxyfile | 4 +- samples/videoDecode/CMakeLists.txt | 8 +- samples/videoDecode/videodecode.cpp | 2 +- samples/videoDecodeBatch/CMakeLists.txt | 6 +- samples/videoDecodeMem/CMakeLists.txt | 6 +- samples/videoDecodeMultiFiles/CMakeLists.txt | 6 +- samples/videoDecodePerf/CMakeLists.txt | 6 +- samples/videoDecodePicFiles/CMakeLists.txt | 8 +- .../videodecodepicfiles.cpp | 2 +- samples/videoDecodeRGB/CMakeLists.txt | 6 +- samples/videoDecodeRaw/CMakeLists.txt | 4 +- samples/videoDecodeRaw/videodecoderaw.cpp | 2 +- samples/videoToSequence/CMakeLists.txt | 6 +- src/bit_stream_reader/bs_reader_handle.h | 2 +- src/bit_stream_reader/es_reader.h | 2 +- src/parser/parser_handle.h | 2 +- src/parser/roc_video_parser.h | 2 +- src/rocdecode/roc_decoder.h | 2 +- src/rocdecode/rocdecode_api.cpp | 2 +- src/rocdecode/vaapi/vaapi_videodecoder.h | 2 +- test/CMakeLists.txt | 22 ++++-- utils/rocvideodecode/roc_video_dec.h | 4 +- utils/video_demuxer.h | 2 +- 34 files changed, 154 insertions(+), 150 deletions(-) rename api/{ => rocdecode}/roc_bitstream_reader.h (99%) rename api/{ => rocdecode}/rocdecode.h (99%) rename api/{ => rocdecode}/rocparser.h (99%) rename api/{rocdecode_version.h => rocdecode_version.h.in} (81%) delete mode 100644 cmake/FindrocDecode.cmake create mode 100644 cmake_modules/rocdecode-config.cmake.in diff --git a/.Doxyfile b/.Doxyfile index 1c63bf66c8..0459f1a1f1 100644 --- a/.Doxyfile +++ b/.Doxyfile @@ -944,8 +944,8 @@ WARN_LOGFILE = # Note: If this tag is empty the current directory is searched. INPUT = README.md \ - api/rocDecode.h \ - api/rocparser.h \ + api/rocdecode/rocdecode.h \ + api/rocdecode/rocparser.h \ utils/rocvideodecode/roc_video_dec.h \ utils/video_demuxer.h diff --git a/.gitignore b/.gitignore index c78f4006be..253c46a32c 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ build/ samples/*/build .vscode/ doxygen_output* -samples/videoDecodeMultiFiles/example.txt \ No newline at end of file +samples/videoDecodeMultiFiles/example.txt +api/rocdecode_version.h \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 28e5703850..2e84d44ae8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ Full documentation for rocDecode is available at [https://rocm.docs.amd.com/projects/rocDecode/en/latest/](https://rocm.docs.amd.com/projects/rocDecode/en/latest/) -## (Unreleased) rocDecode 0.11.1 +## rocDecode 0.12.0 for ROCm 6.5 ### Added @@ -10,6 +10,7 @@ Full documentation for rocDecode is available at [https://rocm.docs.amd.com/proj * CTest for VP9 decode on bitstream reader. * HEVC stream syntax error handling. * HEVC stream bit depth change handling through decoder reconfiguration. +* rocDecode now uses the Cmake CMAKE_PREFIX_PATH directive. ### Changed diff --git a/CMakeLists.txt b/CMakeLists.txt index 014cf03cb9..9f7dcf2159 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,8 +38,8 @@ endif() set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED On) -# NOTE: Match version with api/rocdecode_version.h -set(VERSION "0.11.1") +# rocDecode Version +set(VERSION "0.12.0") # Set Project Version and Language project(rocdecode VERSION ${VERSION} LANGUAGES CXX) @@ -80,7 +80,7 @@ message("-- ${BoldBlue}rocDecode Version -- ${VERSION}${ColourReset}") message("-- ${BoldBlue}rocDecode Install Path -- ${CMAKE_INSTALL_PREFIX}${ColourReset}") list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) -list(APPEND CMAKE_PREFIX_PATH ${ROCM_PATH} ${ROCM_PATH}/hip) +list(APPEND CMAKE_PREFIX_PATH ${ROCM_PATH}/lib/cmake) # rocDecode Build Type if(NOT CMAKE_BUILD_TYPE) @@ -151,12 +151,18 @@ if(HIP_FOUND AND Libva_FOUND) ROCDECODE_ROCP_REG_VERSION_PATCH=${VERSION_PATCH}) endif() + #Generate BUILD_INFO + configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/api/rocdecode_version.h.in ${CMAKE_CURRENT_BINARY_DIR}/rocdecode_version.h @ONLY ) + install(TARGETS ${PROJECT_NAME} EXPORT rocdecode-targets DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT dev) + # install rocDecode libs -- {ROCM_PATH}/lib install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT runtime NAMELINK_SKIP) install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT dev NAMELINK_ONLY) install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT asan) # install rocDecode include files -- {ROCM_PATH}/include/rocdecode - install(FILES api/rocdecode.h api/rocparser.h api/roc_bitstream_reader.h api/rocdecode_version.h + install(FILES api/rocdecode/rocdecode.h api/rocdecode/rocparser.h api/rocdecode/roc_bitstream_reader.h + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME} COMPONENT dev) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/rocdecode_version.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME} COMPONENT dev) # install rocDecode api trace include file -- {ROCM_PATH}/include/rocdecode/amd_detail install(FILES api/amd_detail/rocdecode_api_trace.h @@ -192,6 +198,49 @@ if(HIP_FOUND AND Libva_FOUND) message("-- ${White}AMD ROCm rocDecode -- CMAKE_CXX_FLAGS:${CMAKE_CXX_FLAGS}${ColourReset}") message("-- ${White}AMD ROCm rocDecode -- Link Libraries: ${LINK_LIBRARY_LIST}${ColourReset}") + ## Cmake module config file configurations + set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/" CACHE INTERNAL "Default module path.") + + ## Export the package for use from the build-tree + ## (this registers the build-tree with a global CMake-registry) + export(PACKAGE ${PROJECT_NAME}) + set(CONF_LIB_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") + + ## Create the rocdecode-config.cmake and rocdecode-config-version files + include(CMakePackageConfigHelpers) + set(CONFIG_PACKAGE_INSTALL_DIR ${CONF_LIB_DIR}/cmake/${PROJECT_NAME}) + set(LIB_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}") + set(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}") + set(BIN_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}") + + ## Generate Config File for rocdecode + configure_package_config_file( + ${CMAKE_MODULE_PATH}/${PROJECT_NAME}-config.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake + INSTALL_DESTINATION ${CONFIG_PACKAGE_INSTALL_DIR} + PATH_VARS LIB_INSTALL_DIR INCLUDE_INSTALL_DIR BIN_INSTALL_DIR + ) + + ## Generate config Version File for rocdecode + write_basic_package_version_file( + ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake + VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}" + COMPATIBILITY SameMajorVersion + ) + + ## Install the rocdecode-config.cmake and rocdecode-config-version.cmake + install(FILES + "${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config.cmake" + "${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake" + DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" + COMPONENT dev + ) + + ## Install the export set for use with the install-tree + install(EXPORT rocdecode-targets DESTINATION + "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" COMPONENT dev + ) + # make test with CTest enable_testing() include(CTest) diff --git a/api/amd_detail/rocdecode_api_trace.h b/api/amd_detail/rocdecode_api_trace.h index 329798e445..473d6c950c 100644 --- a/api/amd_detail/rocdecode_api_trace.h +++ b/api/amd_detail/rocdecode_api_trace.h @@ -21,9 +21,9 @@ THE SOFTWARE. */ #pragma once -#include "rocdecode.h" -#include "rocparser.h" -#include "roc_bitstream_reader.h" +#include "rocdecode/rocdecode.h" +#include "rocdecode/rocparser.h" +#include "rocdecode/roc_bitstream_reader.h" // Define version macros for the rocDecode API dispatch table, specifying the MAJOR and STEP versions. // diff --git a/api/roc_bitstream_reader.h b/api/rocdecode/roc_bitstream_reader.h similarity index 99% rename from api/roc_bitstream_reader.h rename to api/rocdecode/roc_bitstream_reader.h index e4e14d7c77..eeae7e2fb1 100644 --- a/api/roc_bitstream_reader.h +++ b/api/rocdecode/roc_bitstream_reader.h @@ -22,7 +22,7 @@ THE SOFTWARE. #pragma once -#include "rocdecode.h" +#include "rocdecode/rocdecode.h" /*! * \file diff --git a/api/rocdecode.h b/api/rocdecode/rocdecode.h similarity index 99% rename from api/rocdecode.h rename to api/rocdecode/rocdecode.h index 2151617e7e..fcaca22859 100644 --- a/api/rocdecode.h +++ b/api/rocdecode/rocdecode.h @@ -30,7 +30,6 @@ THE SOFTWARE. #pragma once #include "hip/hip_runtime.h" -#include "rocdecode_version.h" /*! * \file diff --git a/api/rocparser.h b/api/rocdecode/rocparser.h similarity index 99% rename from api/rocparser.h rename to api/rocdecode/rocparser.h index 431a1a00b4..e725dc125a 100644 --- a/api/rocparser.h +++ b/api/rocdecode/rocparser.h @@ -22,7 +22,7 @@ THE SOFTWARE. #pragma once -#include "rocdecode.h" +#include "rocdecode/rocdecode.h" /*! * \file diff --git a/api/rocdecode_version.h b/api/rocdecode_version.h.in similarity index 81% rename from api/rocdecode_version.h rename to api/rocdecode_version.h.in index 1ac8dfb56f..656432e24b 100644 --- a/api/rocdecode_version.h +++ b/api/rocdecode_version.h.in @@ -20,8 +20,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#ifndef ROCDECODE_VERSION_H -#define ROCDECODE_VERSION_H +#ifndef _ROCDECODE_VERSION_H_ +#define _ROCDECODE_VERSION_H_ /*! * \file @@ -32,12 +32,11 @@ THE SOFTWARE. #ifdef __cplusplus extern "C" { -#endif -/* NOTE: Match version with CMakeLists.txt */ -#define ROCDECODE_MAJOR_VERSION 0 -#define ROCDECODE_MINOR_VERSION 11 -#define ROCDECODE_MICRO_VERSION 1 +#endif /* __cplusplus */ +#define ROCDECODE_MAJOR_VERSION @PROJECT_VERSION_MAJOR@ +#define ROCDECODE_MINOR_VERSION @PROJECT_VERSION_MINOR@ +#define ROCDECODE_MICRO_VERSION @PROJECT_VERSION_PATCH@ /** * ROCDECODE_CHECK_VERSION: @@ -45,7 +44,7 @@ extern "C" { * @minor: minor version, like 2 in 1.2.3 * @micro: micro version, like 3 in 1.2.3 * - * Evaluates to %TRUE if the version of rocDecode is greater than + * Evaluates to %TRUE if the version of ROCDECODE is greater than * @major, @minor and @micro */ #define ROCDECODE_CHECK_VERSION(major, minor, micro) \ @@ -54,7 +53,7 @@ extern "C" { (ROCDECODE_MAJOR_VERSION == (major) && ROCDECODE_MINOR_VERSION == (minor) && ROCDECODE_MICRO_VERSION >= (micro))) #ifdef __cplusplus -} +} // end extern "C" block #endif -#endif \ No newline at end of file +#endif //_ROCDECODE_VERSION_H_ header guard diff --git a/cmake/FindrocDecode.cmake b/cmake/FindrocDecode.cmake deleted file mode 100644 index 2b2329f4ed..0000000000 --- a/cmake/FindrocDecode.cmake +++ /dev/null @@ -1,77 +0,0 @@ -################################################################################ -# Copyright (c) 2023 - 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. -# -################################################################################ - -# ROCM Path -if(ROCM_PATH) - message("-- ${White}FindrocDecode: ROCM_PATH Set -- ${ROCM_PATH}${ColourReset}") -else() - set(ROCM_PATH /opt/rocm CACHE PATH "Default ROCm installation path") -endif() - -# find rocDecode - library and headers -find_path(ROCDECODE_INCLUDE_DIR NAMES rocdecode.h PATHS ${ROCM_PATH}/include/rocdecode) -find_library(ROCDECODE_LIBRARY NAMES rocdecode HINTS ${ROCM_PATH}/lib) -mark_as_advanced(ROCDECODE_INCLUDE_DIR) -mark_as_advanced(ROCDECODE_LIBRARY) - -if(ROCDECODE_INCLUDE_DIR AND ROCDECODE_LIBRARY) - message("-- ${White}FindrocDecode -- Using rocDecode: \n\tIncludes:${ROCDECODE_INCLUDE_DIR}\n\tLib:${ROCDECODE_LIBRARY}${ColourReset}") - set(ROCDECODE_FOUND TRUE) -else() - if(rocDecode_FIND_REQUIRED) - message(FATAL_ERROR "FindrocDecode -- Failed to find rocDecode Library") - endif() - message( "-- ${Yellow}NOTE: FindrocDecode failed to find rocDecode -- INSTALL rocDecode${ColourReset}" ) -endif() - -if(ROCDECODE_FOUND) - # Find rocDecode Version - file(READ "${ROCDECODE_INCLUDE_DIR}/rocdecode_version.h" ROCDECODE_VERSION_FILE) - string(REGEX MATCH "ROCDECODE_MAJOR_VERSION ([0-9]*)" _ ${ROCDECODE_VERSION_FILE}) - set(ROCDECODE_VER_MAJOR ${CMAKE_MATCH_1}) - string(REGEX MATCH "ROCDECODE_MINOR_VERSION ([0-9]*)" _ ${ROCDECODE_VERSION_FILE}) - set(ROCDECODE_VER_MINOR ${CMAKE_MATCH_1}) - string(REGEX MATCH "ROCDECODE_MICRO_VERSION ([0-9]*)" _ ${ROCDECODE_VERSION_FILE}) - set(ROCDECODE_VER_MICRO ${CMAKE_MATCH_1}) - message("-- ${White}Found rocDecode Version: ${ROCDECODE_VER_MAJOR}.${ROCDECODE_VER_MINOR}.${ROCDECODE_VER_MICRO}${ColourReset}") - mark_as_advanced(ROCDECODE_VER_MAJOR) - mark_as_advanced(ROCDECODE_VER_MINOR) - mark_as_advanced(ROCDECODE_VER_MICRO) -endif() - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args( - rocDecode - FOUND_VAR - ROCDECODE_FOUND - REQUIRED_VARS - ROCDECODE_INCLUDE_DIR - ROCDECODE_LIBRARY -) - -set(ROCDECODE_FOUND ${ROCDECODE_FOUND} CACHE INTERNAL "") -set(ROCDECODE_INCLUDE_DIR ${ROCDECODE_INCLUDE_DIR} CACHE INTERNAL "") -set(ROCDECODE_LIBRARY ${ROCDECODE_LIBRARY} CACHE INTERNAL "") -set(ROCDECODE_VER_MAJOR ${ROCDECODE_VER_MAJOR} CACHE INTERNAL "") -set(ROCDECODE_VER_MINOR ${ROCDECODE_VER_MINOR} CACHE INTERNAL "") -set(ROCDECODE_VER_MICRO ${ROCDECODE_VER_MICRO} CACHE INTERNAL "") diff --git a/cmake_modules/rocdecode-config.cmake.in b/cmake_modules/rocdecode-config.cmake.in new file mode 100644 index 0000000000..9bacb01199 --- /dev/null +++ b/cmake_modules/rocdecode-config.cmake.in @@ -0,0 +1,22 @@ +# - Config file for the rocdecode package +# It defines the following variables +# ROCDECODE_INCLUDE_DIR - include directory for rocdecode +# ROCDECODE_LIB_DIR - library directory for rocdecode +# ROCDECODE_LIBRARY - library to link against + +@PACKAGE_INIT@ + +# Compute paths +set_and_check(rocdecode_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@") +set_and_check(ROCDECODE_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@") +set_and_check(rocDecode_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@") +set_and_check(rocdecode_LIB_DIR "@PACKAGE_LIB_INSTALL_DIR@") +set_and_check(ROCDECODE_LIB_DIR "@PACKAGE_LIB_INSTALL_DIR@") +set_and_check(rocDecode_LIB_DIR "@PACKAGE_LIB_INSTALL_DIR@") +set_and_check(rocdecode_LIBRARY "@PACKAGE_LIB_INSTALL_DIR@/librocdecode.so") +set_and_check(ROCDECODE_LIBRARY "@PACKAGE_LIB_INSTALL_DIR@/librocdecode.so") +set_and_check(rocDecode_LIBRARY "@PACKAGE_LIB_INSTALL_DIR@/librocdecode.so") + + +get_filename_component(ROCDECODE_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) +include("${ROCDECODE_CMAKE_DIR}/rocdecode-targets.cmake") diff --git a/docs/doxygen/Doxyfile b/docs/doxygen/Doxyfile index 3ca36deac4..b0aac51799 100644 --- a/docs/doxygen/Doxyfile +++ b/docs/doxygen/Doxyfile @@ -944,8 +944,8 @@ WARN_LOGFILE = # Note: If this tag is empty the current directory is searched. INPUT = ../reference/index.md \ - ../../api/rocdecode.h \ - ../../api/rocparser.h \ + ../../api/rocdecode/rocdecode.h \ + ../../api/rocdecode/rocparser.h \ ../../utils/rocvideodecode/roc_video_dec.h \ ../../utils/video_demuxer.h diff --git a/samples/videoDecode/CMakeLists.txt b/samples/videoDecode/CMakeLists.txt index 0fd52772a1..87821b833a 100644 --- a/samples/videoDecode/CMakeLists.txt +++ b/samples/videoDecode/CMakeLists.txt @@ -41,7 +41,7 @@ set(CMAKE_CXX_STANDARD 17) project(videodecode) list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../../cmake) -list(APPEND CMAKE_PREFIX_PATH ${ROCM_PATH}/hip ${ROCM_PATH}) +list(APPEND CMAKE_PREFIX_PATH ${ROCM_PATH}/lib/cmake) # rocDecode sample build type set(DEFAULT_BUILD_TYPE "Release") @@ -61,10 +61,10 @@ else() endif() find_package(HIP QUIET) -find_package(FFmpeg QUIET) -find_package(rocDecode QUIET) -find_package(Threads REQUIRED) +find_package(ROCDECODE QUIET) find_package(rocprofiler-register QUIET) +find_package(FFmpeg QUIET) +find_package(Threads REQUIRED) if(HIP_FOUND AND FFMPEG_FOUND AND ROCDECODE_FOUND AND Threads_FOUND AND rocprofiler-register_FOUND) # HIP diff --git a/samples/videoDecode/videodecode.cpp b/samples/videoDecode/videodecode.cpp index 472b9c9cb6..56f85ed7b7 100644 --- a/samples/videoDecode/videodecode.cpp +++ b/samples/videoDecode/videodecode.cpp @@ -37,7 +37,7 @@ THE SOFTWARE. #include #endif #include "video_demuxer.h" -#include "roc_bitstream_reader.h" +#include "rocdecode/roc_bitstream_reader.h" #include "roc_video_dec.h" #include "ffmpeg_video_dec.h" #include "common.h" diff --git a/samples/videoDecodeBatch/CMakeLists.txt b/samples/videoDecodeBatch/CMakeLists.txt index 2578460e1c..4b85d84736 100644 --- a/samples/videoDecodeBatch/CMakeLists.txt +++ b/samples/videoDecodeBatch/CMakeLists.txt @@ -41,7 +41,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED On) project(videodecodebatch) list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../../cmake) -list(APPEND CMAKE_PREFIX_PATH ${ROCM_PATH}/hip ${ROCM_PATH}) +list(APPEND CMAKE_PREFIX_PATH ${ROCM_PATH}/lib/cmake) # rocDecode sample build type set(DEFAULT_BUILD_TYPE "Release") @@ -61,9 +61,9 @@ else() endif() find_package(HIP QUIET) -find_package(FFmpeg QUIET) -find_package(rocDecode QUIET) +find_package(ROCDECODE QUIET) find_package(rocprofiler-register QUIET) +find_package(FFmpeg QUIET) if(HIP_FOUND AND FFMPEG_FOUND AND ROCDECODE_FOUND AND rocprofiler-register_FOUND) # HIP diff --git a/samples/videoDecodeMem/CMakeLists.txt b/samples/videoDecodeMem/CMakeLists.txt index e2320e0244..9863ef7a69 100644 --- a/samples/videoDecodeMem/CMakeLists.txt +++ b/samples/videoDecodeMem/CMakeLists.txt @@ -42,7 +42,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED On) project(videodecodemem) list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../../cmake) -list(APPEND CMAKE_PREFIX_PATH ${ROCM_PATH}/hip ${ROCM_PATH}) +list(APPEND CMAKE_PREFIX_PATH ${ROCM_PATH}/lib/cmake) # rocDecode sample build type set(DEFAULT_BUILD_TYPE "Release") @@ -62,9 +62,9 @@ else() endif() find_package(HIP QUIET) -find_package(FFmpeg QUIET) -find_package(rocDecode QUIET) +find_package(ROCDECODE QUIET) find_package(rocprofiler-register QUIET) +find_package(FFmpeg QUIET) if(HIP_FOUND AND FFMPEG_FOUND AND ROCDECODE_FOUND AND rocprofiler-register_FOUND) # HIP diff --git a/samples/videoDecodeMultiFiles/CMakeLists.txt b/samples/videoDecodeMultiFiles/CMakeLists.txt index 7dcd8abc61..ffa863471e 100644 --- a/samples/videoDecodeMultiFiles/CMakeLists.txt +++ b/samples/videoDecodeMultiFiles/CMakeLists.txt @@ -41,7 +41,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED On) project(videodecodemultifiles) list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../../cmake) -list(APPEND CMAKE_PREFIX_PATH ${ROCM_PATH}/hip ${ROCM_PATH}) +list(APPEND CMAKE_PREFIX_PATH ${ROCM_PATH}/lib/cmake) # rocDecode sample build type set(DEFAULT_BUILD_TYPE "Release") @@ -61,9 +61,9 @@ else() endif() find_package(HIP QUIET) -find_package(FFmpeg QUIET) -find_package(rocDecode QUIET) +find_package(ROCDECODE QUIET) find_package(rocprofiler-register QUIET) +find_package(FFmpeg QUIET) if(HIP_FOUND AND FFMPEG_FOUND AND ROCDECODE_FOUND AND rocprofiler-register_FOUND) # HIP diff --git a/samples/videoDecodePerf/CMakeLists.txt b/samples/videoDecodePerf/CMakeLists.txt index eac869bc5c..4a1e6d4c10 100644 --- a/samples/videoDecodePerf/CMakeLists.txt +++ b/samples/videoDecodePerf/CMakeLists.txt @@ -41,7 +41,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED On) project(videodecodeperf) list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../../cmake) -list(APPEND CMAKE_PREFIX_PATH ${ROCM_PATH}/hip ${ROCM_PATH}) +list(APPEND CMAKE_PREFIX_PATH ${ROCM_PATH}/lib/cmake) # rocDecode sample build type set(DEFAULT_BUILD_TYPE "Release") @@ -61,9 +61,9 @@ else() endif() find_package(HIP QUIET) -find_package(FFmpeg QUIET) -find_package(rocDecode QUIET) +find_package(ROCDECODE QUIET) find_package(rocprofiler-register QUIET) +find_package(FFmpeg QUIET) if(HIP_FOUND AND FFMPEG_FOUND AND ROCDECODE_FOUND AND Threads_FOUND AND rocprofiler-register_FOUND) # HIP diff --git a/samples/videoDecodePicFiles/CMakeLists.txt b/samples/videoDecodePicFiles/CMakeLists.txt index c17ad9b043..29d3f9dc13 100644 --- a/samples/videoDecodePicFiles/CMakeLists.txt +++ b/samples/videoDecodePicFiles/CMakeLists.txt @@ -41,7 +41,7 @@ set(CMAKE_CXX_STANDARD 17) project(videodecodepicfiles) list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../../cmake) -list(APPEND CMAKE_PREFIX_PATH ${ROCM_PATH}/hip ${ROCM_PATH}) +list(APPEND CMAKE_PREFIX_PATH ${ROCM_PATH}/lib/cmake) # rocDecode sample build type set(DEFAULT_BUILD_TYPE "Release") @@ -61,10 +61,10 @@ else() endif() find_package(HIP QUIET) -find_package(FFmpeg QUIET) -find_package(rocDecode QUIET) -find_package(Threads REQUIRED) +find_package(ROCDECODE QUIET) find_package(rocprofiler-register QUIET) +find_package(FFmpeg QUIET) +find_package(Threads REQUIRED) if(HIP_FOUND AND FFMPEG_FOUND AND ROCDECODE_FOUND AND Threads_FOUND AND rocprofiler-register_FOUND) # HIP diff --git a/samples/videoDecodePicFiles/videodecodepicfiles.cpp b/samples/videoDecodePicFiles/videodecodepicfiles.cpp index 165f4622b9..1cfc636914 100644 --- a/samples/videoDecodePicFiles/videodecodepicfiles.cpp +++ b/samples/videoDecodePicFiles/videodecodepicfiles.cpp @@ -32,7 +32,7 @@ THE SOFTWARE. #include #include #include "video_demuxer.h" -#include "roc_bitstream_reader.h" +#include "rocdecode/roc_bitstream_reader.h" #include "roc_video_dec.h" #include "ffmpeg_video_dec.h" #include "common.h" diff --git a/samples/videoDecodeRGB/CMakeLists.txt b/samples/videoDecodeRGB/CMakeLists.txt index 4f3fd9e17e..07d322b215 100644 --- a/samples/videoDecodeRGB/CMakeLists.txt +++ b/samples/videoDecodeRGB/CMakeLists.txt @@ -41,7 +41,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED On) project(videodecodergb) list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../../cmake) -list(APPEND CMAKE_PREFIX_PATH ${ROCM_PATH}/hip ${ROCM_PATH}) +list(APPEND CMAKE_PREFIX_PATH ${ROCM_PATH}/lib/cmake) # rocDecode sample build type set(DEFAULT_BUILD_TYPE "Release") @@ -97,9 +97,9 @@ endif() message("-- ${White}${PROJECT_NAME} -- AMD GPU_TARGETS: ${GPU_TARGETS}${ColourReset}") find_package(HIP QUIET) -find_package(FFmpeg QUIET) -find_package(rocDecode QUIET) +find_package(ROCDECODE QUIET) find_package(rocprofiler-register QUIET) +find_package(FFmpeg QUIET) if(HIP_FOUND AND FFMPEG_FOUND AND ROCDECODE_FOUND AND rocprofiler-register_FOUND) # HIP diff --git a/samples/videoDecodeRaw/CMakeLists.txt b/samples/videoDecodeRaw/CMakeLists.txt index ca96518b7c..9475887a91 100644 --- a/samples/videoDecodeRaw/CMakeLists.txt +++ b/samples/videoDecodeRaw/CMakeLists.txt @@ -41,7 +41,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED On) project(videodecoderaw) list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../../cmake) -list(APPEND CMAKE_PREFIX_PATH ${ROCM_PATH}/hip ${ROCM_PATH}) +list(APPEND CMAKE_PREFIX_PATH ${ROCM_PATH}/lib/cmake) # rocDecode sample build type set(DEFAULT_BUILD_TYPE "Release") @@ -61,7 +61,7 @@ else() endif() find_package(HIP QUIET) -find_package(rocDecode QUIET) +find_package(ROCDECODE QUIET) find_package(rocprofiler-register QUIET) if(HIP_FOUND AND ROCDECODE_FOUND AND rocprofiler-register_FOUND) diff --git a/samples/videoDecodeRaw/videodecoderaw.cpp b/samples/videoDecodeRaw/videodecoderaw.cpp index 8175a066a5..003434c385 100644 --- a/samples/videoDecodeRaw/videodecoderaw.cpp +++ b/samples/videoDecodeRaw/videodecoderaw.cpp @@ -37,7 +37,7 @@ THE SOFTWARE. #include #endif -#include "roc_bitstream_reader.h" +#include "rocdecode/roc_bitstream_reader.h" #include "roc_video_dec.h" typedef enum ReconfigFlushMode_enum { diff --git a/samples/videoToSequence/CMakeLists.txt b/samples/videoToSequence/CMakeLists.txt index b7db27f2ae..ce34f4feaf 100644 --- a/samples/videoToSequence/CMakeLists.txt +++ b/samples/videoToSequence/CMakeLists.txt @@ -41,7 +41,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED On) project(videotosequence) list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../../cmake) -list(APPEND CMAKE_PREFIX_PATH ${ROCM_PATH}/hip ${ROCM_PATH}) +list(APPEND CMAKE_PREFIX_PATH ${ROCM_PATH}/lib/cmake) # rocDecode sample build type set(DEFAULT_BUILD_TYPE "Release") @@ -61,9 +61,9 @@ else() endif() find_package(HIP QUIET) -find_package(FFmpeg QUIET) -find_package(rocDecode QUIET) +find_package(ROCDECODE QUIET) find_package(rocprofiler-register QUIET) +find_package(FFmpeg QUIET) if(HIP_FOUND AND FFMPEG_FOUND AND ROCDECODE_FOUND AND rocprofiler-register_FOUND) # HIP diff --git a/src/bit_stream_reader/bs_reader_handle.h b/src/bit_stream_reader/bs_reader_handle.h index 6e0a647d8f..4aa4e44dd8 100644 --- a/src/bit_stream_reader/bs_reader_handle.h +++ b/src/bit_stream_reader/bs_reader_handle.h @@ -23,7 +23,7 @@ THE SOFTWARE. #include #include -#include "roc_bitstream_reader.h" +#include "rocdecode/roc_bitstream_reader.h" #include "es_reader.h" class RocBitstreamReaderHandle { diff --git a/src/bit_stream_reader/es_reader.h b/src/bit_stream_reader/es_reader.h index 1e2f0e7ef4..6f772a5fac 100644 --- a/src/bit_stream_reader/es_reader.h +++ b/src/bit_stream_reader/es_reader.h @@ -25,7 +25,7 @@ THE SOFTWARE. #include #include #include -#include "rocdecode.h" +#include "rocdecode/rocdecode.h" #define BS_RING_SIZE (16 * 1024 * 1024) #define INIT_PIC_DATA_SIZE (2 * 1024 * 1024) diff --git a/src/parser/parser_handle.h b/src/parser/parser_handle.h index c90be63a0c..8fba6db423 100644 --- a/src/parser/parser_handle.h +++ b/src/parser/parser_handle.h @@ -23,7 +23,7 @@ THE SOFTWARE. #include #include -#include "rocparser.h" +#include "rocdecode/rocparser.h" #include "roc_video_parser.h" #include "avc_parser.h" #include "av1_parser.h" diff --git a/src/parser/roc_video_parser.h b/src/parser/roc_video_parser.h index d5f9b12b37..c541919e0c 100644 --- a/src/parser/roc_video_parser.h +++ b/src/parser/roc_video_parser.h @@ -24,7 +24,7 @@ THE SOFTWARE. #include #include #include -#include "rocparser.h" +#include "rocdecode/rocparser.h" #include "../commons.h" typedef enum ParserResult { diff --git a/src/rocdecode/roc_decoder.h b/src/rocdecode/roc_decoder.h index dce30a2f9a..cf5252ced3 100644 --- a/src/rocdecode/roc_decoder.h +++ b/src/rocdecode/roc_decoder.h @@ -30,7 +30,7 @@ THE SOFTWARE. #include #include #include -#include "../api/rocdecode.h" +#include "../api/rocdecode/rocdecode.h" #include #include "vaapi/vaapi_videodecoder.h" diff --git a/src/rocdecode/rocdecode_api.cpp b/src/rocdecode/rocdecode_api.cpp index 09e814b43a..9e6b7dc80b 100644 --- a/src/rocdecode/rocdecode_api.cpp +++ b/src/rocdecode/rocdecode_api.cpp @@ -20,7 +20,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "dec_handle.h" -#include "rocdecode.h" +#include "rocdecode/rocdecode.h" #include "vaapi_videodecoder.h" #include "../commons.h" diff --git a/src/rocdecode/vaapi/vaapi_videodecoder.h b/src/rocdecode/vaapi/vaapi_videodecoder.h index 5f4d9e0786..b0bd6127af 100644 --- a/src/rocdecode/vaapi/vaapi_videodecoder.h +++ b/src/rocdecode/vaapi/vaapi_videodecoder.h @@ -40,7 +40,7 @@ THE SOFTWARE. #include #include #include "../../commons.h" -#include "../../../api/rocdecode.h" +#include "../../../api/rocdecode/rocdecode.h" #define CHECK_HIP(call) {\ hipError_t hip_status = call;\ diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index c02eda3d8b..a84f97dfa2 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -53,15 +53,25 @@ project(rocdecode-test) enable_testing() include(CTest) -# add find modules -list(APPEND CMAKE_MODULE_PATH ${ROCM_PATH}/share/rocdecode/cmake) +# add ROCm find Config location +list(APPEND CMAKE_PREFIX_PATH ${ROCM_PATH}/lib/cmake) # find rocDecode -find_package(rocDecode QUIET) +find_package(ROCDECODE QUIET) -if(NOT ROCDECODE_FOUND) - message("-- ${Yellow}${PROJECT_NAME} requires rocDecode. Install rocDecode before running CTests") -endif() +if(ROCDECODE_FOUND) + message("-- ${White}${PROJECT_NAME}: rocDecode found with find_package(ROCDECODE QUIET)${ColourReset}") + message("-- \t${White}ROCDECODE_INCLUDE_DIR -- ${ROCDECODE_INCLUDE_DIR}${ColourReset}") + message("-- \t${White}ROCDECODE_LIB_DIR -- ${ROCDECODE_LIB_DIR}${ColourReset}") + message("-- \t${White}ROCDECODE_LIBRARY -- ${ROCDECODE_LIBRARY}${ColourReset}") + message("-- \t${White}ROCDECODE_FOUND -- ${ROCDECODE_FOUND}${ColourReset}") + message("-- \t${White}ROCDECODE_VERSION -- ${ROCDECODE_VERSION}${ColourReset}") + message("-- \t${White}ROCDECODE_VERSION_MAJOR -- ${ROCDECODE_VERSION_MAJOR}${ColourReset}") + message("-- \t${White}ROCDECODE_VERSION_MINOR -- ${ROCDECODE_VERSION_MINOR}${ColourReset}") + message("-- \t${White}ROCDECODE_VERSION_PATCH -- ${ROCDECODE_VERSION_PATCH}${ColourReset}") +else() + message("-- ${Yellow}${PROJECT_NAME} requires rocDecode. Install rocDecode before running CTests") +endif(ROCDECODE_FOUND) # 1 - videoDecode HEVC add_test( diff --git a/utils/rocvideodecode/roc_video_dec.h b/utils/rocvideodecode/roc_video_dec.h index 7e4685e47f..3596530ece 100644 --- a/utils/rocvideodecode/roc_video_dec.h +++ b/utils/rocvideodecode/roc_video_dec.h @@ -37,8 +37,8 @@ THE SOFTWARE. #include #include #include -#include "rocdecode.h" -#include "rocparser.h" +#include "rocdecode/rocdecode.h" +#include "rocdecode/rocparser.h" /*! * \file diff --git a/utils/video_demuxer.h b/utils/video_demuxer.h index 803d7ab03e..549f021926 100644 --- a/utils/video_demuxer.h +++ b/utils/video_demuxer.h @@ -31,7 +31,7 @@ extern "C" { #endif } -#include "rocdecode.h" +#include "rocdecode/rocdecode.h" /*! * \file