aboutsummaryrefslogtreecommitdiff
path: root/plugins/meson.build
blob: 18a0303bff94d135a4baf039f31d80dfdd8d10f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Modules need more symbols than just those in plugins/qemu-plugins.symbols
if not enable_modules
  if host_os == 'darwin'
    configure_file(
      input: files('qemu-plugins.symbols'),
      output: 'qemu-plugins-ld64.symbols',
      capture: true,
      command: ['sed', '-ne', 's/^[[:space:]]*\\(qemu_.*\\);/_\\1/p', '@INPUT@'])
    emulator_link_args += ['-Wl,-exported_symbols_list,plugins/qemu-plugins-ld64.symbols']
  else
    emulator_link_args += ['-Xlinker', '--dynamic-list=' + (meson.project_source_root() / 'plugins/qemu-plugins.symbols')]
  endif
endif

if get_option('plugins')
  if host_os == 'windows'
    dlltool = find_program('dlltool', required: true)

    # Generate a .lib file for plugins to link against.
    # First, create a .def file listing all the symbols a plugin should expect to have
    # available in qemu
    win32_plugin_def = configure_file(
      input: files('qemu-plugins.symbols'),
      output: 'qemu_plugin_api.def',
      capture: true,
      command: ['sed', '-e', '0,/^/s//EXPORTS/; s/[{};]//g', '@INPUT@'])
    # then use dlltool to assemble a delaylib.
    win32_qemu_plugin_api_lib = configure_file(
      input: win32_plugin_def,
      output: 'libqemu_plugin_api.a',
      command: [dlltool, '--input-def', '@INPUT@',
                '--output-delaylib', '@OUTPUT@', '--dllname', 'qemu.exe']
    )
  endif
  specific_ss.add(files(
    'loader.c',
    'core.c',
    'api.c',
  ))
endif