qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v3 11/16] qemu-common: introduce a common subproject


From: marcandre . lureau
Subject: [PATCH v3 11/16] qemu-common: introduce a common subproject
Date: Wed, 10 Aug 2022 16:48:52 +0400

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Add a new meson subproject to provide common code and scripts for QEMU
and tools. Initially, it will offer QAPI/QMP code generation and
common utilities.

libvhost-user & libvduse will make use of the subproject to avoid having
include/ links to common headers.

The other targeted user is qemu-ga, which will also be converted to a
subproject (so it can be built, moved, released etc independent from QEMU).

Other projects such as qemu-storage-daemon could be built standalone
eventually in the future.

Note that with meson subprojects are "global". Projects will share
subprojects 
(https://mesonbuild.com/Subprojects.html#subprojects-depending-on-other-subprojects).
We will add extra subprojects/ links to allow standalone subproject
compilation though.

This initial commit simply set the stage to build and link against it.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 meson.build                                              | 9 ++++++++-
 .../qemu-common/include}/qemu/help-texts.h               | 0
 subprojects/libvduse/meson.build                         | 2 ++
 subprojects/libvduse/subprojects/qemu-common             | 1 +
 subprojects/libvhost-user/meson.build                    | 2 ++
 subprojects/libvhost-user/subprojects/qemu-common        | 1 +
 subprojects/qemu-common/meson.build                      | 8 ++++++++
 7 files changed, 22 insertions(+), 1 deletion(-)
 rename {include => subprojects/qemu-common/include}/qemu/help-texts.h (100%)
 create mode 120000 subprojects/libvduse/subprojects/qemu-common
 create mode 120000 subprojects/libvhost-user/subprojects/qemu-common
 create mode 100644 subprojects/qemu-common/meson.build

diff --git a/meson.build b/meson.build
index 294e9a8f32..a47ce88c84 100644
--- a/meson.build
+++ b/meson.build
@@ -169,6 +169,10 @@ if 'dtrace' in get_option('trace_backends')
   endif
 endif
 
+add_project_arguments('-I' + meson.current_source_dir() / 
'subprojects/qemu-common/include',
+  language: ['c', 'cpp', 'objc'],
+)
+
 if get_option('iasl') == ''
   iasl = find_program('iasl', required: false)
 else
@@ -1583,6 +1587,9 @@ if libbpf.found() and not cc.links('''
   endif
 endif
 
+qemu_common = subproject('qemu-common')
+qemu_common = qemu_common.get_variable('qemu_common_dep')
+
 #################
 # config-host.h #
 #################
@@ -3057,7 +3064,7 @@ util_ss.add_all(trace_ss)
 util_ss = util_ss.apply(config_all, strict: false)
 libqemuutil = static_library('qemuutil',
                              sources: util_ss.sources() + stub_ss.sources() + 
genh,
-                             dependencies: [util_ss.dependencies(), libm, 
threads, glib, socket, malloc, pixman])
+                             dependencies: [util_ss.dependencies(), libm, 
threads, glib, socket, malloc, pixman, qemu_common])
 qemuutil = declare_dependency(link_with: libqemuutil,
                               sources: genh + version_res,
                               dependencies: [event_loop_base])
diff --git a/include/qemu/help-texts.h 
b/subprojects/qemu-common/include/qemu/help-texts.h
similarity index 100%
rename from include/qemu/help-texts.h
rename to subprojects/qemu-common/include/qemu/help-texts.h
diff --git a/subprojects/libvduse/meson.build b/subprojects/libvduse/meson.build
index ba08f5ee1a..841509ecb9 100644
--- a/subprojects/libvduse/meson.build
+++ b/subprojects/libvduse/meson.build
@@ -2,6 +2,8 @@ project('libvduse', 'c',
         license: 'GPL-2.0-or-later',
         default_options: ['c_std=gnu99'])
 
+qemu_common = subproject('qemu-common')
+
 libvduse = static_library('vduse',
                           files('libvduse.c'),
                           c_args: '-D_GNU_SOURCE')
diff --git a/subprojects/libvduse/subprojects/qemu-common 
b/subprojects/libvduse/subprojects/qemu-common
new file mode 120000
index 0000000000..4c1c87018a
--- /dev/null
+++ b/subprojects/libvduse/subprojects/qemu-common
@@ -0,0 +1 @@
+../../qemu-common
\ No newline at end of file
diff --git a/subprojects/libvhost-user/meson.build 
b/subprojects/libvhost-user/meson.build
index 39825d9404..73355908e0 100644
--- a/subprojects/libvhost-user/meson.build
+++ b/subprojects/libvhost-user/meson.build
@@ -5,6 +5,8 @@ project('libvhost-user', 'c',
 threads = dependency('threads')
 glib = dependency('glib-2.0')
 
+qemu_common = subproject('qemu-common')
+
 vhost_user = static_library('vhost-user',
                             files('libvhost-user.c'),
                             dependencies: threads,
diff --git a/subprojects/libvhost-user/subprojects/qemu-common 
b/subprojects/libvhost-user/subprojects/qemu-common
new file mode 120000
index 0000000000..4c1c87018a
--- /dev/null
+++ b/subprojects/libvhost-user/subprojects/qemu-common
@@ -0,0 +1 @@
+../../qemu-common
\ No newline at end of file
diff --git a/subprojects/qemu-common/meson.build 
b/subprojects/qemu-common/meson.build
new file mode 100644
index 0000000000..8969b08473
--- /dev/null
+++ b/subprojects/qemu-common/meson.build
@@ -0,0 +1,8 @@
+project('qemu-common', 'c',
+  license: 'GPL-2.0-or-later',
+  default_options: ['c_std=gnu11']
+)
+
+qemu_common_dep = declare_dependency(
+  include_directories: include_directories('include'),
+)
-- 
2.37.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]