meson: centralize bindgen version check

It's entirely duplicated and every rust user also wants to use bindgen
anyway. This way bindgen won't show up multiple times in the meson log
as well.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30414>
This commit is contained in:
Karol Herbst
2024-07-30 12:01:23 +02:00
committed by Marge Bot
parent 5290a09d2a
commit b3a9c91d9b
3 changed files with 13 additions and 25 deletions

View File

@@ -855,6 +855,19 @@ if with_gallium_rusticl or with_nouveau_vk or with_tools.contains('etnaviv')
if rustc.version().version_compare('< 1.76')
error('Mesa requires Rust 1.76.0 or newer')
endif
bindgen_version = find_program('bindgen').version()
if bindgen_version == 'unknown'
error('Failed to detect bindgen version. If you are using bindgen 0.69.0, ' +
'please either update to 0.69.1 or downgrade to 0.68.1. ' +
'You can install the latest version for your user with `cargo install bindgen-cli`.')
endif
if bindgen_version.version_compare('< 0.65')
error('Mesa requires bindgen 0.65 or newer. ' +
'If your distribution does not ship a recent enough version, ' +
'you can install the latest version for your user with `cargo install bindgen-cli`.')
endif
endif
with_clover_spirv = with_gallium_clover and get_option('opencl-spirv')

View File

@@ -105,16 +105,6 @@ rusticl_bindgen_args = [
'--anon-fields-prefix', 'anon_',
]
bindgen_version = find_program('bindgen').version()
if bindgen_version == 'unknown'
error('Failed to detect bindgen version. If you are using bindgen 0.69.0, please either update to 0.69.1 or downgrade to 0.68.1. You can install the latest version for your user with `cargo install bindgen-cli`.')
endif
if bindgen_version.version_compare('< 0.65')
error('rusticl requires bindgen 0.65 or newer. If your distribution does not ship a recent enough version, you can install the latest version for your user with `cargo install bindgen-cli`.')
endif
rusticl_bindgen_c_args = [
'-fno-builtin-malloc',
]

View File

@@ -4,21 +4,6 @@ if meson.version().version_compare('< 1.3.0')
error('NVK requires meson 1.3.0 or newer')
endif
bindgen_version = find_program('bindgen').version()
if bindgen_version == 'unknown'
error('Failed to detect bindgen version. If you are using bindgen 0.69.0, ' +
'please either update to 0.69.1 or downgrade to 0.68.1. You can ' +
'install the latest version for your user with ' +
'`cargo install bindgen-cli`.')
endif
if bindgen_version.version_compare('< 0.65')
error('NAK requires bindgen 0.65 or newer. If your distribution does not ' +
'ship a recent enough version, you can install the latest version ' +
'for your user with `cargo install bindgen-cli`.')
endif
nak_rust_args = [
'-Aclippy::identity_op',
'-Aclippy::len_zero',