[Spice-commits] 3 commits - common/meson.build

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Apr 4 17:11:01 UTC 2019


 common/meson.build |   97 +++++++++++++++++++++++++++++++++--------------------
 1 file changed, 62 insertions(+), 35 deletions(-)

New commits:
commit 47ba8e0f25ddba110fe77ba55ad5da570f4582bd
Author: Eduardo Lima (Etrunko) <etrunko at redhat.com>
Date:   Thu Apr 4 12:22:19 2019 -0300

    meson: Make targets list store dictionaries instead of lists
    
    Access the items by names instead of indexes.
    
    Signed-off-by: Eduardo Lima (Etrunko) <etrunko at redhat.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/common/meson.build b/common/meson.build
index 980a32a..9a2725f 100644
--- a/common/meson.build
+++ b/common/meson.build
@@ -136,35 +136,47 @@ if spice_common_generate_server_code
   ]
 
   targets = [
-    ['server_demarshallers', [ spice_proto, client_demarshallers ],
-      ['generated_server_demarshallers.c'],
-      ['--generate-demarshallers', '--server', '--include', 'common/messages.h', '@INPUT0@', '@OUTPUT0@']
-    ],
-    ['server_marshallers', [ spice_proto, client_demarshallers ],
-      ['generated_server_marshallers.c', 'generated_server_marshallers.h'],
-      ['--generate-marshallers', '--generate-header',
-        '--server'] + structs_args + ['--include', 'common/messages.h', '@INPUT0@', '@OUTPUT0@'
-      ]
-    ],
+    { 'name' : 'server_demarshallers',
+      'input' : [ spice_proto, client_demarshallers ],
+      'output' : ['generated_server_demarshallers.c'],
+      'codegen_args' : ['--generate-demarshallers',
+                        '--server',
+                        '--include', 'common/messages.h',
+                        '@INPUT0@', '@OUTPUT0@'],
+    },
+    { 'name' : 'server_marshallers',
+      'input' : [ spice_proto, client_demarshallers ],
+      'output' : ['generated_server_marshallers.c', 'generated_server_marshallers.h'],
+      'codegen_args' : ['--generate-marshallers',
+                        '--generate-header',
+                        '--server',
+                        structs_args,
+                        '--include', 'common/messages.h',
+                        '@INPUT0@', '@OUTPUT0@']
+    },
   ]
 
   spice_common_server_sources = []
+  spice_common_server_dep_sources = []
 
   foreach t : targets
-    target = custom_target(t[0],
-                           input : t[1],
-                           output : t[2],
+    target = custom_target(t['name'],
+                           input : t['input'],
+                           output : t['output'],
                            install : false,
-                           command : [codegen_cmd, t[3]],
+                           command : [codegen_cmd, t['codegen_args']],
                            depend_files : [spice_codegen_files, 'messages.h'])
     spice_common_server_sources += target
+    if t['output'].length() > 1
+      spice_common_server_dep_sources += target[1]
+    endif
   endforeach
 
   spice_common_server_lib = static_library('spice-common-server', spice_common_server_sources,
                                            install : false,
                                            dependencies : spice_common_dep)
 
-  spice_common_server_dep = declare_dependency(sources : target[1],
+  spice_common_server_dep = declare_dependency(sources : spice_common_server_dep_sources,
                                                link_with : spice_common_server_lib,
                                                dependencies : spice_common_dep)
 endif
commit bfebdc5eb4a56e8ef9a46a316c859d2525246894
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Thu Apr 4 12:22:18 2019 -0300

    meson: Do not build generated files twice
    
    spice-gtk and spice-server will use spice_common_client_dep
    and spice_common_server_dep as dependencies.
    However they will depend on both spice-common client/server
    libraries and their sources causing the sources to be compiled
    multiple times and causes linker errors on spice-gtk.
    The issue can be observed doing a "find -name \*generated\*.o"
    in Meson build directory.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Signed-off-by: Eduardo Lima (Etrunko) <etrunko at redhat.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/common/meson.build b/common/meson.build
index e5629af..980a32a 100644
--- a/common/meson.build
+++ b/common/meson.build
@@ -106,7 +106,7 @@ if spice_common_generate_client_code
                                            install : false,
                                            dependencies : spice_common_dep)
 
-  spice_common_client_dep = declare_dependency(sources : client_marshallers,
+  spice_common_client_dep = declare_dependency(sources : client_marshallers[1],
                                                link_with : spice_common_client_lib,
                                                dependencies : spice_common_dep)
 endif
@@ -164,7 +164,7 @@ if spice_common_generate_server_code
                                            install : false,
                                            dependencies : spice_common_dep)
 
-  spice_common_server_dep = declare_dependency(sources : target,
+  spice_common_server_dep = declare_dependency(sources : target[1],
                                                link_with : spice_common_server_lib,
                                                dependencies : spice_common_dep)
 endif
commit f236c1ef94ec63458722f9ae22ad11fc3012daf3
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Thu Apr 4 12:22:17 2019 -0300

    meson: Fix dependency of generated files
    
    All generated file depends on generated_messages.h which is
    generated too.
    So add an explicit dependency from all generated file
    (except generated_messages.h generator) to generated_messages.h
    generator.
    This fixes compiling SPICE server where generated_messages.h
    was not generated at all.
    Add dependency to the include header to make Meson generate the
    proper include flag.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Signed-off-by: Eduardo Lima (Etrunko) <etrunko at redhat.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/common/meson.build b/common/meson.build
index 2d76d2b..e5629af 100644
--- a/common/meson.build
+++ b/common/meson.build
@@ -59,46 +59,54 @@ spice_common_dep = declare_dependency(link_with : spice_common_lib,
                                       include_directories : spice_common_include,
                                       dependencies : spice_common_deps)
 
+
+# client_demarshallers
+codegen_cmd = [python, spice_codegen]
+codegen_args = ['--generate-demarshallers',
+                '--client',
+                '--include', 'common/messages.h',
+                '--generated-declaration-file', '@OUTPUT1@',
+                '@INPUT@', '@OUTPUT0@']
+
+client_demarshallers = custom_target('client_demarshallers',
+                                     input : [spice_proto],
+                                     output : ['generated_client_demarshallers.c', 'generated_messages.h'],
+                                     install : false,
+                                     command : [codegen_cmd, codegen_args],
+                                     depend_files : [spice_codegen_files, 'messages.h'])
+
 #
 # libspice-common-client
 #
 if spice_common_generate_client_code
-  targets = [
-    ['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',
-        '-P', '--client', '--include', 'client_marshallers.h',
-        '@INPUT@', '@OUTPUT0@'
-      ]
-    ]
-  ]
+  # client_marshallers
+  codegen_args = ['--generate-marshallers',
+                  '--generate-header',
+                  '-P',
+                  '--client',
+                  '--include', 'common/client_marshallers.h',
+                  '@INPUT0@', '@OUTPUT0@']
+
+  client_marshallers = custom_target('client_marshallers',
+                                     input : [spice_proto, client_demarshallers],
+                                     output : ['generated_client_marshallers.c', 'generated_client_marshallers.h'],
+                                     install : false,
+                                     command : [codegen_cmd, codegen_args],
+                                     depend_files : [spice_codegen_files, 'client_marshallers.h'])
 
   spice_common_client_sources = [
+    client_demarshallers,
+    client_marshallers,
     'client_marshallers.h',
     'ssl_verify.c',
     'ssl_verify.h',
   ]
 
-  foreach t : targets
-    cmd = [python, spice_codegen] + t[3]
-    target = custom_target(t[0], input : t[1], output : t[2], install : false, command : cmd, depend_files : spice_codegen_files)
-    spice_common_client_sources += target
-  endforeach
-
   spice_common_client_lib = static_library('spice-common-client', spice_common_client_sources,
                                            install : false,
                                            dependencies : spice_common_dep)
 
-  spice_common_client_dep = declare_dependency(sources : target,
+  spice_common_client_dep = declare_dependency(sources : client_marshallers,
                                                link_with : spice_common_client_lib,
                                                dependencies : spice_common_dep)
 endif
@@ -128,11 +136,14 @@ if spice_common_generate_server_code
   ]
 
   targets = [
-    ['server_demarshallers', spice_proto, 'generated_server_demarshallers.c', ['--generate-demarshallers', '--server', '--include', 'common/messages.h', '@INPUT@', '@OUTPUT@']],
-    ['server_marshallers', spice_proto,
+    ['server_demarshallers', [ spice_proto, client_demarshallers ],
+      ['generated_server_demarshallers.c'],
+      ['--generate-demarshallers', '--server', '--include', 'common/messages.h', '@INPUT0@', '@OUTPUT0@']
+    ],
+    ['server_marshallers', [ spice_proto, client_demarshallers ],
       ['generated_server_marshallers.c', 'generated_server_marshallers.h'],
       ['--generate-marshallers', '--generate-header',
-        '--server'] + structs_args + ['--include', 'common/messages.h', '@INPUT@', '@OUTPUT0@'
+        '--server'] + structs_args + ['--include', 'common/messages.h', '@INPUT0@', '@OUTPUT0@'
       ]
     ],
   ]
@@ -140,8 +151,12 @@ if spice_common_generate_server_code
   spice_common_server_sources = []
 
   foreach t : targets
-    cmd = [python, spice_codegen] + t[3]
-    target = custom_target(t[0], input : t[1], output : t[2], install : false, command : cmd, depend_files : spice_codegen_files)
+    target = custom_target(t[0],
+                           input : t[1],
+                           output : t[2],
+                           install : false,
+                           command : [codegen_cmd, t[3]],
+                           depend_files : [spice_codegen_files, 'messages.h'])
     spice_common_server_sources += target
   endforeach
 


More information about the Spice-commits mailing list