2 if get_option('guest_agent_msi').enabled()
3 error('Guest agent MSI requested, but the guest agent is not being built')
11 'qga-qapi-commands.c',
12 'qga-qapi-commands.h',
13 'qga-qapi-emit-events.c',
14 'qga-qapi-emit-events.h',
17 'qga-qapi-init-commands.c',
18 'qga-qapi-init-commands.h',
19 'qga-qapi-introspect.c',
20 'qga-qapi-introspect.h',
27 # Problem: to generate trace events, we'd have to add the .trace-events
28 # file to qapi_trace_events like we do in qapi/meson.build. Since
29 # qapi_trace_events is used by trace/meson.build, we'd have to move
30 # subdir('qga') above subdir('trace') in the top-level meson.build.
31 # Can't, because it would break the dependency of qga on qemuutil (which
32 # depends on trace_ss). Not worth solving now; simply suppress trace
33 # event generation instead.
34 qga_qapi_files = custom_target('QGA QAPI files',
35 output: qga_qapi_outputs,
36 input: 'qapi-schema.json',
37 command: [ qapi_gen, '-o', 'qga', '-p', 'qga-', '@INPUT0@',
38 '--suppress-tracing' ],
39 depend_files: qapi_gen_depends)
41 qga_ss = ss.source_set()
42 qga_ss.add(qga_qapi_files.to_list())
45 'guest-agent-command-state.c',
48 qga_ss.add(when: 'CONFIG_POSIX', if_true: files(
51 'commands-posix-ssh.c',
53 qga_ss.add(when: 'CONFIG_WIN32', if_true: files(
60 qga_ss = qga_ss.apply(config_host, strict: false)
64 if targetos == 'windows'
65 qga_libs += ['-lws2_32', '-lwinmm', '-lpowrprof', '-lwtsapi32', '-lwininet', '-liphlpapi', '-lnetapi32']
66 if 'CONFIG_QGA_VSS' in config_host
67 qga_libs += ['-lole32', '-loleaut32', '-lshlwapi', '-lstdc++', '-Wl,--enable-stdcall-fixup']
70 if 'CONFIG_QGA_NTDDSCSI' in config_host
71 qga_libs += ['-lsetupapi', '-lcfgmgr32']
75 qga = executable('qemu-ga', qga_ss.sources(),
77 dependencies: [qemuutil, libudev],
81 if targetos == 'windows'
83 'x86': ['-D', 'Arch=32'],
84 'x86_64': ['-a', 'x64', '-D', 'Arch=64']
87 if cpu in qemu_ga_msi_arch
88 wixl = find_program('wixl', required: get_option('guest_agent_msi'))
89 elif get_option('guest_agent_msi').enabled()
90 error('CPU not supported for building guest agent installation package')
96 if 'CONFIG_QGA_VSS' in config_host
97 qemu_ga_msi_vss = ['-D', 'InstallVss']
100 qga_msi = custom_target('QGA MSI',
101 input: files('installer/qemu-ga.wxs'),
102 output: 'qemu-ga-@0@.msi'.format(host_arch),
106 'QEMU_GA_VERSION=' + config_host['QEMU_GA_VERSION'],
107 'QEMU_GA_MANUFACTURER=' + config_host['QEMU_GA_MANUFACTURER'],
108 'QEMU_GA_DISTRO=' + config_host['QEMU_GA_DISTRO'],
109 'BUILD_DIR=' + meson.build_root(),
110 wixl, '-o', '@OUTPUT0@', '@INPUT0@',
111 qemu_ga_msi_arch[cpu],
113 '-D', 'Mingw_dlls=' + config_host['QEMU_GA_MSI_MINGW_DLL_PATH'],
116 alias_target('msi', qga_msi)
119 if get_option('guest_agent_msi').enabled()
120 error('MSI guest agent package is available only for MinGW Windows cross-compilation')
122 install_subdir('run', install_dir: get_option('localstatedir'))
125 alias_target('qemu-ga', all_qga)
127 test_env = environment()
128 test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
129 test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
131 # disable qga-ssh-test for now. glib's G_TEST_OPTION_ISOLATE_DIRS triggers
132 # the leak detector in build-oss-fuzz Gitlab CI test. we should re-enable
133 # this when an alternative is implemented or when the underlying glib
134 # issue is identified/fix
135 #if 'CONFIG_POSIX' in config_host
137 srcs = [files('commands-posix-ssh.c')]
139 foreach output: qga_qapi_outputs
140 if output.startswith('qga-qapi-types') or output.startswith('qga-qapi-visit')
141 srcs += qga_qapi_files[i]
145 qga_ssh_test = executable('qga-ssh-test', srcs,
146 dependencies: [qemuutil],
147 c_args: ['-DQGA_BUILD_UNIT_TEST'])
152 suite: ['unit', 'qga'])