summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2024-10-18 19:23:00 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2024-11-06 17:12:17 +0100
commit5b1b5a8ae40d3fcbc3f9ede3fe9227064f9a480f (patch)
tree14391d8ef0823e26780ebbfe9dc6fdd82e70d593
parentc2988dfbb0ecd30496625f8fb1afc52a74304259 (diff)
downloadfocaccia-qemu-5b1b5a8ae40d3fcbc3f9ede3fe9227064f9a480f.tar.gz
focaccia-qemu-5b1b5a8ae40d3fcbc3f9ede3fe9227064f9a480f.zip
rust: make rustfmt optional
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--meson.build11
1 files changed, 11 insertions, 0 deletions
diff --git a/meson.build b/meson.build
index 11958c67b5..dfa37e0caa 100644
--- a/meson.build
+++ b/meson.build
@@ -117,6 +117,10 @@ if have_rust
   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')
@@ -3995,6 +3999,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']