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 18qga_qapi_files = custom_target('QGA QAPI files', 19 output: qga_qapi_outputs, 20 input: 'qapi-schema.json', 21 command: [ qapi_gen, '-o', 'qga', '-p', 'qga-', '@INPUT0@' ], 22 depend_files: qapi_gen_depends) 23 24qga_ss = ss.source_set() 25qga_ss.add(qga_qapi_files.to_list()) 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', 34 'commands-posix-ssh.c', 35)) 36qga_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 43qga_ss = qga_ss.apply(config_host, strict: false) 44 45qga = executable('qemu-ga', qga_ss.sources(), 46 link_args: config_host['LIBS_QGA'].split(), 47 dependencies: [qemuutil, libudev], 48 install: true) 49all_qga = [qga] 50 51if targetos == 'windows' 52 if 'CONFIG_QGA_VSS' in config_host 53 subdir('vss-win32') 54 else 55 gen_tlb = [] 56 endif 57 58 wixl = find_program('wixl', required: false) 59 if wixl.found() 60 deps = [gen_tlb, qga] 61 if 'CONFIG_QGA_VSS' in config_host and 'QEMU_GA_MSI_WITH_VSS' in config_host 62 deps += qga_vss 63 endif 64 if 'CONFIG_QGA_MSI' in config_host 65 qga_msi = custom_target('QGA MSI', 66 input: files('installer/qemu-ga.wxs'), 67 output: 'qemu-ga-@0@.msi'.format(config_host['ARCH']), 68 depends: deps, 69 command: [ 70 find_program('env'), 71 'QEMU_GA_VERSION=' + config_host['QEMU_GA_VERSION'], 72 'QEMU_GA_MANUFACTURER=' + config_host['QEMU_GA_MANUFACTURER'], 73 'QEMU_GA_DISTRO=' + config_host['QEMU_GA_DISTRO'], 74 'BUILD_DIR=' + meson.build_root(), 75 wixl, '-o', '@OUTPUT0@', '@INPUT0@', 76 config_host['QEMU_GA_MSI_ARCH'].split(), 77 config_host['QEMU_GA_MSI_WITH_VSS'].split(), 78 config_host['QEMU_GA_MSI_MINGW_DLL_PATH'].split(), 79 ]) 80 all_qga += [qga_msi] 81 alias_target('msi', qga_msi) 82 endif 83 endif 84else 85 install_subdir('run', install_dir: get_option('localstatedir')) 86endif 87 88alias_target('qemu-ga', all_qga) 89 90test_env = environment() 91test_env.set('G_TEST_SRCDIR', meson.current_source_dir()) 92test_env.set('G_TEST_BUILDDIR', meson.current_build_dir()) 93 94# disable qga-ssh-test for now. glib's G_TEST_OPTION_ISOLATE_DIRS triggers 95# the leak detector in build-oss-fuzz Gitlab CI test. we should re-enable 96# this when an alternative is implemented or when the underlying glib 97# issue is identified/fix 98#if 'CONFIG_POSIX' in config_host 99if false 100 srcs = [files('commands-posix-ssh.c')] 101 i = 0 102 foreach output: qga_qapi_outputs 103 if output.startswith('qga-qapi-types') or output.startswith('qga-qapi-visit') 104 srcs += qga_qapi_files[i] 105 endif 106 i = i + 1 107 endforeach 108 qga_ssh_test = executable('qga-ssh-test', srcs, 109 dependencies: [qemuutil], 110 c_args: ['-DQGA_BUILD_UNIT_TEST']) 111 112 test('qga-ssh-test', 113 qga_ssh_test, 114 env: test_env, 115 suite: ['unit', 'qga']) 116endif 117