diff mbox series

[PULL,38/40] rust: make rustfmt optional

Message ID 20241104172721.180255-39-pbonzini@redhat.com (mailing list archive)
State New
Headers show
Series [PULL,01/40] qdev: make properties array "const" | expand

Commit Message

Paolo Bonzini Nov. 4, 2024, 5:27 p.m. UTC
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 meson.build | 11 +++++++++++
 1 file changed, 11 insertions(+)
diff mbox series

Patch

diff --git a/meson.build b/meson.build
index fffdeef8c80..a0ae56c9625 100644
--- a/meson.build
+++ b/meson.build
@@ -115,6 +115,10 @@  if not bindgen.found() or bindgen.version().version_compare('<0.60.0')
   endif
 endif
 
+if have_rust
+  rustfmt = find_program('rustfmt', required: false)
+endif
+
 dtrace = not_found
 stap = not_found
 if 'dtrace' in get_option('trace_backends')
@@ -3987,6 +3991,13 @@  if have_rust
     '--allowlist-file', meson.project_source_root() + '/.*',
     '--allowlist-file', meson.project_build_root() + '/.*'
     ]
+  if not rustfmt.found()
+    if bindgen.version().version_compare('<0.65.0')
+      bindgen_args += ['--no-rustfmt-bindings']
+    else
+      bindgen_args += ['--formatter', 'none']
+    endif
+  endif
   if bindgen.version().version_compare('<0.61.0')
     # default in 0.61+
     bindgen_args += ['--size_t-is-usize']