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

Frediano Ziglio fziglio at redhat.com
Thu Feb 21 10:38:06 UTC 2019


Generate and include C declarations.
Next patch will use this facility.

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 3da5bad..411831b 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 \
@@ -135,6 +136,7 @@ EXTRA_DIST =				\
 	quic_family_tmpl.c		\
 	quic_tmpl.c			\
 	snd_codec.h			\
+	generated_messages.h		\
 	$(NULL)
 
 -include $(top_srcdir)/git.mk
diff --git a/common/meson.build b/common/meson.build
index 9575568..2d769f2 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',
diff --git a/common/messages.h b/common/messages.h
index 91ac7ad..aae3212 100644
--- a/common/messages.h
+++ b/common/messages.h
@@ -657,6 +657,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