mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
meson: add common hw files
Those files will be compiled once per base architecture ("arm" in this case), instead of being compiled for every variant/bitness of architecture. We make sure to not include target cpu definitions (exec/cpu-defs.h) by defining header guard directly. This way, a given compilation unit can access a specific cpu definition, but not access to compile time defines associated. Previous commits took care to clean up some headers to not rely on cpu-defs.h content. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-ID: <20250325045915.994760-24-pierrick.bouvier@linaro.org>
This commit is contained in:
parent
652d19a642
commit
d4ecfc569d
1 changed files with 36 additions and 1 deletions
37
meson.build
37
meson.build
|
@ -3682,6 +3682,7 @@ hw_arch = {}
|
|||
target_arch = {}
|
||||
target_system_arch = {}
|
||||
target_user_arch = {}
|
||||
hw_common_arch = {}
|
||||
|
||||
# NOTE: the trace/ subdirectory needs the qapi_trace_events variable
|
||||
# that is filled in by qapi/.
|
||||
|
@ -4079,6 +4080,34 @@ common_all = static_library('common',
|
|||
implicit_include_directories: false,
|
||||
dependencies: common_ss.all_dependencies())
|
||||
|
||||
# construct common libraries per base architecture
|
||||
hw_common_arch_libs = {}
|
||||
foreach target : target_dirs
|
||||
config_target = config_target_mak[target]
|
||||
target_base_arch = config_target['TARGET_BASE_ARCH']
|
||||
|
||||
# check if already generated
|
||||
if target_base_arch in hw_common_arch_libs
|
||||
continue
|
||||
endif
|
||||
|
||||
if target_base_arch in hw_common_arch
|
||||
target_inc = [include_directories('target' / target_base_arch)]
|
||||
src = hw_common_arch[target_base_arch]
|
||||
lib = static_library(
|
||||
'hw_' + target_base_arch,
|
||||
build_by_default: false,
|
||||
sources: src.all_sources() + genh,
|
||||
include_directories: common_user_inc + target_inc,
|
||||
implicit_include_directories: false,
|
||||
# prevent common code to access cpu compile time
|
||||
# definition, but still allow access to cpu.h
|
||||
c_args: ['-DCPU_DEFS_H', '-DCOMPILING_SYSTEM_VS_USER', '-DCONFIG_SOFTMMU'],
|
||||
dependencies: src.all_dependencies())
|
||||
hw_common_arch_libs += {target_base_arch: lib}
|
||||
endif
|
||||
endforeach
|
||||
|
||||
if have_rust
|
||||
# We would like to use --generate-cstr, but it is only available
|
||||
# starting with bindgen 0.66.0. The oldest supported versions
|
||||
|
@ -4244,8 +4273,14 @@ foreach target : target_dirs
|
|||
arch_deps += t.dependencies()
|
||||
|
||||
target_common = common_ss.apply(config_target, strict: false)
|
||||
objects = common_all.extract_objects(target_common.sources())
|
||||
objects = [common_all.extract_objects(target_common.sources())]
|
||||
arch_deps += target_common.dependencies()
|
||||
if target_type == 'system' and target_base_arch in hw_common_arch_libs
|
||||
src = hw_common_arch[target_base_arch].apply(config_target, strict: false)
|
||||
lib = hw_common_arch_libs[target_base_arch]
|
||||
objects += lib.extract_objects(src.sources())
|
||||
arch_deps += src.dependencies()
|
||||
endif
|
||||
|
||||
target_specific = specific_ss.apply(config_target, strict: false)
|
||||
arch_srcs += target_specific.sources()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue