From cb93f7262469d0f7e1b7da01ad3586d001234af2 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 14 Sep 2021 17:14:22 +0000 Subject: HIP: Simplify detection of HIP runtime CMake package It only makes sense to use the CMake package from the same ROCm installation that the compiler uses. Ask the HIP compiler to report the location of the ROCm installation. Verify up front that it contains the expected CMake package file. --- Modules/CMakeHIPInformation.cmake | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'Modules/CMakeHIPInformation.cmake') diff --git a/Modules/CMakeHIPInformation.cmake b/Modules/CMakeHIPInformation.cmake index ec37e1c91a..28c5f184a6 100644 --- a/Modules/CMakeHIPInformation.cmake +++ b/Modules/CMakeHIPInformation.cmake @@ -132,8 +132,11 @@ endif() set(CMAKE_HIP_INFORMATION_LOADED 1) # Load the file and find the relevant HIP runtime. -# This file will only exist after all compiler detection has finished -include(${CMAKE_PLATFORM_INFO_DIR}/CMakeHIPRuntime.cmake OPTIONAL) -if(COMMAND _CMAKE_FIND_HIP_RUNTIME) - _CMAKE_FIND_HIP_RUNTIME() +if(NOT DEFINED _CMAKE_HIP_DEVICE_RUNTIME_TARGET) + set(hip-lang_DIR "${CMAKE_HIP_COMPILER_ROCM_ROOT}/lib/cmake/hip-lang") + find_package(hip-lang CONFIG QUIET NO_DEFAULT_PATH) +endif() +if(DEFINED _CMAKE_HIP_DEVICE_RUNTIME_TARGET) + list(APPEND CMAKE_HIP_RUNTIME_LIBRARIES_STATIC ${_CMAKE_HIP_DEVICE_RUNTIME_TARGET}) + list(APPEND CMAKE_HIP_RUNTIME_LIBRARIES_SHARED ${_CMAKE_HIP_DEVICE_RUNTIME_TARGET}) endif() -- cgit v1.2.1