This allows to find compiler for HIP language files.
Environment variable HIPCXX is used by CMake[1].
In recent releases of CMake, it strictly requires clang++, not hipcc.
When not defined, CMake uses multiple methods to find HIP compiler,
hipconfig is one of them[2].

[1] https://cmake.org/cmake/help/latest/envvar/HIPCXX.html
[2] 
https://gitlab.kitware.com/cmake/cmake/-/blob/master/Modules/CMakeDetermineHIPCompiler.cmake

Bug: https://bugs.gentoo.org/957893
Signed-off-by: Sv. Lockal <[email protected]>
---
 eclass/toolchain-funcs.eclass | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
index baf032bbd4ec..1f3f958badee 100644
--- a/eclass/toolchain-funcs.eclass
+++ b/eclass/toolchain-funcs.eclass
@@ -73,6 +73,10 @@ tc-getCPP() { tc-getPROG CPP "${CC:-gcc} -E" "$@"; }
 # @USAGE: [toolchain prefix]
 # @RETURN: name of the C++ compiler
 tc-getCXX() { tc-getPROG CXX g++ "$@"; }
+# @FUNCTION: tc-getHIPCXX
+# @USAGE: [toolchain prefix]
+# @RETURN: name of the HIP compiler
+tc-getHIPCXX() { tc-getPROG HIPCXX "$(hipconfig
--hipclangpath)/clang++" "$@"; }
 # @FUNCTION: tc-getLD
 # @USAGE: [toolchain prefix]
 # @RETURN: name of the linker
-- 
2.50.0

Reply via email to