ptp-helper: Check for the required Rust toolchain version via meson

If an older version is found that gives a more useful output than a
compiler error at a later time.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4410>
This commit is contained in:
Sebastian Dröge 2023-04-13 14:46:43 +03:00 committed by GStreamer Marge Bot
parent acdf70e576
commit b35d598003

View file

@ -13,6 +13,26 @@ endif
if have_ptp
rustc = meson.get_compiler('rust')
if rustc.get_id() not in ['rustc', 'clippy-driver rustc']
message('PTP support is only tested with rustc, found different compiler @0@ @1@'.format(rustc.get_id(), rustc.version()))
endif
# We currently need at least Rust 1.48 on all platforms but Windows.
# On Windows some 1.54 API is used that would otherwise complicate things
# unncecessarily.
rust_req = '1.48'
if host_system == 'windows'
rust_req = '1.54'
endif
if rustc.get_id() in ['rustc', 'clippy-driver rustc'] and not rustc.version().version_compare('>=' + rust_req)
have_ptp = false
message('PTP support requires at least Rust @0@ on this platform, found @1@'.format(rust_req, rustc.version()))
endif
endif
if have_ptp
cdata.set('HAVE_PTP', 1, description : 'PTP support available')
ptp_helper_conf_data = configuration_data()