1if add_languages('cpp', required: false)
2  glib_dynamic = dependency('glib-2.0', static: false)
3  link_args = cc.get_supported_link_arguments(['-fstack-protector-all', '-fstack-protector-strong',
4                                               '-Wl,--add-stdcall-alias', '-Wl,--enable-stdcall-fixup'])
5
6  qga_vss = shared_module('qga-vss', ['requester.cpp', 'provider.cpp', 'install.cpp'],
7                name_prefix: '',
8                cpp_args: ['-Wno-unknown-pragmas', '-Wno-delete-non-virtual-dtor', '-Wno-non-virtual-dtor'],
9                link_args: link_args,
10                vs_module_defs: 'qga-vss.def',
11                dependencies: [glib_dynamic, socket,
12                               cc.find_library('ole32'),
13                               cc.find_library('oleaut32'),
14                               cc.find_library('shlwapi'),
15                               cc.find_library('uuid'),
16                               cc.find_library('intl')])
17
18  all_qga += qga_vss
19endif
20
21# rules to build qga-vss.tlb
22# Currently, only native build is supported because building .tlb
23# (TypeLibrary) from .idl requires WindowsSDK and MIDL (and cl.exe in VC++).
24midl = find_program('midl', required: false)
25if midl.found()
26  gen_tlb = custom_target('gen-tlb',
27                          input: 'qga-vss.idl',
28                          output: 'qga-vss.tlb',
29                          command: [midl, '-tlb', '-I' + config_host['WIN_SDK'],
30                                     '@INPUT@', '@OUTPUT@'])
31else
32  gen_tlb = custom_target('gen-tlb',
33                          input: 'qga-vss.tlb',
34                          output: 'qga-vss.tlb',
35                          command: ['cp', '@INPUT@', '@OUTPUT@'])
36endif
37