From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: manos.pitsidianakis@linaro.org, zhao1.liu@intel.com,
junjie.mao@intel.com, pierrick.bouvier@linaro.org,
alex.bennee@linaro.org
Subject: [PULL 02/12] build-sys: Add rust feature option
Date: Mon, 7 Oct 2024 13:03:30 +0200 [thread overview]
Message-ID: <20241007110342.1298598-3-pbonzini@redhat.com> (raw)
In-Reply-To: <20241007110342.1298598-1-pbonzini@redhat.com>
From: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Add rust feature in meson.build, configure, to prepare for adding Rust
code in the followup commits.
Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Link: https://lore.kernel.org/r/14642d80fbccbc60f7aa78b449a7deb5e2784ed9.1727961605.git.manos.pitsidianakis@linaro.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
MAINTAINERS | 5 +++++
meson.build | 22 +++++++++++++++++++++-
Kconfig | 1 +
Kconfig.host | 3 +++
meson_options.txt | 3 +++
rust/Kconfig | 0
scripts/meson-buildoptions.sh | 3 +++
7 files changed, 36 insertions(+), 1 deletion(-)
create mode 100644 rust/Kconfig
diff --git a/MAINTAINERS b/MAINTAINERS
index 72359066d39..fb3188c053e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4188,6 +4188,11 @@ F: docs/sphinx/
F: docs/_templates/
F: docs/devel/docs.rst
+Rust build system integration
+M: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
+S: Maintained
+F: rust/Kconfig
+
Miscellaneous
-------------
Performance Tools and Tests
diff --git a/meson.build b/meson.build
index e6a65463ff9..93ddaef500f 100644
--- a/meson.build
+++ b/meson.build
@@ -70,6 +70,19 @@ if host_os == 'darwin' and \
all_languages += ['objc']
objc = meson.get_compiler('objc')
endif
+have_rust = false
+if not get_option('rust').disabled() and add_languages('rust', required: get_option('rust'), native: false)
+ rustc = meson.get_compiler('rust')
+ have_rust = true
+ if rustc.version().version_compare('<1.80.0')
+ if get_option('rust').enabled()
+ error('rustc version ' + rustc.version() + ' is unsupported: Please upgrade to at least 1.80.0')
+ else
+ warning('rustc version ' + rustc.version() + ' is unsupported: Disabling Rust compilation. Please upgrade to at least 1.80.0 to use Rust.')
+ have_rust = false
+ endif
+ endif
+endif
dtrace = not_found
stap = not_found
@@ -2158,6 +2171,7 @@ endif
config_host_data = configuration_data()
+config_host_data.set('CONFIG_HAVE_RUST', have_rust)
audio_drivers_selected = []
if have_system
audio_drivers_available = {
@@ -3097,7 +3111,8 @@ host_kconfig = \
(host_os == 'linux' ? ['CONFIG_LINUX=y'] : []) + \
(multiprocess_allowed ? ['CONFIG_MULTIPROCESS_ALLOWED=y'] : []) + \
(vfio_user_server_allowed ? ['CONFIG_VFIO_USER_SERVER_ALLOWED=y'] : []) + \
- (hv_balloon ? ['CONFIG_HV_BALLOON_POSSIBLE=y'] : [])
+ (hv_balloon ? ['CONFIG_HV_BALLOON_POSSIBLE=y'] : []) + \
+ (have_rust ? ['CONFIG_HAVE_RUST=y'] : [])
ignored = [ 'TARGET_XML_FILES', 'TARGET_ABI_DIR', 'TARGET_ARCH' ]
@@ -4308,6 +4323,11 @@ if 'objc' in all_languages
else
summary_info += {'Objective-C compiler': false}
endif
+summary_info += {'Rust support': have_rust}
+if have_rust
+ summary_info += {'rustc version': rustc.version()}
+ summary_info += {'rustc': ' '.join(rustc.cmd_array())}
+endif
option_cflags = (get_option('debug') ? ['-g'] : [])
if get_option('optimization') != 'plain'
option_cflags += ['-O' + get_option('optimization')]
diff --git a/Kconfig b/Kconfig
index fb6a24a2de8..63ca7f46df7 100644
--- a/Kconfig
+++ b/Kconfig
@@ -4,3 +4,4 @@ source accel/Kconfig
source target/Kconfig
source hw/Kconfig
source semihosting/Kconfig
+source rust/Kconfig
diff --git a/Kconfig.host b/Kconfig.host
index 17f405004b3..4ade7899d67 100644
--- a/Kconfig.host
+++ b/Kconfig.host
@@ -52,3 +52,6 @@ config VFIO_USER_SERVER_ALLOWED
config HV_BALLOON_POSSIBLE
bool
+
+config HAVE_RUST
+ bool
diff --git a/meson_options.txt b/meson_options.txt
index 5ee1d95c9ca..5a5c2300261 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -373,3 +373,6 @@ option('hexagon_idef_parser', type : 'boolean', value : true,
option('x86_version', type : 'combo', choices : ['0', '1', '2', '3', '4'], value: '1',
description: 'tweak required x86_64 architecture version beyond compiler default')
+
+option('rust', type: 'feature', value: 'auto',
+ description: 'Rust support')
diff --git a/rust/Kconfig b/rust/Kconfig
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
index 3bee1c56df3..6d08605b771 100644
--- a/scripts/meson-buildoptions.sh
+++ b/scripts/meson-buildoptions.sh
@@ -172,6 +172,7 @@ meson_options_help() {
printf "%s\n" ' rbd Ceph block device driver'
printf "%s\n" ' rdma Enable RDMA-based migration'
printf "%s\n" ' replication replication support'
+ printf "%s\n" ' rust Rust support'
printf "%s\n" ' rutabaga-gfx rutabaga_gfx support'
printf "%s\n" ' sdl SDL user interface'
printf "%s\n" ' sdl-image SDL Image support for icons'
@@ -456,6 +457,8 @@ _meson_option_parse() {
--disable-replication) printf "%s" -Dreplication=disabled ;;
--enable-rng-none) printf "%s" -Drng_none=true ;;
--disable-rng-none) printf "%s" -Drng_none=false ;;
+ --enable-rust) printf "%s" -Drust=enabled ;;
+ --disable-rust) printf "%s" -Drust=disabled ;;
--enable-rutabaga-gfx) printf "%s" -Drutabaga_gfx=enabled ;;
--disable-rutabaga-gfx) printf "%s" -Drutabaga_gfx=disabled ;;
--enable-safe-stack) printf "%s" -Dsafe_stack=true ;;
--
2.46.1
next prev parent reply other threads:[~2024-10-07 11:06 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-07 11:03 [PULL 00/12] Rust initial PoC + meson changes for 2024-10-07 Paolo Bonzini
2024-10-07 11:03 ` [PULL 01/12] Require meson version 1.5.0 Paolo Bonzini
2024-10-07 11:03 ` Paolo Bonzini [this message]
2024-10-07 11:03 ` [PULL 03/12] configure, meson: detect Rust toolchain Paolo Bonzini
2024-10-07 11:03 ` [PULL 04/12] rust: add bindgen step as a meson dependency Paolo Bonzini
2024-10-07 11:03 ` [PULL 05/12] .gitattributes: add Rust diff and merge attributes Paolo Bonzini
2024-10-07 11:03 ` [PULL 06/12] meson.build: add HAVE_GLIB_WITH_ALIGNED_ALLOC flag Paolo Bonzini
2024-10-07 11:03 ` [PULL 07/12] rust: add crate to expose bindings and interfaces Paolo Bonzini
2024-10-07 11:03 ` [PULL 08/12] rust: add utility procedural macro crate Paolo Bonzini
2024-10-07 11:03 ` [PULL 09/12] rust: add PL011 device model Paolo Bonzini
2024-10-07 11:03 ` [PULL 10/12] meson: fix machine option for x86_version Paolo Bonzini
2024-10-07 11:03 ` [PULL 11/12] meson: define qemu_isa_flags Paolo Bonzini
2024-10-07 11:03 ` [PULL 12/12] meson: ensure -mcx16 is passed when detecting ATOMIC128 Paolo Bonzini
2024-10-07 11:11 ` [PULL 00/12] Rust initial PoC + meson changes for 2024-10-07 Daniel P. Berrangé
2024-10-07 11:26 ` Paolo Bonzini
2024-10-07 11:47 ` Daniel P. Berrangé
2024-10-07 11:52 ` Daniel P. Berrangé
2024-10-07 15:51 ` Paolo Bonzini
2024-10-07 17:56 ` Brian Cain
2024-10-07 19:15 ` Paolo Bonzini
2024-10-08 3:27 ` Brian Cain
2024-10-08 3:39 ` Pierrick Bouvier
2024-10-08 10:01 ` Alex Bennée
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241007110342.1298598-3-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=junjie.mao@intel.com \
--cc=manos.pitsidianakis@linaro.org \
--cc=pierrick.bouvier@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=zhao1.liu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).