mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 00:49:04 +02:00
rusticl/meson: generate bindings for LLVM
Signed-off-by: Karol Herbst <kherbst@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24386>
This commit is contained in:
parent
d72544eea6
commit
299f949775
2 changed files with 39 additions and 2 deletions
|
|
@ -108,6 +108,7 @@ endif
|
||||||
rusticl_gen_args = [
|
rusticl_gen_args = [
|
||||||
# can't do anything about it anyway
|
# can't do anything about it anyway
|
||||||
'-Aclippy::all',
|
'-Aclippy::all',
|
||||||
|
'-Aimproper_ctypes',
|
||||||
# Some bindgen versions assume `unsafe_op_in_unsafe_fn`
|
# Some bindgen versions assume `unsafe_op_in_unsafe_fn`
|
||||||
'-Aunused_unsafe',
|
'-Aunused_unsafe',
|
||||||
'-Anon_camel_case_types',
|
'-Anon_camel_case_types',
|
||||||
|
|
@ -211,6 +212,41 @@ rusticl_opencl_gen = static_library(
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
rusticl_llvm_bindings_rs = rust.bindgen(
|
||||||
|
input : 'rusticl_llvm_bindings.hpp',
|
||||||
|
output : 'rusticl_llvm_bindings.rs',
|
||||||
|
c_args : [
|
||||||
|
rusticl_bindgen_c_args,
|
||||||
|
pre_args,
|
||||||
|
],
|
||||||
|
dependencies : [
|
||||||
|
dep_clang,
|
||||||
|
dep_llvm,
|
||||||
|
dep_llvmspirvlib,
|
||||||
|
],
|
||||||
|
args : [
|
||||||
|
# we want to limit what to generate bindings for
|
||||||
|
'--generate', 'constructors,functions,types',
|
||||||
|
# and all types will be opaque
|
||||||
|
'--opaque-type', '.*',
|
||||||
|
# LLVM/Clang/Translator stuff, only used for build-id
|
||||||
|
# also only use functions from very basic header files, otherwise bindgen might crash :')
|
||||||
|
'--allowlist-function', 'clang::getClangFullVersion',
|
||||||
|
'--allowlist-function', 'llvm::LLVMContext::LLVMContext',
|
||||||
|
'--allowlist-function', 'llvm::writeSpirv',
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
rusticl_llvm_gen = static_library(
|
||||||
|
'rusticl_llvm_gen',
|
||||||
|
rusticl_llvm_bindings_rs,
|
||||||
|
gnu_symbol_visibility : 'hidden',
|
||||||
|
rust_crate_type : 'rlib',
|
||||||
|
rust_args : [
|
||||||
|
rusticl_gen_args,
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
rusticl_system_bindings_wrapper = static_library(
|
rusticl_system_bindings_wrapper = static_library(
|
||||||
'system_bindings',
|
'system_bindings',
|
||||||
[
|
[
|
||||||
|
|
@ -432,6 +468,7 @@ librusticl = static_library(
|
||||||
libmesa_rust,
|
libmesa_rust,
|
||||||
libmesa_rust_gen,
|
libmesa_rust_gen,
|
||||||
libmesa_rust_util,
|
libmesa_rust_util,
|
||||||
|
rusticl_llvm_gen,
|
||||||
rusticl_opencl_gen,
|
rusticl_opencl_gen,
|
||||||
rusticl_proc_macros,
|
rusticl_proc_macros,
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
//#include <clang/Basic/Version.h>
|
#include <clang/Basic/Version.h>
|
||||||
//#include <llvm/IR/LLVMContext.h>
|
#include <llvm/IR/LLVMContext.h>
|
||||||
#include <LLVMSPIRVLib/LLVMSPIRVLib.h>
|
#include <LLVMSPIRVLib/LLVMSPIRVLib.h>
|
||||||
#include <spirv-tools/linker.hpp>
|
#include <spirv-tools/linker.hpp>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue