``system_ss`` only in system emulators, ``user_ss`` only in user-mode
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:
In the target-dependent set lives CPU emulation, some device emulation and
much glue code. This sometimes also has to be compiled multiple times,
fsdev_ss = ss.source_set()
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(
'9p-iov-marshal.c',
'9p-marshal.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_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'))
if_false: files(
'cxl-host-stubs.c',
))
-
-system_ss.add(when: 'CONFIG_ALL', if_true: files('cxl-host-stubs.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 }
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'))
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)
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_ALL', if_true: files('vhost_net-stub.c'))
else
system_ss.add(files('vhost_net-stub.c'))
endif
'rocker/rocker_of_dpa.c',
'rocker/rocker_world.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'))
subdir('can')
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(when: 'CONFIG_ALL', if_true: files('pci_expander_bridge_stubs.c'))
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_ALL', if_true: files('pci-stub.c'))
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'),
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('proxy-memory-listener.c'))
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_ALL', if_true: files(
- 'smbios-stub.c',
- 'smbios_type_38-stub.c',
-))
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('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'))
specific_ss.add_all(when: 'CONFIG_VIRTIO', if_true: specific_virtio_ss)
config_all = {}
config_all_devices = {}
-config_all_disas = {}
config_devices_mak_list = []
config_devices_h = {}
config_target_h = {}
if host_arch.startswith(k) or config_target['TARGET_BASE_ARCH'].startswith(k)
foreach sym: v
config_target += { sym: 'y' }
- config_all_disas += { sym: 'y' }
endforeach
endif
endforeach
endforeach
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 = []
foreach target: target_dirs
target_configs_h += config_target_h[target]
foreach m, module_ss : list
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()],
dependencies: [modulecommon, module_ss.dependencies()], pic: true)
if d == 'block'
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_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',
build_by_default: false,
- sources: common_all.sources() + genh,
+ sources: common_ss.all_sources() + genh,
include_directories: common_user_inc,
implicit_include_directories: false,
- dependencies: common_all.dependencies(),
+ dependencies: common_ss.all_dependencies(),
name_suffix: 'fa')
feature_to_c = find_program('scripts/feature_to_c.py')
if xen.found()
summary_info += {'xen ctrl version': xen.version()}
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
summary_info += {'TCG support': config_all.has_key('CONFIG_TCG')}
if config_all.has_key('CONFIG_TCG')
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_ALL', if_true: files('vhost-user-stub.c'))
endif
if targetos == 'windows'
endif
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_ALL', if_true: files('vhost-vdpa-stub.c'))
endif
vmnet_files = files(