clc: find opencl headers from the installed llvm/clang location

A number of people report the headers not being found when running
intel-clc. I've run into the same issue but only on the most recent
Ubuntu version.

Signed-off-by: Lionel Landwerlin <llandwerlin@gmail.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30711>
This commit is contained in:
Lionel Landwerlin 2024-06-19 23:52:57 +03:00 committed by Lionel Landwerlin
parent 0e02de5a50
commit 0f6fa4679d

View file

@ -906,6 +906,12 @@ clc_compile_to_llvm_module(LLVMContext &llvm_ctx,
c->getHeaderSearchOpts().AddPath(clang_res_path.string(),
clang::frontend::Angled,
false, false);
auto clang_install_res_path =
fs::path(LLVM_LIB_DIR) / "clang" / std::to_string(LLVM_VERSION_MAJOR) / "include";
c->getHeaderSearchOpts().AddPath(clang_install_res_path.string(),
clang::frontend::Angled,
false, false);
#endif
// Enable/Disable optional OpenCL C features. Some can be toggled via `OpenCLExtensionsAsWritten`