]> git.proxmox.com Git - mirror_qemu.git/blame - qga/meson.build
meson: document why we don't generate trace events for tests/ and qga/
[mirror_qemu.git] / qga / meson.build
CommitLineData
f15bff25
PB
1qga_qapi_outputs = [
2 'qga-qapi-commands.c',
3 'qga-qapi-commands.h',
f15bff25
PB
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
378dfa48
VSO
18# Problem: to generate trace events, we'd have to add the .trace-events
19# file to qapi_trace_events like we do in qapi/meson.build. Since
20# qapi_trace_events is used by trace/meson.build, we'd have to move
21# subdir('qga') above subdir('trace') in the top-level meson.build.
22# Can't, because it would break the dependency of qga on qemuutil (which
23# depends on trace_ss). Not worth solving now; simply suppress trace
24# event generation instead.
f15bff25 25qga_qapi_files = custom_target('QGA QAPI files',
db16115f 26 output: qga_qapi_outputs,
f15bff25
PB
27 input: 'qapi-schema.json',
28 command: [ qapi_gen, '-o', 'qga', '-p', 'qga-', '@INPUT0@' ],
29 depend_files: qapi_gen_depends)
acfdaac5 30
f15bff25 31qga_ss = ss.source_set()
2a127f96 32qga_ss.add(qga_qapi_files.to_list())
f15bff25
PB
33qga_ss.add(files(
34 'commands.c',
35 'guest-agent-command-state.c',
36 'main.c',
37))
38qga_ss.add(when: 'CONFIG_POSIX', if_true: files(
39 'channel-posix.c',
8d769ec7
MAL
40 'commands-posix.c',
41 'commands-posix-ssh.c',
42))
f15bff25
PB
43qga_ss.add(when: 'CONFIG_WIN32', if_true: files(
44 'channel-win32.c',
45 'commands-win32.c',
46 'service-win32.c',
47 'vss-win32.c'
48))
49
50qga_ss = qga_ss.apply(config_host, strict: false)
51
52qga = executable('qemu-ga', qga_ss.sources(),
53 link_args: config_host['LIBS_QGA'].split(),
54 dependencies: [qemuutil, libudev],
55 install: true)
588a19fa 56all_qga = [qga]
7272fc72
MAL
57
58if targetos == 'windows'
59 if 'CONFIG_QGA_VSS' in config_host
60 subdir('vss-win32')
328ec32d
MAL
61 else
62 gen_tlb = []
63 endif
64
b846ab7c
PB
65 qemu_ga_msi_arch = {
66 'x86': ['-D', 'Arch=32'],
67 'x86_64': ['-a', 'x64', '-D', 'Arch=64']
68 }
69 wixl = not_found
70 if cpu in qemu_ga_msi_arch
71 wixl = find_program('wixl', required: get_option('guest_agent_msi'))
72 elif get_option('guest_agent_msi').enabled()
73 error('CPU not supported for building guest agent installation package')
74 endif
75
328ec32d
MAL
76 if wixl.found()
77 deps = [gen_tlb, qga]
b846ab7c
PB
78 qemu_ga_msi_vss = []
79 if 'CONFIG_QGA_VSS' in config_host
80 qemu_ga_msi_vss = ['-D', 'InstallVss']
328ec32d
MAL
81 deps += qga_vss
82 endif
b846ab7c
PB
83 qga_msi = custom_target('QGA MSI',
84 input: files('installer/qemu-ga.wxs'),
85 output: 'qemu-ga-@0@.msi'.format(config_host['ARCH']),
86 depends: deps,
87 command: [
88 find_program('env'),
89 'QEMU_GA_VERSION=' + config_host['QEMU_GA_VERSION'],
90 'QEMU_GA_MANUFACTURER=' + config_host['QEMU_GA_MANUFACTURER'],
91 'QEMU_GA_DISTRO=' + config_host['QEMU_GA_DISTRO'],
92 'BUILD_DIR=' + meson.build_root(),
93 wixl, '-o', '@OUTPUT0@', '@INPUT0@',
94 qemu_ga_msi_arch[cpu],
95 qemu_ga_msi_vss,
96 '-D', 'Mingw_dlls=' + config_host['QEMU_GA_MSI_MINGW_DLL_PATH'],
97 ])
98 all_qga += [qga_msi]
99 alias_target('msi', qga_msi)
7272fc72 100 endif
8ab1aabc 101else
b846ab7c
PB
102 if get_option('guest_agent_msi').enabled()
103 error('MSI guest agent package is available only for MinGW Windows cross-compilation')
104 endif
8ab1aabc 105 install_subdir('run', install_dir: get_option('localstatedir'))
7272fc72 106endif
588a19fa
PB
107
108alias_target('qemu-ga', all_qga)
8d769ec7
MAL
109
110test_env = environment()
111test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
112test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
113
114# disable qga-ssh-test for now. glib's G_TEST_OPTION_ISOLATE_DIRS triggers
115# the leak detector in build-oss-fuzz Gitlab CI test. we should re-enable
116# this when an alternative is implemented or when the underlying glib
117# issue is identified/fix
118#if 'CONFIG_POSIX' in config_host
119if false
cad97c08
MAL
120 srcs = [files('commands-posix-ssh.c')]
121 i = 0
122 foreach output: qga_qapi_outputs
123 if output.startswith('qga-qapi-types') or output.startswith('qga-qapi-visit')
124 srcs += qga_qapi_files[i]
125 endif
126 i = i + 1
127 endforeach
128 qga_ssh_test = executable('qga-ssh-test', srcs,
8d769ec7
MAL
129 dependencies: [qemuutil],
130 c_args: ['-DQGA_BUILD_UNIT_TEST'])
131
132 test('qga-ssh-test',
133 qga_ssh_test,
134 env: test_env,
135 suite: ['unit', 'qga'])
136endif