diff options
author | Robert Maynard <robert.maynard@kitware.com> | 2020-09-02 18:53:41 (GMT) |
---|---|---|
committer | Zack Galbreath <zack.galbreath@kitware.com> | 2021-06-07 19:25:33 (GMT) |
commit | 947dbed0aa502c70a9e165757450bd8409036980 (patch) | |
tree | 0a45b31986184368c7ad6df72d9f9186c7a24b4c /Modules/CMakeTestHIPCompiler.cmake | |
parent | b50bfc89131e55685aa41146254b37d26049b4d5 (diff) | |
download | CMake-947dbed0aa502c70a9e165757450bd8409036980.zip CMake-947dbed0aa502c70a9e165757450bd8409036980.tar.gz CMake-947dbed0aa502c70a9e165757450bd8409036980.tar.bz2 |
HIP: Automatically inject the `hip::device` runtime target
Any target that might need to link to hip code needs the `hip::device`
target
Diffstat (limited to 'Modules/CMakeTestHIPCompiler.cmake')
-rw-r--r-- | Modules/CMakeTestHIPCompiler.cmake | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Modules/CMakeTestHIPCompiler.cmake b/Modules/CMakeTestHIPCompiler.cmake index da70f8d..d9fcc9d 100644 --- a/Modules/CMakeTestHIPCompiler.cmake +++ b/Modules/CMakeTestHIPCompiler.cmake @@ -78,6 +78,20 @@ unset(__CMAKE_HIP_FLAGS) include(${CMAKE_ROOT}/Modules/CMakeDetermineCompileFeatures.cmake) CMAKE_DETERMINE_COMPILE_FEATURES(HIP) + +# Setup the following: +# Configure the new template file CMakeHipRuntime.cmake to +# - ${CMAKE_PLATFORM_INFO_DIR}/ +# This file will do the actual find_package query. We than have +# CMakeHIPInformation.cmake include `CMakeHipRuntime` +# So it is included once system information has been finished +# +configure_file( + ${CMAKE_ROOT}/Modules/CMakeHIPRuntime.cmake.in + ${CMAKE_PLATFORM_INFO_DIR}/CMakeHIPRuntime.cmake + @ONLY +) + # Re-configure to save learned information. configure_file( ${CMAKE_ROOT}/Modules/CMakeHIPCompiler.cmake.in @@ -96,3 +110,10 @@ endif() set(CMAKE_TRY_COMPILE_TARGET_TYPE ${__CMAKE_SAVED_TRY_COMPILE_TARGET_TYPE}) unset(__CMAKE_SAVED_TRY_COMPILE_TARGET_TYPE) unset(__CMAKE_HIP_COMPILER_OUTPUT) + +# 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) +if(COMMAND _CMAKE_FIND_HIP_RUNTIME) + _CMAKE_FIND_HIP_RUNTIME() +endif() |