mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 10:13:56 -06:00
meson: add modules infrastructure
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
2becc36a3e
commit
3154fee4db
5 changed files with 83 additions and 14 deletions
51
meson.build
51
meson.build
|
@ -10,6 +10,7 @@ sh = find_program('sh')
|
|||
cc = meson.get_compiler('c')
|
||||
config_host = keyval.load(meson.current_build_dir() / 'config-host.mak')
|
||||
config_all_disas = keyval.load(meson.current_build_dir() / 'config-all-disas.mak')
|
||||
enable_modules = 'CONFIG_MODULES' in config_host
|
||||
|
||||
add_project_arguments(config_host['QEMU_CFLAGS'].split(),
|
||||
native: false, language: ['c', 'objc'])
|
||||
|
@ -316,6 +317,7 @@ genh += hxdep
|
|||
util_ss = ss.source_set()
|
||||
stub_ss = ss.source_set()
|
||||
trace_ss = ss.source_set()
|
||||
block_ss = ss.source_set()
|
||||
common_ss = ss.source_set()
|
||||
softmmu_ss = ss.source_set()
|
||||
user_ss = ss.source_set()
|
||||
|
@ -323,6 +325,7 @@ bsd_user_ss = ss.source_set()
|
|||
linux_user_ss = ss.source_set()
|
||||
specific_ss = ss.source_set()
|
||||
|
||||
modules = {}
|
||||
hw_arch = {}
|
||||
target_arch = {}
|
||||
target_softmmu_arch = {}
|
||||
|
@ -432,6 +435,12 @@ subdir('crypto')
|
|||
subdir('storage-daemon')
|
||||
subdir('ui')
|
||||
|
||||
|
||||
if enable_modules
|
||||
libmodulecommon = static_library('module-common', files('module-common.c') + genh, pic: true, c_args: '-DBUILD_DSO')
|
||||
modulecommon = declare_dependency(link_whole: libmodulecommon, compile_args: '-DBUILD_DSO')
|
||||
endif
|
||||
|
||||
# Build targets from sourcesets
|
||||
|
||||
stub_ss = stub_ss.apply(config_all, strict: false)
|
||||
|
@ -448,6 +457,48 @@ subdir('io')
|
|||
subdir('fsdev')
|
||||
subdir('target')
|
||||
|
||||
block_mods = []
|
||||
softmmu_mods = []
|
||||
foreach d, list : modules
|
||||
foreach m, module_ss : list
|
||||
if enable_modules and targetos != 'windows'
|
||||
module_ss = module_ss.apply(config_host, strict: false)
|
||||
sl = static_library(d + '-' + m, [genh, module_ss.sources()],
|
||||
dependencies: [modulecommon, module_ss.dependencies()], pic: true)
|
||||
if d == 'block'
|
||||
block_mods += sl
|
||||
else
|
||||
softmmu_mods += sl
|
||||
endif
|
||||
else
|
||||
if d == 'block'
|
||||
block_ss.add_all(module_ss)
|
||||
else
|
||||
softmmu_ss.add_all(module_ss)
|
||||
endif
|
||||
endif
|
||||
endforeach
|
||||
endforeach
|
||||
|
||||
nm = find_program('nm')
|
||||
undefsym = find_program('scripts/undefsym.sh')
|
||||
block_syms = custom_target('block.syms', output: 'block.syms',
|
||||
input: [libqemuutil, block_mods],
|
||||
capture: true,
|
||||
command: [undefsym, nm, '@INPUT@'])
|
||||
qemu_syms = custom_target('qemu.syms', output: 'qemu.syms',
|
||||
input: [libqemuutil, softmmu_mods],
|
||||
capture: true,
|
||||
command: [undefsym, nm, '@INPUT@'])
|
||||
|
||||
foreach m : block_mods + softmmu_mods
|
||||
shared_module(m.name(),
|
||||
name_prefix: '',
|
||||
link_whole: m,
|
||||
install: true,
|
||||
install_dir: config_host['qemu_moddir'])
|
||||
endforeach
|
||||
|
||||
common_ss.add_all(when: 'CONFIG_SOFTMMU', if_true: softmmu_ss)
|
||||
common_ss.add_all(when: 'CONFIG_USER_ONLY', if_true: user_ss)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue