meson: centralize rust handling

This bumps the req for everything, but I think that's fine, because one
part restricting to a lower rust version doesn't make much sense as we are
also not doing it generally for C or C++.

This also makes it easier for packagers to know what requires rust.

Reviewed-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30414>
This commit is contained in:
Karol Herbst 2024-07-29 16:44:29 +02:00 committed by Marge Bot
parent 7ff2513c28
commit 03ecda08de
6 changed files with 4 additions and 24 deletions

View File

@ -845,12 +845,15 @@ if with_gallium_rusticl
if meson.version().version_compare('< 1.4.0')
error('rusticl requires meson 1.4.0 or newer')
endif
endif
if with_gallium_rusticl or with_nouveau_vk or with_tools.contains('etnaviv')
add_languages('rust', required: true)
rustc = meson.get_compiler('rust')
rust = import('rust')
if rustc.version().version_compare('< 1.76')
error('rusticl requires Rust 1.76.0 or newer')
error('Mesa requires Rust 1.76.0 or newer')
endif
endif

View File

@ -95,9 +95,6 @@ if with_tools.contains('etnaviv')
error('etnaviv requires meson 1.4.0 or newer')
endif
add_languages('rust', required: true)
rust = import('rust')
isa_bindings_rs = rust.bindgen(
input : 'bindings.h',
output : 'isa_bindings.rs',

View File

@ -2,7 +2,6 @@
# SPDX-License-Identifier: MIT
fs = import('fs')
rust = import('rust')
libmesa_rust_util_files = files(
'util/lib.rs',

View File

@ -4,14 +4,6 @@ if meson.version().version_compare('< 1.3.0')
error('NVK requires meson 1.3.0 or newer')
endif
add_languages('rust', required: true)
rust = import('rust')
rc = meson.get_compiler('rust')
if rc.version().version_compare('< 1.73.0')
error('NAK requires Rust 1.73.0')
endif
bindgen_version = find_program('bindgen').version()
if bindgen_version == 'unknown'

View File

@ -70,9 +70,6 @@ executable(
# Only generate Rust bindings for NVK
if with_nouveau_vk
add_languages('rust', required: true)
rust = import('rust')
cl_rs_generated = []
foreach cl : nv_classes
cl_rs_generated += custom_target(

View File

@ -4,14 +4,6 @@ if meson.version().version_compare('< 1.3.0')
error('NVK requires meson 1.3.0 or newer')
endif
add_languages('rust', required: true)
rust = import('rust')
rc = meson.get_compiler('rust')
if rc.version().version_compare('< 1.73.0')
error('nil_rs requires Rust 1.73.0')
endif
prog_cbindgen = find_program(
'cbindgen',
required : true,