[PATCH spice-common v2 2/2] meson: Do not build generated files twice

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

 



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@xxxxxxxxxx>
---
 common/meson.build | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/common/meson.build b/common/meson.build
index 2b7bef0..9eace62 100644
--- a/common/meson.build
+++ b/common/meson.build
@@ -97,11 +97,13 @@ if spice_common_generate_client_code
     'ssl_verify.h',
   ]
 
+  target_headers = []
   spice_common_client_sources += common_generated
   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 + ['client_marshallers.h'])
+    target_headers += target[1]
     spice_common_client_sources += target
   endforeach
 
@@ -109,7 +111,7 @@ if spice_common_generate_client_code
                                            install : false,
                                            dependencies : spice_common_dep)
 
-  spice_common_client_dep = declare_dependency(sources : target,
+  spice_common_client_dep = declare_dependency(sources : target_headers,
                                                link_with : spice_common_client_lib,
                                                dependencies : spice_common_dep)
 endif
@@ -153,10 +155,14 @@ if spice_common_generate_server_code
 
   spice_common_server_sources = []
 
+  target_headers = []
   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 + ['messages.h'])
+    if t[2].length() > 1
+      target_headers += target[1]
+    endif
     spice_common_server_sources += target
   endforeach
 
@@ -164,7 +170,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_headers,
                                                link_with : spice_common_server_lib,
                                                dependencies : spice_common_dep)
 endif
-- 
2.20.1

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]