diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2019-08-29 22:07:01 +0400 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2020-08-21 06:30:17 -0400 |
commit | 3154fee4db6d14e72050c7efc6a6f4eb06d01d4a (patch) | |
tree | 245f3721fd5c120265d65a17446f2b37d9a4b17d /meson.build | |
parent | 2becc36a3e53dc9b8ed01c5288e21a2463f1f640 (diff) |
meson: add modules infrastructure
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/meson.build b/meson.build index 6f8024cdcf..13b83ea14b 100644 --- a/meson.build +++ b/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) |