xref: /openbmc/qemu/plugins/meson.build (revision a6896ebc)
1if not get_option('plugins')
2  subdir_done()
3endif
4
5# Modules need more symbols than just those in plugins/qemu-plugins.symbols
6if not enable_modules
7  if host_os == 'darwin'
8    configure_file(
9      input: files('qemu-plugins.symbols'),
10      output: 'qemu-plugins-ld64.symbols',
11      capture: true,
12      command: ['sed', '-ne', 's/^[[:space:]]*\\(qemu_.*\\);/_\\1/p', '@INPUT@'])
13    emulator_link_args += ['-Wl,-exported_symbols_list,plugins/qemu-plugins-ld64.symbols']
14  else
15    emulator_link_args += ['-Xlinker', '--dynamic-list=' + (meson.project_source_root() / 'plugins/qemu-plugins.symbols')]
16  endif
17endif
18
19if host_os == 'windows'
20  dlltool = find_program('dlltool', required: true)
21
22  # Generate a .lib file for plugins to link against.
23  # First, create a .def file listing all the symbols a plugin should expect to have
24  # available in qemu
25  win32_plugin_def = configure_file(
26    input: files('qemu-plugins.symbols'),
27    output: 'qemu_plugin_api.def',
28    capture: true,
29    command: ['sed', '-e', '0,/^/s//EXPORTS/; s/[{};]//g', '@INPUT@'])
30  # then use dlltool to assemble a delaylib.
31  win32_qemu_plugin_api_lib = configure_file(
32    input: win32_plugin_def,
33    output: 'libqemu_plugin_api.a',
34    command: [dlltool, '--input-def', '@INPUT@',
35              '--output-delaylib', '@OUTPUT@', '--dllname', 'qemu.exe']
36  )
37endif
38specific_ss.add(files(
39  'loader.c',
40  'core.c',
41  'api.c',
42))
43