Hi Helge

On Sun, Apr 17, 2022 at 6:51 PM Helge Konetzka <hk@zapateado.de> wrote:
Generation with widl needs to be triggered explicitly and requires
library and include directories containing referenced *.idl and *.tlb
as parameters.

Ok, that's different issues, it would help to split the patch.
 

Signed-off-by: Helge Konetzka <hk@zapateado.de>
---

For tested Msys2 build all referenced resources reside in /<usr>/include.
Msys2 provides its flavours in different /<usr> bases.

This patch derives the missing include directory path from widl path.
Assuming the given widl path is /<usr>/bin/widl, it determines /<usr>
as base and appends /<usr>/include as include and library directories
to widl command. This way the directory is correct for any Msys2
flavour.
It makes sure, only existing directories are appended as parameter.

I would file a bug to msys2 instead for widl to use the default include directory. Otherwise, every widl user out there needs to be adjusted.
(I think it would need a special --with-widl-includedir=DIR, given how msys2 remaps directory)


---
  qga/vss-win32/meson.build | 11 +++++++++--
  1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/qga/vss-win32/meson.build b/qga/vss-win32/meson.build
index 71c50d0866..51539a582c 100644
--- a/qga/vss-win32/meson.build
+++ b/qga/vss-win32/meson.build
@@ -30,9 +30,16 @@ if midl.found()
                            input: 'qga-vss.idl',
                            output: 'qga-vss.tlb',
                            command: [midl, '@INPUT@', '/tlb', '@OUTPUT@'])
-else
+elif widl.found()
+  widl_cmd = [widl, '-t', '@INPUT@', '-o', '@OUTPUT@']
+  usr_include = fs.parent(fs.parent(widl.full_path()))/'include'
+  if fs.is_dir(usr_include)
+    widl_cmd += ['-L', usr_include]
+    widl_cmd += ['-I', usr_include]
+  endif
    gen_tlb = custom_target('gen-tlb',
                            input: 'qga-vss.idl',
                            output: 'qga-vss.tlb',
-                          command: [widl, '-t', '@INPUT@', '-o',
'@OUTPUT@'])
+                          build_by_default: true,

I would make qga_vss depend on gen_tlb instead (so the tlb is always built with the dll)

thanks

--
Marc-André Lureau