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