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