meson: remove CONFIG_ALL

CONFIG_ALL is tricky to use and was ported over to Meson from the
recursive processing of Makefile variables.  Meson sourcesets
however have all_sources() and all_dependencies() methods that
remove the need for it.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
master
Paolo Bonzini 2023-08-31 11:18:24 +02:00
parent 1220f5813a
commit 0d66549cf5
14 changed files with 7 additions and 65 deletions

View File

@ -256,21 +256,6 @@ Target-independent emulator sourcesets:
``system_ss`` only in system emulators, ``user_ss`` only in user-mode ``system_ss`` only in system emulators, ``user_ss`` only in user-mode
emulators. emulators.
Target-independent sourcesets must exercise particular care when using
``if_false`` rules. The ``if_false`` rule will be used correctly when linking
emulator binaries; however, when *compiling* target-independent files
into .o files, Meson may need to pick *both* the ``if_true`` and
``if_false`` sides to cater for targets that want either side. To
achieve that, you can add a special rule using the ``CONFIG_ALL``
symbol::
# Some targets have CONFIG_ACPI, some don't, so this is not enough
system_ss.add(when: 'CONFIG_ACPI', if_true: files('acpi.c'),
if_false: files('acpi-stub.c'))
# This is required as well:
system_ss.add(when: 'CONFIG_ALL', if_true: files('acpi-stub.c'))
Target-dependent emulator sourcesets: Target-dependent emulator sourcesets:
In the target-dependent set lives CPU emulation, some device emulation and In the target-dependent set lives CPU emulation, some device emulation and
much glue code. This sometimes also has to be compiled multiple times, much glue code. This sometimes also has to be compiled multiple times,

View File

@ -1,6 +1,5 @@
fsdev_ss = ss.source_set() fsdev_ss = ss.source_set()
fsdev_ss.add(files('qemu-fsdev-opts.c', 'qemu-fsdev-throttle.c')) fsdev_ss.add(files('qemu-fsdev-opts.c', 'qemu-fsdev-throttle.c'))
fsdev_ss.add(when: 'CONFIG_ALL', if_true: files('qemu-fsdev-dummy.c'))
fsdev_ss.add(when: ['CONFIG_FSDEV_9P'], if_true: files( fsdev_ss.add(when: ['CONFIG_FSDEV_9P'], if_true: files(
'9p-iov-marshal.c', '9p-iov-marshal.c',
'9p-marshal.c', '9p-marshal.c',

View File

@ -33,9 +33,4 @@ endif
system_ss.add(when: 'CONFIG_ACPI', if_false: files('acpi-stub.c', 'aml-build-stub.c', 'ghes-stub.c', 'acpi_interface.c')) system_ss.add(when: 'CONFIG_ACPI', if_false: files('acpi-stub.c', 'aml-build-stub.c', 'ghes-stub.c', 'acpi_interface.c'))
system_ss.add(when: 'CONFIG_ACPI_PCI_BRIDGE', if_false: files('pci-bridge-stub.c')) system_ss.add(when: 'CONFIG_ACPI_PCI_BRIDGE', if_false: files('pci-bridge-stub.c'))
system_ss.add_all(when: 'CONFIG_ACPI', if_true: acpi_ss) system_ss.add_all(when: 'CONFIG_ACPI', if_true: acpi_ss)
system_ss.add(when: 'CONFIG_ALL', if_true: files('acpi-stub.c', 'aml-build-stub.c',
'acpi-x86-stub.c', 'ipmi-stub.c', 'ghes-stub.c',
'acpi-mem-hotplug-stub.c', 'acpi-cpu-hotplug-stub.c',
'acpi-pci-hotplug-stub.c', 'acpi-nvdimm-stub.c',
'cxl-stub.c', 'pci-bridge-stub.c'))
system_ss.add(files('acpi-qmp-cmds.c')) system_ss.add(files('acpi-qmp-cmds.c'))

View File

@ -11,5 +11,3 @@ system_ss.add(when: 'CONFIG_CXL',
if_false: files( if_false: files(
'cxl-host-stubs.c', 'cxl-host-stubs.c',
)) ))
system_ss.add(when: 'CONFIG_ALL', if_true: files('cxl-host-stubs.c'))

View File

@ -143,5 +143,4 @@ endif
system_ss.add(when: 'CONFIG_OMAP', if_true: files('omap_lcdc.c')) system_ss.add(when: 'CONFIG_OMAP', if_true: files('omap_lcdc.c'))
system_ss.add(when: 'CONFIG_ALL', if_true: files('acpi-vga-stub.c'))
modules += { 'hw-display': hw_display_modules } modules += { 'hw-display': hw_display_modules }

View File

@ -5,7 +5,6 @@ mem_ss.add(when: 'CONFIG_NPCM7XX', if_true: files('npcm7xx_mc.c'))
mem_ss.add(when: 'CONFIG_NVDIMM', if_true: files('nvdimm.c')) mem_ss.add(when: 'CONFIG_NVDIMM', if_true: files('nvdimm.c'))
mem_ss.add(when: 'CONFIG_CXL_MEM_DEVICE', if_true: files('cxl_type3.c')) mem_ss.add(when: 'CONFIG_CXL_MEM_DEVICE', if_true: files('cxl_type3.c'))
system_ss.add(when: 'CONFIG_CXL_MEM_DEVICE', if_false: files('cxl_type3_stubs.c')) system_ss.add(when: 'CONFIG_CXL_MEM_DEVICE', if_false: files('cxl_type3_stubs.c'))
system_ss.add(when: 'CONFIG_ALL', if_true: files('cxl_type3_stubs.c'))
system_ss.add_all(when: 'CONFIG_MEM_DEVICE', if_true: mem_ss) system_ss.add_all(when: 'CONFIG_MEM_DEVICE', if_true: mem_ss)

View File

@ -50,7 +50,6 @@ specific_ss.add(when: 'CONFIG_VIRTIO_NET', if_true: files('virtio-net.c'))
if have_vhost_net if have_vhost_net
system_ss.add(when: 'CONFIG_VIRTIO_NET', if_true: files('vhost_net.c'), if_false: files('vhost_net-stub.c')) system_ss.add(when: 'CONFIG_VIRTIO_NET', if_true: files('vhost_net.c'), if_false: files('vhost_net-stub.c'))
system_ss.add(when: 'CONFIG_ALL', if_true: files('vhost_net-stub.c'))
else else
system_ss.add(files('vhost_net-stub.c')) system_ss.add(files('vhost_net-stub.c'))
endif endif
@ -69,7 +68,6 @@ system_ss.add(when: 'CONFIG_ROCKER', if_true: files(
'rocker/rocker_of_dpa.c', 'rocker/rocker_of_dpa.c',
'rocker/rocker_world.c', 'rocker/rocker_world.c',
), if_false: files('rocker/qmp-norocker.c')) ), if_false: files('rocker/qmp-norocker.c'))
system_ss.add(when: 'CONFIG_ALL', if_true: files('rocker/qmp-norocker.c'))
system_ss.add(files('rocker/rocker-hmp-cmds.c')) system_ss.add(files('rocker/rocker-hmp-cmds.c'))
subdir('can') subdir('can')

View File

@ -13,5 +13,3 @@ pci_ss.add(when: 'CONFIG_CXL', if_true: files('cxl_root_port.c', 'cxl_upstream.c
pci_ss.add(when: 'CONFIG_SIMBA', if_true: files('simba.c')) pci_ss.add(when: 'CONFIG_SIMBA', if_true: files('simba.c'))
system_ss.add_all(when: 'CONFIG_PCI', if_true: pci_ss) system_ss.add_all(when: 'CONFIG_PCI', if_true: pci_ss)
system_ss.add(when: 'CONFIG_ALL', if_true: files('pci_expander_bridge_stubs.c'))

View File

@ -20,4 +20,3 @@ system_ss.add(when: 'CONFIG_PCI_EXPRESS', if_true: files('pcie_port.c', 'pcie_ho
system_ss.add_all(when: 'CONFIG_PCI', if_true: pci_ss) system_ss.add_all(when: 'CONFIG_PCI', if_true: pci_ss)
system_ss.add(when: 'CONFIG_PCI', if_false: files('pci-stub.c')) system_ss.add(when: 'CONFIG_PCI', if_false: files('pci-stub.c'))
system_ss.add(when: 'CONFIG_ALL', if_true: files('pci-stub.c'))

View File

@ -11,7 +11,6 @@ remote_ss.add(when: 'CONFIG_MULTIPROCESS', if_true: files('iommu.c'))
remote_ss.add(when: 'CONFIG_VFIO_USER_SERVER', if_true: libvfio_user_dep) remote_ss.add(when: 'CONFIG_VFIO_USER_SERVER', if_true: libvfio_user_dep)
remote_ss.add(when: 'CONFIG_VFIO_USER_SERVER', if_true: files('vfio-user-obj.c'), remote_ss.add(when: 'CONFIG_VFIO_USER_SERVER', if_true: files('vfio-user-obj.c'),
if_false: files('vfio-user-obj-stub.c')) if_false: files('vfio-user-obj-stub.c'))
remote_ss.add(when: 'CONFIG_ALL', if_true: files('vfio-user-obj-stub.c'))
specific_ss.add(when: 'CONFIG_MULTIPROCESS', if_true: files('memory.c')) specific_ss.add(when: 'CONFIG_MULTIPROCESS', if_true: files('memory.c'))
specific_ss.add(when: 'CONFIG_MULTIPROCESS', if_true: files('proxy-memory-listener.c')) specific_ss.add(when: 'CONFIG_MULTIPROCESS', if_true: files('proxy-memory-listener.c'))

View File

@ -6,8 +6,3 @@ smbios_ss.add(when: 'CONFIG_IPMI',
system_ss.add_all(when: 'CONFIG_SMBIOS', if_true: smbios_ss) system_ss.add_all(when: 'CONFIG_SMBIOS', if_true: smbios_ss)
system_ss.add(when: 'CONFIG_SMBIOS', if_false: files('smbios-stub.c')) system_ss.add(when: 'CONFIG_SMBIOS', if_false: files('smbios-stub.c'))
system_ss.add(when: 'CONFIG_ALL', if_true: files(
'smbios-stub.c',
'smbios_type_38-stub.c',
))

View File

@ -74,8 +74,6 @@ specific_virtio_ss.add_all(when: 'CONFIG_VIRTIO_PCI', if_true: virtio_pci_ss)
system_ss.add_all(when: 'CONFIG_VIRTIO', if_true: system_virtio_ss) system_ss.add_all(when: 'CONFIG_VIRTIO', if_true: system_virtio_ss)
system_ss.add(when: 'CONFIG_VIRTIO', if_false: files('vhost-stub.c')) system_ss.add(when: 'CONFIG_VIRTIO', if_false: files('vhost-stub.c'))
system_ss.add(when: 'CONFIG_VIRTIO', if_false: files('virtio-stub.c')) system_ss.add(when: 'CONFIG_VIRTIO', if_false: files('virtio-stub.c'))
system_ss.add(when: 'CONFIG_ALL', if_true: files('vhost-stub.c'))
system_ss.add(when: 'CONFIG_ALL', if_true: files('virtio-stub.c'))
system_ss.add(files('virtio-hmp-cmds.c')) system_ss.add(files('virtio-hmp-cmds.c'))
specific_ss.add_all(when: 'CONFIG_VIRTIO', if_true: specific_virtio_ss) specific_ss.add_all(when: 'CONFIG_VIRTIO', if_true: specific_virtio_ss)

View File

@ -2888,7 +2888,6 @@ minikconf = find_program('scripts/minikconf.py')
config_all = {} config_all = {}
config_all_devices = {} config_all_devices = {}
config_all_disas = {}
config_devices_mak_list = [] config_devices_mak_list = []
config_devices_h = {} config_devices_h = {}
config_target_h = {} config_target_h = {}
@ -3014,7 +3013,6 @@ foreach target : target_dirs
if host_arch.startswith(k) or config_target['TARGET_BASE_ARCH'].startswith(k) if host_arch.startswith(k) or config_target['TARGET_BASE_ARCH'].startswith(k)
foreach sym: v foreach sym: v
config_target += { sym: 'y' } config_target += { sym: 'y' }
config_all_disas += { sym: 'y' }
endforeach endforeach
endif endif
endforeach endforeach
@ -3073,24 +3071,6 @@ foreach target : target_dirs
endforeach endforeach
target_dirs = actual_target_dirs target_dirs = actual_target_dirs
# This configuration is used to build files that are shared by
# multiple binaries, and then extracted out of the "common"
# static_library target.
#
# We do not use all_sources()/all_dependencies(), because it would
# build literally all source files, including devices only used by
# targets that are not built for this compilation. The CONFIG_ALL
# pseudo symbol replaces it.
config_all += config_all_devices
config_all += config_all_disas
config_all += {
'CONFIG_XEN': xen.found(),
'CONFIG_SYSTEM_ONLY': have_system,
'CONFIG_USER_ONLY': have_user,
'CONFIG_ALL': true,
}
target_configs_h = [] target_configs_h = []
foreach target: target_dirs foreach target: target_dirs
target_configs_h += config_target_h[target] target_configs_h += config_target_h[target]
@ -3556,7 +3536,7 @@ foreach d, list : modules
foreach m, module_ss : list foreach m, module_ss : list
if enable_modules if enable_modules
module_ss = module_ss.apply(config_all, strict: false) module_ss = module_ss.apply(config_all_devices, strict: false)
sl = static_library(d + '-' + m, [genh, module_ss.sources()], sl = static_library(d + '-' + m, [genh, module_ss.sources()],
dependencies: [modulecommon, module_ss.dependencies()], pic: true) dependencies: [modulecommon, module_ss.dependencies()], pic: true)
if d == 'block' if d == 'block'
@ -3751,13 +3731,15 @@ common_ss.add(qom, qemuutil)
common_ss.add_all(when: 'CONFIG_SYSTEM_ONLY', if_true: [system_ss]) common_ss.add_all(when: 'CONFIG_SYSTEM_ONLY', if_true: [system_ss])
common_ss.add_all(when: 'CONFIG_USER_ONLY', if_true: user_ss) common_ss.add_all(when: 'CONFIG_USER_ONLY', if_true: user_ss)
common_all = common_ss.apply(config_all, strict: false) # Note that this library is never used directly (only through extract_objects)
# and is not built by default; therefore, source files not used by the build
# configuration will be in build.ninja, but are never built by default.
common_all = static_library('common', common_all = static_library('common',
build_by_default: false, build_by_default: false,
sources: common_all.sources() + genh, sources: common_ss.all_sources() + genh,
include_directories: common_user_inc, include_directories: common_user_inc,
implicit_include_directories: false, implicit_include_directories: false,
dependencies: common_all.dependencies(), dependencies: common_ss.all_dependencies(),
name_suffix: 'fa') name_suffix: 'fa')
feature_to_c = find_program('scripts/feature_to_c.py') feature_to_c = find_program('scripts/feature_to_c.py')
@ -4230,7 +4212,7 @@ if have_system
if xen.found() if xen.found()
summary_info += {'xen ctrl version': xen.version()} summary_info += {'xen ctrl version': xen.version()}
endif endif
summary_info += {'Xen emulation': config_all.has_key('CONFIG_XEN_EMU')} summary_info += {'Xen emulation': config_all_devices.has_key('CONFIG_XEN_EMU')}
endif endif
summary_info += {'TCG support': config_all.has_key('CONFIG_TCG')} summary_info += {'TCG support': config_all.has_key('CONFIG_TCG')}
if config_all.has_key('CONFIG_TCG') if config_all.has_key('CONFIG_TCG')

View File

@ -41,7 +41,6 @@ system_ss.add(when: libxdp, if_true: files('af-xdp.c'))
if have_vhost_net_user if have_vhost_net_user
system_ss.add(when: 'CONFIG_VIRTIO_NET', if_true: files('vhost-user.c'), if_false: files('vhost-user-stub.c')) system_ss.add(when: 'CONFIG_VIRTIO_NET', if_true: files('vhost-user.c'), if_false: files('vhost-user-stub.c'))
system_ss.add(when: 'CONFIG_ALL', if_true: files('vhost-user-stub.c'))
endif endif
if targetos == 'windows' if targetos == 'windows'
@ -57,7 +56,6 @@ else
endif endif
if have_vhost_net_vdpa if have_vhost_net_vdpa
system_ss.add(when: 'CONFIG_VIRTIO_NET', if_true: files('vhost-vdpa.c'), if_false: files('vhost-vdpa-stub.c')) system_ss.add(when: 'CONFIG_VIRTIO_NET', if_true: files('vhost-vdpa.c'), if_false: files('vhost-vdpa-stub.c'))
system_ss.add(when: 'CONFIG_ALL', if_true: files('vhost-vdpa-stub.c'))
endif endif
vmnet_files = files( vmnet_files = files(