From 9743eeabc7a78a20975465a9852f3b3608a88518 Mon Sep 17 00:00:00 2001 From: Lone_Wolf Date: Thu, 27 Apr 2023 19:42:02 +0200 Subject: [PATCH] compiler/clc: Fix embedded clang headers (microsoft-clc) for LLVM 16+ Reviewed-by: Jesse Natalie Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7742 Cc: mesa-stable Part-of: (cherry picked from commit f53e5efad7eb5e5cfcc5cf21da4b5393628d2ed4) --- .pick_status.json | 2 +- src/compiler/clc/meson.build | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 5022efb66af..cc7de64a5d8 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -8514,7 +8514,7 @@ "description": "compiler/clc: Fix embedded clang headers (microsoft-clc) for LLVM 16+", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/compiler/clc/meson.build b/src/compiler/clc/meson.build index caae07e26dd..64f2e1f6816 100644 --- a/src/compiler/clc/meson.build +++ b/src/compiler/clc/meson.build @@ -29,7 +29,17 @@ _libclc_cpp_args = ['-DLLVM_LIB_DIR="@0@"'.format(llvm_libdir)] _libclc_sources = [] if with_microsoft_clc - clang_resource_dir = join_paths(llvm_libdir, 'clang', dep_llvm.version(), 'include') + + # LLVM 16 moved clang header path from using full version to only major version + if dep_llvm.version().version_compare('< 16') + # Prior to LLVM 16, this path used a full version + clang_version_dir = dep_llvm.version() + else + # LLVM 16 changed to only using a major version + clang_version_dir = dep_llvm.version().split('.')[0] + endif + clang_resource_dir = join_paths(llvm_libdir, 'clang', clang_version_dir, 'include') + if dep_llvm.version().version_compare('< 15.0') opencl_c_h = custom_target( 'opencl-c.h',