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