SWDEV-346857 - Find ROCM_PATH based on config file path rather than hardcoding

As per the requirements in SWDEV-287540, config files should not have hard coded /opt/rocm path
Instead of setting ROCM_PATH to /opt/rocm, used hip-config file path to find the rocm path
Validated by printing the CONFIG_PATH and is coming as/opt/rocm-ver/lib/cmake/hip/hip-config.cmake
So need four level up,with file name in the path

Change-Id: Iac01d3a0c0168138c777551165705ed56cf6c3b1


[ROCm/clr commit: f61a87ebb2]
Αυτή η υποβολή περιλαμβάνεται σε:
Ranjith Ramakrishnan
2022-07-26 16:04:00 -07:00
γονέας a2790df62c
υποβολή 57146de728
@@ -114,7 +114,13 @@ if(WIN32)
else()
# Linux - set a default path for ROCM_PATH
if(NOT DEFINED ROCM_PATH)
set(ROCM_PATH /opt/rocm)
# TODO:once file reorg backward compatibility is turned off,
# ROCM_PATH can be set to PACKAGE_PREFIX_DIR.
# Time being find the ROCM_PATH based on hip-config file
# Following will provide the path with filename with symlinks resolved.
# Move four level up to get rocm path
file(REAL_PATH ${CMAKE_CURRENT_LIST_FILE} CONFIG_PATH)
get_filename_component(ROCM_PATH "${CONFIG_PATH}/../../../../" ABSOLUTE)
endif()
#If HIP is not installed under ROCm, need this to find HSA assuming HSA is under ROCm
@@ -187,8 +193,7 @@ if(NOT WIN32)
find_dependency(Threads)
endif()
#get_filename_component cannot resolve the symlinks if called from /opt/rocm/lib/hip
#and do three level up again
# From hip config directory, do three level up
get_filename_component(_DIR "${CMAKE_CURRENT_LIST_DIR}" REALPATH)
get_filename_component(_IMPORT_PREFIX "${_DIR}/../../../" REALPATH)