cmake/debian/patches/0005-HIP-Add-support-for-HIP-runtime-in-system-paths.patch
Timo Röhling 485718a199 Renumber patches
Gbp-Dch: ignore
2023-06-02 22:32:05 +02:00

44 lines
1.9 KiB
Diff

From: Cordell Bloor <Cordell.Bloor@amd.com>
Date: Wed, 22 Mar 2023 16:48:10 -0600
Subject: HIP: Add support for HIP runtime in system paths
Add /usr/include to implicit include dirs for ABI check
The CMAKE_<LANG>_IMPLICIT_INCLUDE_DIRECTORIES are computed using
try_compile in CMAKE_DETERMINE_COMPILER_ABI, but the implicit include
directories aren't known until after try_compile is complete. This can
be a problem when the HIP runtime include path is /usr/include, because
the runtime include path is always added to the userDirs and the
compiler automatically includes standard library headers via
__clang_hip_runtime_wrapper.h
Bug: https://gitlab.kitware.com/cmake/cmake/-/issues/24562
Bug-Debian: https://bugs.debian.org/1031799
Forwarded: https://gitlab.kitware.com/cmake/cmake/-/merge_requests/8534
---
Source/cmLocalGenerator.cxx | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 75ec694..68ff7ea 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1190,6 +1190,17 @@ std::vector<BT<std::string>> cmLocalGenerator::GetIncludeDirectoriesImplicit(
cmSystemTools::ConvertToUnixSlashes(impDirVec[i]);
}
}
+
+ // The CMAKE_<LANG>_IMPLICIT_INCLUDE_DIRECTORIES are computed using
+ // try_compile in CMAKE_DETERMINE_COMPILER_ABI, but the implicit include
+ // directories are not known during that try_compile. This can be a
+ // problem when the HIP runtime include path is /usr/include because the
+ // runtime include path is always added to the userDirs and the compiler
+ // includes standard library headers via "__clang_hip_runtime_wrapper.h".
+ if (lang == "HIP" && impDirVec.size() == impDirVecOldSize &&
+ !cm::contains(impDirVec, "/usr/include")) {
+ implicitExclude.emplace("/usr/include");
+ }
}
// The Platform/UnixPaths module used to hard-code /usr/include for C, CXX,