[Spice-devel] [PATCH spice-common v3 4/5] Allow to generate C declarations for spice.proto

Frediano Ziglio fziglio at redhat.com
Mon Mar 11 13:59:13 UTC 2019


Generate and include C declarations.
Next patch will use this facility.
Since none of the spice.proto types are decorated with @declare,
adding the #include in messages.h won't have any bad consequences.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 common/Makefile.am |  6 ++++--
 common/meson.build | 10 +++++++++-
 common/messages.h  |  2 ++
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/common/Makefile.am b/common/Makefile.am
index 0ad448b..44b2616 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -109,8 +109,9 @@ MARSHALLERS_DEPS =					\
 
 # Note despite being autogenerated these are not part of CLEANFILES, they are
 # actually a part of EXTRA_DIST, to avoid the need for pyparser by end users
-generated_client_demarshallers.c: $(top_srcdir)/spice.proto $(MARSHALLERS_DEPS)
-	$(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-demarshallers --client --include common/messages.h $< $@ >/dev/null
+generated_client_demarshallers.c generated_messages.h: $(top_srcdir)/spice.proto $(MARSHALLERS_DEPS)
+	$(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-demarshallers --client --include common/messages.h \
+	--generated-declaration-file generated_messages.h $< $@ >/dev/null
 
 generated_client_marshallers.c generated_client_marshallers.h: $(top_srcdir)/spice.proto $(MARSHALLERS_DEPS)
 	$(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-marshallers -P --include client_marshallers.h --client \
@@ -127,6 +128,7 @@ generated_server_marshallers.c generated_server_marshallers.h: $(top_srcdir)/spi
 EXTRA_DIST =				\
 	$(CLIENT_MARSHALLERS)		\
 	$(SERVER_MARSHALLERS)		\
+	generated_messages.h		\
 	meson.build			\
 	canvas_base.c			\
 	canvas_base.h			\
diff --git a/common/meson.build b/common/meson.build
index b1e58c5..2d76d2b 100644
--- a/common/meson.build
+++ b/common/meson.build
@@ -64,7 +64,15 @@ spice_common_dep = declare_dependency(link_with : spice_common_lib,
 #
 if spice_common_generate_client_code
   targets = [
-    ['client_demarshallers', spice_proto, 'generated_client_demarshallers.c', ['--generate-demarshallers', '--client', '--include', 'common/messages.h', '@INPUT@', '@OUTPUT@']],
+    ['client_demarshallers', spice_proto,
+      ['generated_client_demarshallers.c', 'generated_messages.h'],
+      ['--generate-demarshallers',
+        '--client',
+        '--include', 'common/messages.h',
+        '--generated-declaration-file', '@OUTPUT1@',
+        '@INPUT@', '@OUTPUT0@'
+      ]
+    ],
     ['client_marshallers', spice_proto,
       ['generated_client_marshallers.c', 'generated_client_marshallers.h'],
       ['--generate-marshallers', '--generate-header',
diff --git a/common/messages.h b/common/messages.h
index f740a8c..36ee59d 100644
--- a/common/messages.h
+++ b/common/messages.h
@@ -558,6 +558,8 @@ typedef struct SpiceMsgDisplayGlDraw {
     uint32_t h;
 } SpiceMsgDisplayGlDraw;
 
+#include <common/generated_messages.h>
+
 SPICE_END_DECLS
 
 #endif // H_SPICE_COMMON_MESSAGES
-- 
2.20.1



More information about the Spice-devel mailing list