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