Files

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

71 lines
1.8 KiB
CMake
Raw Permalink Normal View History

2023-06-07 19:46:35 -05:00
# This module provides a rvs::rvs package
# You can specify the ROCM directory by setting ROCM_DIR
set(NAME rvs)
if(NOT DEFINED ROCM_DIR)
set(ROCM_DIR "/opt/rocm")
endif()
2024-09-03 15:00:29 -05:00
list(APPEND CMAKE_PREFIX_PATH ${ROCM_DIR})
2023-06-07 19:46:35 -05:00
find_library(
${NAME}_LIBRARY
2025-06-24 17:35:03 -05:00
NAMES
${NAME}
${NAME}64
${NAME}lib # RVS is special and is named librvslib.so
REQUIRED
REGISTRY_VIEW
BOTH
PATH_SUFFIXES lib
)
2023-06-07 19:46:35 -05:00
if(NOT DEFINED (${NAME}_INCLUDE_DIR))
find_path(
${NAME}_INCLUDE_DIR
NAMES ${NAME}.h
HINTS "${ROCM_DIR}/include"
2025-06-24 17:35:03 -05:00
PATH_SUFFIXES ${NAME} ${NAME}/inc
)
2023-06-07 19:46:35 -05:00
endif()
include(FindPackageHandleStandardArgs)
2025-05-06 22:22:50 +00:00
find_package_handle_standard_args(
${NAME}
2023-06-07 19:46:35 -05:00
FOUND_VAR ${NAME}_FOUND
2025-06-24 17:35:03 -05:00
REQUIRED_VARS ${NAME}_LIBRARY ${NAME}_INCLUDE_DIR
)
2023-06-07 19:46:35 -05:00
if(${NAME}_FOUND AND NOT TARGET ${NAME}::${NAME})
add_library(${NAME}::${NAME} UNKNOWN IMPORTED)
2025-05-06 22:22:50 +00:00
set_target_properties(
${NAME}::${NAME}
2025-06-24 17:35:03 -05:00
PROPERTIES
IMPORTED_LOCATION "${${NAME}_LIBRARY}"
INTERFACE_COMPILE_OPTIONS "${PC_${NAME}_CFLAGS_OTHER}"
INTERFACE_INCLUDE_DIRECTORIES "${${NAME}_INCLUDE_DIR}"
)
2025-05-06 22:22:50 +00:00
find_library(rocm-core NAMES rocm-core REQUIRED)
2024-09-03 15:00:29 -05:00
find_package(yaml-cpp REQUIRED)
find_package(rocblas REQUIRED)
find_package(hipblaslt REQUIRED)
find_package(hsakmt REQUIRED)
find_package(hip REQUIRED)
2025-07-22 15:54:01 -05:00
find_package(hiprand REQUIRED)
2024-09-03 15:00:29 -05:00
find_package(hsa-runtime64 REQUIRED)
find_package(amd_smi REQUIRED)
2025-05-06 22:22:50 +00:00
target_link_libraries(
${NAME}::${NAME}
2025-06-24 17:35:03 -05:00
INTERFACE
${rocm-core}
yaml-cpp
roc::rocblas
roc::hipblaslt
hsakmt::hsakmt
hip::amdhip64
2025-07-22 15:54:01 -05:00
hip::hiprand
2025-06-24 17:35:03 -05:00
hsa-runtime64::hsa-runtime64
amd_smi
)
2023-06-07 19:46:35 -05:00
endif()