Merge remote-tracking branch 'remotes/vivier2/tags/trivial-branch-for-5.2-pull-reques...
[qemu.git] / qga / meson.build
1 qga_qapi_outputs = [
2   'qga-qapi-commands.c',
3   'qga-qapi-commands.h',
4   'qga-qapi-emit-events.c',
5   'qga-qapi-emit-events.h',
6   'qga-qapi-events.c',
7   'qga-qapi-events.h',
8   'qga-qapi-init-commands.c',
9   'qga-qapi-init-commands.h',
10   'qga-qapi-introspect.c',
11   'qga-qapi-introspect.h',
12   'qga-qapi-types.c',
13   'qga-qapi-types.h',
14   'qga-qapi-visit.c',
15   'qga-qapi-visit.h',
16 ]
17
18 qga_qapi_files = custom_target('QGA QAPI files',
19                                output: qga_qapi_outputs + ['qga-qapi-doc.texi'],
20                                input: 'qapi-schema.json',
21                                command: [ qapi_gen, '-o', 'qga', '-p', 'qga-', '@INPUT0@' ],
22                                depend_files: qapi_gen_depends)
23
24 qga_ss = ss.source_set()
25 i = 0
26 foreach output: qga_qapi_outputs
27   qga_ss.add(qga_qapi_files[i])
28   i = i + 1
29 endforeach
30 qga_qapi_doc_texi = qga_qapi_files[i]
31
32 qga_ss.add(files(
33   'commands.c',
34   'guest-agent-command-state.c',
35   'main.c',
36 ))
37 qga_ss.add(when: 'CONFIG_POSIX', if_true: files(
38   'channel-posix.c',
39   'commands-posix.c'))
40 qga_ss.add(when: 'CONFIG_WIN32', if_true: files(
41   'channel-win32.c',
42   'commands-win32.c',
43   'service-win32.c',
44   'vss-win32.c'
45 ))
46
47 qga_ss = qga_ss.apply(config_host, strict: false)
48
49 qga = executable('qemu-ga', qga_ss.sources(),
50                  link_args: config_host['LIBS_QGA'].split(),
51                  dependencies: [qemuutil, libudev],
52                  install: true)
53 all_qga = [qga]
54
55 if targetos == 'windows'
56   if 'CONFIG_QGA_VSS' in config_host
57     subdir('vss-win32')
58   else
59     gen_tlb = []
60   endif
61
62   wixl = find_program('wixl', required: false)
63   if wixl.found()
64     deps = [gen_tlb, qga]
65     if 'CONFIG_QGA_VSS' in config_host and 'QEMU_GA_MSI_WITH_VSS' in config_host
66       deps += qga_vss
67     endif
68     qga_msi = custom_target('QGA MSI',
69                             input: files('installer/qemu-ga.wxs'),
70                             output: 'qemu-ga-@0@.msi'.format(config_host['ARCH']),
71                             depends: deps,
72                             command: [
73                               'QEMU_GA_VERSION=' + config_host['QEMU_GA_VERSION'],
74                               'QEMU_GA_MANUFACTURER=' + config_host['QEMU_GA_MANUFACTURER'],
75                               'QEMU_GA_DISTRO=' + config_host['QEMU_GA_DISTRO'],
76                               'BUILD_DIR=' + meson.build_root(),
77                               wixl, '-o', '@OUTPUT0@', '@INPUT0@',
78                               config_host['QEMU_GA_MSI_ARCH'].split(),
79                               config_host['QEMU_GA_MSI_WITH_VSS'].split(),
80                               config_host['QEMU_GA_MSI_MINGW_DLL_PATH'].split(),
81                             ])
82     all_qga += [qga_msi]
83     alias_target('msi', qga_msi)
84   endif
85 endif
86
87 alias_target('qemu-ga', all_qga)