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