qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Subject: [PATCH 33/34] meson: use have_vhost_* variables to pick sources
Date: Wed, 20 Apr 2022 17:34:06 +0200	[thread overview]
Message-ID: <20220420153407.73926-34-pbonzini@redhat.com> (raw)
In-Reply-To: <20220420153407.73926-1-pbonzini@redhat.com>

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 Kconfig.host            |  3 ---
 backends/meson.build    |  8 ++++++--
 hw/net/meson.build      |  8 ++++++--
 hw/virtio/Kconfig       |  3 ---
 hw/virtio/meson.build   | 25 ++++++++++++++++---------
 meson.build             |  1 +
 net/meson.build         | 12 +++++++-----
 tests/qtest/meson.build |  4 +++-
 8 files changed, 39 insertions(+), 25 deletions(-)

diff --git a/Kconfig.host b/Kconfig.host
index 60b9c07b5e..1165c4eacd 100644
--- a/Kconfig.host
+++ b/Kconfig.host
@@ -22,15 +22,12 @@ config TPM
 
 config VHOST_USER
     bool
-    select VHOST
 
 config VHOST_VDPA
     bool
-    select VHOST
 
 config VHOST_KERNEL
     bool
-    select VHOST
 
 config VIRTFS
     bool
diff --git a/backends/meson.build b/backends/meson.build
index 535c3ca7dd..b1884a88ec 100644
--- a/backends/meson.build
+++ b/backends/meson.build
@@ -12,9 +12,13 @@ softmmu_ss.add([files(
 softmmu_ss.add(when: 'CONFIG_POSIX', if_true: files('rng-random.c'))
 softmmu_ss.add(when: 'CONFIG_POSIX', if_true: files('hostmem-file.c'))
 softmmu_ss.add(when: 'CONFIG_LINUX', if_true: files('hostmem-memfd.c'))
-softmmu_ss.add(when: ['CONFIG_VHOST_USER', 'CONFIG_VIRTIO'], if_true: files('vhost-user.c'))
+if have_vhost_user
+  softmmu_ss.add(when: 'CONFIG_VIRTIO', if_true: files('vhost-user.c'))
+endif
 softmmu_ss.add(when: 'CONFIG_VIRTIO_CRYPTO', if_true: files('cryptodev-vhost.c'))
-softmmu_ss.add(when: ['CONFIG_VIRTIO_CRYPTO', 'CONFIG_VHOST_CRYPTO'], if_true: files('cryptodev-vhost-user.c'))
+if have_vhost_user_crypto
+  softmmu_ss.add(when: 'CONFIG_VIRTIO_CRYPTO', if_true: files('cryptodev-vhost-user.c'))
+endif
 softmmu_ss.add(when: gio, if_true: files('dbus-vmstate.c'))
 softmmu_ss.add(when: 'CONFIG_SGX', if_true: files('hostmem-epc.c'))
 
diff --git a/hw/net/meson.build b/hw/net/meson.build
index 685b75badb..ebac261542 100644
--- a/hw/net/meson.build
+++ b/hw/net/meson.build
@@ -46,8 +46,12 @@ specific_ss.add(when: 'CONFIG_XILINX_ETHLITE', if_true: files('xilinx_ethlite.c'
 softmmu_ss.add(when: 'CONFIG_VIRTIO_NET', if_true: files('net_rx_pkt.c'))
 specific_ss.add(when: 'CONFIG_VIRTIO_NET', if_true: files('virtio-net.c'))
 
-softmmu_ss.add(when: ['CONFIG_VIRTIO_NET', 'CONFIG_VHOST_NET'], if_true: files('vhost_net.c'), if_false: files('vhost_net-stub.c'))
-softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('vhost_net-stub.c'))
+if have_vhost_net
+  softmmu_ss.add(when: 'CONFIG_VIRTIO_NET', if_true: files('vhost_net.c'), if_false: files('vhost_net-stub.c'))
+  softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('vhost_net-stub.c'))
+else
+  softmmu_ss.add(files('vhost_net-stub.c'))
+endif
 
 softmmu_ss.add(when: 'CONFIG_ETSEC', if_true: files(
   'fsl_etsec/etsec.c',
diff --git a/hw/virtio/Kconfig b/hw/virtio/Kconfig
index f8e235f814..e9ecae1f50 100644
--- a/hw/virtio/Kconfig
+++ b/hw/virtio/Kconfig
@@ -1,6 +1,3 @@
-config VHOST
-    bool
-
 config VIRTIO
     bool
 
diff --git a/hw/virtio/meson.build b/hw/virtio/meson.build
index f371404b04..7e8877fd64 100644
--- a/hw/virtio/meson.build
+++ b/hw/virtio/meson.build
@@ -2,18 +2,22 @@ softmmu_virtio_ss = ss.source_set()
 softmmu_virtio_ss.add(files('virtio-bus.c'))
 softmmu_virtio_ss.add(when: 'CONFIG_VIRTIO_PCI', if_true: files('virtio-pci.c'))
 softmmu_virtio_ss.add(when: 'CONFIG_VIRTIO_MMIO', if_true: files('virtio-mmio.c'))
-softmmu_virtio_ss.add(when: 'CONFIG_VHOST', if_false: files('vhost-stub.c'))
-
-softmmu_ss.add_all(when: 'CONFIG_VIRTIO', if_true: softmmu_virtio_ss)
-softmmu_ss.add(when: 'CONFIG_VIRTIO', if_false: files('vhost-stub.c'))
-
-softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('vhost-stub.c'))
 
 virtio_ss = ss.source_set()
 virtio_ss.add(files('virtio.c'))
-virtio_ss.add(when: 'CONFIG_VHOST', if_true: files('vhost.c', 'vhost-backend.c', 'vhost-iova-tree.c'))
-virtio_ss.add(when: 'CONFIG_VHOST_USER', if_true: files('vhost-user.c'))
-virtio_ss.add(when: 'CONFIG_VHOST_VDPA', if_true: files('vhost-shadow-virtqueue.c', 'vhost-vdpa.c'))
+
+if have_vhost
+  virtio_ss.add(files('vhost.c', 'vhost-backend.c', 'vhost-iova-tree.c'))
+  if have_vhost_user
+    virtio_ss.add(files('vhost-user.c'))
+  endif
+  if have_vhost_vdpa
+    virtio_ss.add(files('vhost-vdpa.c', 'vhost-shadow-virtqueue.c'))
+  endif
+else
+  softmmu_virtio_ss.add(files('vhost-stub.c'))
+endif
+
 virtio_ss.add(when: 'CONFIG_VIRTIO_BALLOON', if_true: files('virtio-balloon.c'))
 virtio_ss.add(when: 'CONFIG_VIRTIO_CRYPTO', if_true: files('virtio-crypto.c'))
 virtio_ss.add(when: 'CONFIG_VHOST_USER_FS', if_true: files('vhost-user-fs.c'))
@@ -54,3 +58,6 @@ virtio_pci_ss.add(when: 'CONFIG_VIRTIO_MEM', if_true: files('virtio-mem-pci.c'))
 virtio_ss.add_all(when: 'CONFIG_VIRTIO_PCI', if_true: virtio_pci_ss)
 
 specific_ss.add_all(when: 'CONFIG_VIRTIO', if_true: virtio_ss)
+softmmu_ss.add_all(when: 'CONFIG_VIRTIO', if_true: softmmu_virtio_ss)
+softmmu_ss.add(when: 'CONFIG_VIRTIO', if_false: files('vhost-stub.c'))
+softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('vhost-stub.c'))
diff --git a/meson.build b/meson.build
index 5b5eb442c4..e8446cf148 100644
--- a/meson.build
+++ b/meson.build
@@ -319,6 +319,7 @@ have_vhost_kernel = 'CONFIG_VHOST_KERNEL' in config_host
 have_vhost_net_user = 'CONFIG_VHOST_NET_USER' in config_host
 have_vhost_net_vdpa = 'CONFIG_VHOST_NET_VDPA' in config_host
 have_vhost_net = 'CONFIG_VHOST_NET' in config_host
+have_vhost = have_vhost_user or have_vhost_vdpa or have_vhost_kernel
 have_vhost_user_crypto = 'CONFIG_VHOST_CRYPTO' in config_host
 
 # Target-specific libraries and flags
diff --git a/net/meson.build b/net/meson.build
index 847bc2ac85..c965e83b26 100644
--- a/net/meson.build
+++ b/net/meson.build
@@ -26,10 +26,10 @@ softmmu_ss.add(when: vde, if_true: files('vde.c'))
 if have_netmap
   softmmu_ss.add(files('netmap.c'))
 endif
-vhost_user_ss = ss.source_set()
-vhost_user_ss.add(when: 'CONFIG_VIRTIO_NET', if_true: files('vhost-user.c'), if_false: files('vhost-user-stub.c'))
-softmmu_ss.add_all(when: 'CONFIG_VHOST_NET_USER', if_true: vhost_user_ss)
-softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('vhost-user-stub.c'))
+if have_vhost_net_user
+  softmmu_ss.add(when: 'CONFIG_VIRTIO_NET', if_true: files('vhost-user.c'), if_false: files('vhost-user-stub.c'))
+  softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('vhost-user-stub.c'))
+endif
 
 softmmu_ss.add(when: 'CONFIG_LINUX', if_true: files('tap-linux.c'))
 softmmu_ss.add(when: 'CONFIG_BSD', if_true: files('tap-bsd.c'))
@@ -40,6 +40,8 @@ if not config_host.has_key('CONFIG_LINUX') and not config_host.has_key('CONFIG_B
 endif
 softmmu_ss.add(when: 'CONFIG_POSIX', if_true: files(tap_posix))
 softmmu_ss.add(when: 'CONFIG_WIN32', if_true: files('tap-win32.c'))
-softmmu_ss.add(when: 'CONFIG_VHOST_NET_VDPA', if_true: files('vhost-vdpa.c'))
+if have_vhost_net_vdpa
+  softmmu_ss.add(files('vhost-vdpa.c'))
+endif
 
 subdir('can')
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
index 69f97b8992..2f2f08b442 100644
--- a/tests/qtest/meson.build
+++ b/tests/qtest/meson.build
@@ -272,7 +272,9 @@ qos_test_ss.add(
 if have_virtfs
   qos_test_ss.add(files('virtio-9p-test.c'))
 endif
-qos_test_ss.add(when: 'CONFIG_VHOST_USER', if_true: files('vhost-user-test.c'))
+if have_vhost_user
+  qos_test_ss.add(files('vhost-user-test.c'))
+endif
 if have_tools and have_vhost_user_blk_server
   qos_test_ss.add(files('vhost-user-blk-test.c'))
 endif
-- 
2.35.1




  parent reply	other threads:[~2022-04-20 16:28 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-20 15:33 [PATCH 00/34] Misc meson conversions for QEMU 7.1 Paolo Bonzini
2022-04-20 15:33 ` [PATCH 01/34] meson: show final set of compiler flags Paolo Bonzini
2022-04-20 15:57   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 02/34] configure: remove dead code Paolo Bonzini
2022-04-20 16:04   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 03/34] qga: wixl: get path to sysroot from pkg-config as intended Paolo Bonzini
2022-04-20 15:47   ` Marc-André Lureau
2022-04-21 14:18   ` Konstantin Kostiuk
2022-04-20 15:33 ` [PATCH 04/34] configure: pc-bios/qemu-icon.bmp does not exist Paolo Bonzini
2022-04-20 15:47   ` Thomas Huth
2022-04-20 16:05   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 05/34] configure: gcov should not exclude fortify-source Paolo Bonzini
2022-04-20 16:06   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 06/34] configure: move --enable/--disable-debug-info to second option parsing pass Paolo Bonzini
2022-04-20 15:42   ` Thomas Huth
2022-04-20 16:08   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 07/34] configure, meson: move OpenGL check to meson Paolo Bonzini
2022-04-20 16:13   ` Marc-André Lureau
2022-04-20 19:17     ` Paolo Bonzini
2022-04-20 15:33 ` [PATCH 08/34] meson, configure: move RDMA options " Paolo Bonzini
2022-04-20 16:24   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 09/34] meson, configure: move keyctl test " Paolo Bonzini
2022-04-20 16:27   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 10/34] meson, configure: move usbfs " Paolo Bonzini
2022-04-20 16:35   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 11/34] meson, configure: move libgio " Paolo Bonzini
2022-04-20 16:40   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 12/34] meson: move CONFIG_XEN_PCI_PASSTHROUGH to config-host.h Paolo Bonzini
2022-04-20 16:45   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 13/34] meson, configure: move --enable-module-upgrades to meson Paolo Bonzini
2022-04-20 18:05   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 14/34] meson, configure: move Xen detection " Paolo Bonzini
2022-04-20 15:33 ` [PATCH 15/34] meson-buildoptions: add support for string options Paolo Bonzini
2022-04-20 18:14   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 16/34] configure, meson: move iasl detection to meson Paolo Bonzini
2022-04-20 18:17   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 17/34] configure: move Windows flags " Paolo Bonzini
2022-04-20 18:20   ` Marc-André Lureau
2022-04-20 19:15     ` Paolo Bonzini
2022-04-20 15:33 ` [PATCH 18/34] configure: switch string options to automatic parsing Paolo Bonzini
2022-04-20 18:23   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 19/34] meson, configure: move --tls-priority to meson Paolo Bonzini
2022-04-20 18:25   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 20/34] meson, configure: move bdrv whitelists " Paolo Bonzini
2022-04-20 18:28   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 21/34] meson, configure: move --with-pkgversion, CONFIG_STAMP " Paolo Bonzini
2022-04-20 18:34   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 22/34] meson, configure: move --interp-prefix " Paolo Bonzini
2022-04-20 18:40   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 23/34] meson: always combine directories with prefix Paolo Bonzini
2022-04-20 18:43   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 24/34] configure: switch directory options to automatic parsing Paolo Bonzini
2022-04-21  9:48   ` Marc-André Lureau
2022-04-21 12:02     ` Paolo Bonzini
2022-04-20 15:33 ` [PATCH 25/34] meson: pass more options directly as -D Paolo Bonzini
2022-04-21  9:52   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 26/34] configure: omit options with default values from meson command line Paolo Bonzini
2022-04-21 10:04   ` Marc-André Lureau
2022-04-20 15:34 ` [PATCH 27/34] meson, virtio: place all virtio-pci devices under virtio_pci_ss Paolo Bonzini
2022-04-21 10:05   ` Marc-André Lureau
2022-04-20 15:34 ` [PATCH 28/34] configure: simplify vhost-net-{user, vdpa} configuration Paolo Bonzini
2022-04-21 10:08   ` Marc-André Lureau
2022-04-20 15:34 ` [PATCH 29/34] build: move vhost-vsock configuration to Kconfig Paolo Bonzini
2022-04-21 11:38   ` Marc-André Lureau
2022-04-20 15:34 ` [PATCH 30/34] build: move vhost-scsi " Paolo Bonzini
2022-04-21 11:47   ` Marc-André Lureau
2022-04-20 15:34 ` [PATCH 31/34] build: move vhost-user-fs " Paolo Bonzini
2022-04-21 11:48   ` Marc-André Lureau
2022-04-20 15:34 ` [PATCH 32/34] meson: create have_vhost_* variables Paolo Bonzini
2022-04-21 12:01   ` Marc-André Lureau
2022-04-20 15:34 ` Paolo Bonzini [this message]
2022-04-21 12:08   ` [PATCH 33/34] meson: use have_vhost_* variables to pick sources Marc-André Lureau
2022-04-20 15:34 ` [PATCH 34/34] configure, meson: move vhost options to Meson Paolo Bonzini
2022-04-21 12:13   ` Marc-André Lureau

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=20220420153407.73926-34-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).