clc: use CLANG_RESOURCE_DIR for clang's resource path
With certain build configuration that value can be a non empty string and needs to be used. This will also require distributions to rebuild mesa if and only if CLANG_RESOURCE_DIR changes between clang rebuilds or updates. Signed-off-by: Karol Herbst <git@karolherbst.de> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23981>
This commit is contained in:
@@ -33,6 +33,9 @@ The minimum versions to build Rusticl are:
|
||||
- Meson: 1.2.0
|
||||
- Bindgen: 0.62.0
|
||||
- LLVM: 11.0.0 (recommended: 15.0.0)
|
||||
- Clang: 11.0.0 (recommended: 15.0.0)
|
||||
Updating clang requires a rebuilt of mesa and rusticl if and only if the value of
|
||||
``CLANG_RESOURCE_DIR`` changes. It is defined through ``clang/Config/config.h``.
|
||||
- SPIRV-Tools: any version (recommended: v2022.3)
|
||||
|
||||
Afterwards you only need to add ``-Dgallium-rusticl=true -Dllvm=enabled
|
||||
|
@@ -39,6 +39,7 @@
|
||||
#include <llvm-c/Target.h>
|
||||
#include <LLVMSPIRVLib/LLVMSPIRVLib.h>
|
||||
|
||||
#include <clang/Config/config.h>
|
||||
#include <clang/Driver/Driver.h>
|
||||
#include <clang/CodeGen/CodeGenAction.h>
|
||||
#include <clang/Lex/PreprocessorOptions.h>
|
||||
@@ -76,6 +77,7 @@ using ::llvm::Function;
|
||||
using ::llvm::LLVMContext;
|
||||
using ::llvm::Module;
|
||||
using ::llvm::raw_string_ostream;
|
||||
using ::clang::driver::Driver;
|
||||
|
||||
static void
|
||||
llvm_log_handler(const ::llvm::DiagnosticInfo &di, void *data) {
|
||||
@@ -877,7 +879,7 @@ clc_compile_to_llvm_module(LLVMContext &llvm_ctx,
|
||||
// because we might have linked clang statically.
|
||||
auto libclang_path = fs::path(LLVM_LIB_DIR) / "libclang.so";
|
||||
auto clang_res_path =
|
||||
fs::path(clang::driver::Driver::GetResourcesPath(libclang_path.string())) / "include";
|
||||
fs::path(Driver::GetResourcesPath(libclang_path.string(), CLANG_RESOURCE_DIR)) / "include";
|
||||
|
||||
c->getHeaderSearchOpts().UseBuiltinIncludes = true;
|
||||
c->getHeaderSearchOpts().UseStandardSystemIncludes = true;
|
||||
|
Reference in New Issue
Block a user