diff options
author | Brad King <brad.king@kitware.com> | 2021-09-14 17:14:22 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-09-16 19:33:53 (GMT) |
commit | cb93f7262469d0f7e1b7da01ad3586d001234af2 (patch) | |
tree | ee450b9b1157f07ff1c3b250781749cb848fc9be /Modules/CMakeHIPInformation.cmake | |
parent | a71f0fc9c7762a06d0bfdd64d0d490919e12357a (diff) | |
download | CMake-cb93f7262469d0f7e1b7da01ad3586d001234af2.zip CMake-cb93f7262469d0f7e1b7da01ad3586d001234af2.tar.gz CMake-cb93f7262469d0f7e1b7da01ad3586d001234af2.tar.bz2 |
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.
Diffstat (limited to 'Modules/CMakeHIPInformation.cmake')
-rw-r--r-- | Modules/CMakeHIPInformation.cmake | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Modules/CMakeHIPInformation.cmake b/Modules/CMakeHIPInformation.cmake index ec37e1c..28c5f18 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() |