summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeHIPInformation.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-09-18 19:46:39 (GMT)
committerBrad King <brad.king@kitware.com>2023-09-21 19:34:37 (GMT)
commit18158bf81ccb5269afcfa53cd671cf7f56dc70b5 (patch)
treec7877ec383af7831f4feb431ceb7dbe7d048d368 /Modules/CMakeHIPInformation.cmake
parent127b6fa06bf53ad9f31d041a7d11434ca2856c8e (diff)
downloadCMake-18158bf81ccb5269afcfa53cd671cf7f56dc70b5.zip
CMake-18158bf81ccb5269afcfa53cd671cf7f56dc70b5.tar.gz
CMake-18158bf81ccb5269afcfa53cd671cf7f56dc70b5.tar.bz2
HIP: Add support for NVIDIA GPUs
Add support for using the CUDA Toolkit's NVCC to compile HIP code. Fixes: #25143
Diffstat (limited to 'Modules/CMakeHIPInformation.cmake')
-rw-r--r--Modules/CMakeHIPInformation.cmake15
1 files changed, 14 insertions, 1 deletions
diff --git a/Modules/CMakeHIPInformation.cmake b/Modules/CMakeHIPInformation.cmake
index 41a98db..3995c36 100644
--- a/Modules/CMakeHIPInformation.cmake
+++ b/Modules/CMakeHIPInformation.cmake
@@ -8,6 +8,19 @@ else()
endif()
set(CMAKE_INCLUDE_FLAG_HIP "-I")
+# Set implicit links early so compiler-specific modules can use them.
+set(__IMPLICIT_LINKS)
+foreach(dir ${CMAKE_HIP_HOST_IMPLICIT_LINK_DIRECTORIES})
+ string(APPEND __IMPLICIT_LINKS " -L\"${dir}\"")
+endforeach()
+foreach(lib ${CMAKE_HIP_HOST_IMPLICIT_LINK_LIBRARIES})
+ if(${lib} MATCHES "/")
+ string(APPEND __IMPLICIT_LINKS " \"${lib}\"")
+ else()
+ string(APPEND __IMPLICIT_LINKS " -l${lib}")
+ endif()
+endforeach()
+
# Load compiler-specific information.
if(CMAKE_HIP_COMPILER_ID)
include(Compiler/${CMAKE_HIP_COMPILER_ID}-HIP OPTIONAL)
@@ -129,7 +142,7 @@ endif()
# compile a HIP file into an object file
if(NOT CMAKE_HIP_COMPILE_OBJECT)
set(CMAKE_HIP_COMPILE_OBJECT
- "<CMAKE_HIP_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> ${_CMAKE_COMPILE_AS_HIP_FLAG} -c <SOURCE>")
+ "<CMAKE_HIP_COMPILER> ${_CMAKE_HIP_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> ${_CMAKE_COMPILE_AS_HIP_FLAG} -c <SOURCE>")
endif()
# compile a cu file into an executable