commit:     1f14d47e71be09731dc65f2547455921972539be
Author:     Sv. Lockal <lockalsash <AT> gmail <DOT> com>
AuthorDate: Sun Jun 22 14:32:01 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jul  5 07:14:12 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1f14d47e

toolchain-funcs.eclass: add tc-getHIPCXX function

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 <lockalsash <AT> gmail.com>
Part-of: https://github.com/gentoo/gentoo/pull/42691
Signed-off-by: Sam James <sam <AT> gentoo.org>

 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

Reply via email to