summaryrefslogtreecommitdiffstats
path: root/Modules/Internal
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-06-09 11:53:16 (GMT)
committerKitware Robot <kwrobot@kitware.com>2021-06-09 11:53:32 (GMT)
commit7aad9e8685b0231abfb11d0f7d8c613cf5364fef (patch)
tree2d2b547cbc6708936c98ae52c0f181d78fb0652d /Modules/Internal
parentb6faa5e2df22fecac877dc866294e8b5a36ab03a (diff)
parent8514ee9b315b4ad02eed0e3cf11d8579f307fac0 (diff)
downloadCMake-7aad9e8685b0231abfb11d0f7d8c613cf5364fef.zip
CMake-7aad9e8685b0231abfb11d0f7d8c613cf5364fef.tar.gz
CMake-7aad9e8685b0231abfb11d0f7d8c613cf5364fef.tar.bz2
Merge topic 'add_hip_language'
8514ee9b31 HIP: analyze output of `hipcc` to determine default GPU architecture 20d086f1a2 HIP: All HIP tests now run on CMake's current AMD hardware 2e86e50c2f HIP: Add HIP to all the Check* modules 947dbed0aa HIP: Automatically inject the `hip::device` runtime target b50bfc8913 HIP: Add language to CMake ff0d2858e1 HIP: Extract clang compiler details from hipcc bd844387df ROCMClang: Add the ROCm toolkit derived clang compiler to CMake 590553f322 Compilers: protect use of __has_include ... Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Zack Galbreath <zack.galbreath@kitware.com> Reviewed-by: Raul Tambre <raul@tambre.ee> Acked-by: Axel Huebl <axel.huebl@plasma.ninja> Merge-request: !6121
Diffstat (limited to 'Modules/Internal')
-rw-r--r--Modules/Internal/CheckCompilerFlag.cmake3
-rw-r--r--Modules/Internal/CheckSourceCompiles.cmake3
-rw-r--r--Modules/Internal/CheckSourceRuns.cmake3
-rw-r--r--Modules/Internal/FeatureTesting.cmake14
4 files changed, 23 insertions, 0 deletions
diff --git a/Modules/Internal/CheckCompilerFlag.cmake b/Modules/Internal/CheckCompilerFlag.cmake
index 6b2a11e..9eb1bf0 100644
--- a/Modules/Internal/CheckCompilerFlag.cmake
+++ b/Modules/Internal/CheckCompilerFlag.cmake
@@ -24,6 +24,9 @@ function(CMAKE_CHECK_COMPILER_FLAG _lang _flag _var)
elseif(_lang STREQUAL "Fortran")
set(_lang_src " program test\n stop\n end program")
set(_lang_fail_regex FAIL_REGEX "command[ -]line option .* is valid for .* but not for Fortran")
+ elseif(_lang STREQUAL "HIP")
+ set(_lang_src "__host__ int main() { return 0; }")
+ set(_lang_fail_regex FAIL_REGEX "argument unused during compilation: .*") # Clang
elseif(_lang STREQUAL "OBJC")
set(_lang_src [=[
#ifndef __OBJC__
diff --git a/Modules/Internal/CheckSourceCompiles.cmake b/Modules/Internal/CheckSourceCompiles.cmake
index 3b2152a..8c3a418 100644
--- a/Modules/Internal/CheckSourceCompiles.cmake
+++ b/Modules/Internal/CheckSourceCompiles.cmake
@@ -22,6 +22,9 @@ function(CMAKE_CHECK_SOURCE_COMPILES _lang _source _var)
elseif(_lang STREQUAL "Fortran")
set(_lang_textual "Fortran")
set(_lang_ext "F90")
+ elseif(_lang STREQUAL "HIP")
+ set(_lang_textual "HIP")
+ set(_lang_ext "hip")
elseif(_lang STREQUAL "ISPC")
set(_lang_textual "ISPC")
set(_lang_ext "ispc")
diff --git a/Modules/Internal/CheckSourceRuns.cmake b/Modules/Internal/CheckSourceRuns.cmake
index 676f3d0..75e9896 100644
--- a/Modules/Internal/CheckSourceRuns.cmake
+++ b/Modules/Internal/CheckSourceRuns.cmake
@@ -22,6 +22,9 @@ function(CMAKE_CHECK_SOURCE_RUNS _lang _source _var)
elseif(_lang STREQUAL "Fortran")
set(_lang_textual "Fortran")
set(_lang_ext "F90")
+ elseif(_lang STREQUAL "HIP")
+ set(_lang_textual "HIP")
+ set(_lang_ext "hip")
elseif(_lang STREQUAL "OBJC")
set(_lang_textual "Objective-C")
set(_lang_ext "m")
diff --git a/Modules/Internal/FeatureTesting.cmake b/Modules/Internal/FeatureTesting.cmake
index 72d96b3..b6f3c09 100644
--- a/Modules/Internal/FeatureTesting.cmake
+++ b/Modules/Internal/FeatureTesting.cmake
@@ -99,6 +99,16 @@ macro(_record_compiler_features_cuda std)
unset(lang_level_has_features)
endmacro()
+macro(_record_compiler_features_hip std)
+ list(APPEND CMAKE_HIP${std}_COMPILE_FEATURES hip_std_${std})
+
+ get_property(lang_level_has_features GLOBAL PROPERTY CMAKE_HIP${std}_KNOWN_FEATURES)
+ if(lang_level_has_features)
+ _record_compiler_features(HIP "${CMAKE_HIP${std}_STANDARD_COMPILE_OPTION}" CMAKE_HIP${std}_COMPILE_FEATURES)
+ endif()
+ unset(lang_level_has_features)
+endmacro()
+
macro(_has_compiler_features lang level compile_flags feature_list)
# presume all known features are supported
get_property(known_features GLOBAL PROPERTY CMAKE_${lang}${level}_KNOWN_FEATURES)
@@ -117,3 +127,7 @@ macro(_has_compiler_features_cuda std)
list(APPEND CMAKE_CUDA${std}_COMPILE_FEATURES cuda_std_${std})
_has_compiler_features(CUDA ${std} "${CMAKE_CUDA${std}_STANDARD_COMPILE_OPTION}" CMAKE_CUDA${std}_COMPILE_FEATURES)
endmacro()
+macro(_has_compiler_features_hip std)
+ list(APPEND CMAKE_HIP${std}_COMPILE_FEATURES hip_std_${std})
+ _has_compiler_features(HIP ${std} "${CMAKE_HIP${std}_STANDARD_COMPILE_OPTION}" CMAKE_HIP${std}_COMPILE_FEATURES)
+endmacro()