Exclude all *-hmp-cmds.c files and HMP-only source files from the build when HMP is disabled.
Also conditionalise the hmp-commands.hx header generation and the test-hmp qtest. Together with the preceding CONFIG_HMP guards, this makes QEMU buildable with -Dhmp=disabled. Signed-off-by: Marc-André Lureau <[email protected]> --- meson.build | 2 +- audio/meson.build | 4 +++- backends/meson.build | 5 ++++- block/monitor/meson.build | 4 +++- chardev/meson.build | 5 ++++- disas/meson.build | 4 +++- dump/meson.build | 5 ++++- hw/core/meson.build | 5 +++-- hw/i386/meson.build | 4 +++- hw/net/meson.build | 4 +++- hw/pci/meson.build | 4 +++- hw/virtio/meson.build | 4 +++- migration/meson.build | 4 +++- monitor/meson.build | 9 +++++++-- net/meson.build | 4 +++- qom/meson.build | 4 +++- stats/meson.build | 5 ++++- stubs/meson.build | 12 +++++++----- system/meson.build | 9 +++++++-- tests/qtest/meson.build | 8 +++++++- trace/meson.build | 5 ++++- ui/meson.build | 4 +++- 22 files changed, 85 insertions(+), 29 deletions(-) diff --git a/meson.build b/meson.build index e83cfe56cf3..63f2d687b69 100644 --- a/meson.build +++ b/meson.build @@ -3538,7 +3538,7 @@ hx_headers = [ ['qemu-options.hx', 'qemu-options.def'], ['qemu-img-cmds.hx', 'qemu-img-cmds.h'], ] -if have_system +if have_system and have_hmp hx_headers += [ ['hmp-commands.hx', 'hmp-commands.h'], ['hmp-commands-info.hx', 'hmp-commands-info.h'], diff --git a/audio/meson.build b/audio/meson.build index 0e33b6f9836..6655f601b11 100644 --- a/audio/meson.build +++ b/audio/meson.build @@ -9,7 +9,9 @@ audio_ss.add(files( )) # deprecated since v10.2, to be removed -system_ss.add(files('audio-hmp-cmds.c', 'wavcapture.c')) +if have_hmp + system_ss.add(files('audio-hmp-cmds.c', 'wavcapture.c')) +endif audio_modules = {} foreach m : [ diff --git a/backends/meson.build b/backends/meson.build index 60021f45d12..a59729f56fe 100644 --- a/backends/meson.build +++ b/backends/meson.build @@ -1,6 +1,5 @@ system_ss.add([files( 'cryptodev-builtin.c', - 'cryptodev-hmp-cmds.c', 'cryptodev.c', 'hostmem-ram.c', 'hostmem.c', @@ -10,6 +9,10 @@ system_ss.add([files( 'confidential-guest-support.c', ), numa]) +if have_hmp + system_ss.add(files('cryptodev-hmp-cmds.c')) +endif + if host_os != 'windows' system_ss.add(files('rng-random.c')) if host_os != 'emscripten' diff --git a/block/monitor/meson.build b/block/monitor/meson.build index 74faced9e17..2d5c157a739 100644 --- a/block/monitor/meson.build +++ b/block/monitor/meson.build @@ -1,3 +1,5 @@ -system_ss.add(files('block-hmp-cmds.c')) +if have_hmp + system_ss.add(files('block-hmp-cmds.c')) +endif block_ss.add(files('bitmap-qmp-cmds.c')) system_ss.add(files('qmp-cmds.c')) diff --git a/chardev/meson.build b/chardev/meson.build index 56ee39ac0b0..031b6d7238c 100644 --- a/chardev/meson.build +++ b/chardev/meson.build @@ -30,11 +30,14 @@ endif chardev_ss = chardev_ss.apply({}) system_ss.add(files( - 'char-hmp-cmds.c', 'msmouse.c', 'wctablet.c', 'testdev.c')) +if have_hmp + system_ss.add(files('char-hmp-cmds.c')) +endif + chardev_modules = {} if brlapi.found() diff --git a/disas/meson.build b/disas/meson.build index 42977a1f74d..b382550e41f 100644 --- a/disas/meson.build +++ b/disas/meson.build @@ -20,5 +20,7 @@ common_ss.add(when: 'CONFIG_TCG', if_true: files( 'objdump.c' )) common_ss.add(files('disas-common.c')) -system_ss.add(files('disas-mon.c')) +if have_hmp + system_ss.add(files('disas-mon.c')) +endif specific_ss.add(capstone) diff --git a/dump/meson.build b/dump/meson.build index 26e1561ed48..bef8276aa5a 100644 --- a/dump/meson.build +++ b/dump/meson.build @@ -1,3 +1,6 @@ -system_ss.add([files('dump.c', 'dump-hmp-cmds.c'), snappy, lzo]) +system_ss.add([files('dump.c'), snappy, lzo]) +if have_hmp + system_ss.add(files('dump-hmp-cmds.c')) +endif specific_ss.add(when: 'CONFIG_WINDUMP', if_true: files('win_dump-x86.c')) system_ss.add(when: 'CONFIG_WINDUMP', if_false: files('win_dump-stubs.c')) diff --git a/hw/core/meson.build b/hw/core/meson.build index 8a96567de8f..8fe776d2c86 100644 --- a/hw/core/meson.build +++ b/hw/core/meson.build @@ -26,13 +26,11 @@ system_ss.add(when: 'CONFIG_SPLIT_IRQ', if_true: files('split-irq.c')) system_ss.add(when: 'CONFIG_XILINX_AXI', if_true: files('stream.c')) system_ss.add(when: 'CONFIG_PLATFORM_BUS', if_true: files('sysbus-fdt.c')) system_ss.add(when: 'CONFIG_EIF', if_true: [files('eif.c'), zlib, libcbor, gnutls]) - system_ss.add(files( 'cpu-system.c', 'fw-path-provider.c', 'hotplug.c', 'loader.c', - 'machine-hmp-cmds.c', 'machine-qmp-cmds.c', 'machine.c', 'nmi.c', @@ -46,6 +44,9 @@ system_ss.add(files( 'vm-change-state-handler.c', 'clock-vmstate.c', )) +if have_hmp + system_ss.add(files('machine-hmp-cmds.c')) +endif user_ss.add(files( 'cpu-user.c', 'qdev-user.c', diff --git a/hw/i386/meson.build b/hw/i386/meson.build index b611fbb5a7f..125f4ce894c 100644 --- a/hw/i386/meson.build +++ b/hw/i386/meson.build @@ -24,7 +24,9 @@ i386_ss.add(when: 'CONFIG_VTD', if_true: files('intel_iommu.c')) i386_ss.add(when: 'CONFIG_VTD_ACCEL', if_true: files('intel_iommu_accel.c')) i386_ss.add(when: 'CONFIG_SGX', if_true: files('sgx-epc.c','sgx.c'), if_false: files('sgx-stub.c')) -stub_ss.add(files('sgx-hmp-stub.c')) +if have_hmp + stub_ss.add(files('sgx-hmp-stub.c')) +endif i386_ss.add(when: 'CONFIG_ACPI', if_true: files('acpi-common.c')) i386_ss.add(when: 'CONFIG_PC', if_true: files( diff --git a/hw/net/meson.build b/hw/net/meson.build index 31025874699..76fe3d7dda6 100644 --- a/hw/net/meson.build +++ b/hw/net/meson.build @@ -68,6 +68,8 @@ system_ss.add(when: 'CONFIG_ROCKER', if_true: files( 'rocker/rocker_world.c', )) stub_ss.add(files('rocker/rocker-stubs.c')) -system_ss.add(files('rocker/rocker-hmp-cmds.c')) +if have_hmp + system_ss.add(files('rocker/rocker-hmp-cmds.c')) +endif subdir('can') diff --git a/hw/pci/meson.build b/hw/pci/meson.build index a6cbd89c0a3..984c7327e5d 100644 --- a/hw/pci/meson.build +++ b/hw/pci/meson.build @@ -5,12 +5,14 @@ pci_ss.add(files( 'pci.c', 'pci_bridge.c', 'pci_host.c', - 'pci-hmp-cmds.c', 'pci-qmp-cmds.c', 'pcie_sriov.c', 'shpc.c', 'slotid_cap.c' )) +if have_hmp + pci_ss.add(files('pci-hmp-cmds.c')) +endif # The functions in these modules can be used by devices too. Since we # allow plugging PCIe devices into PCI buses, include them even if # CONFIG_PCI_EXPRESS=n. diff --git a/hw/virtio/meson.build b/hw/virtio/meson.build index e0566a60de7..4b80e4e1c87 100644 --- a/hw/virtio/meson.build +++ b/hw/virtio/meson.build @@ -97,6 +97,8 @@ stub_ss.add(files('vhost-stub.c')) stub_ss.add(files('virtio-stub.c')) stub_ss.add(files('virtio-md-stubs.c')) -system_ss.add(files('virtio-hmp-cmds.c')) +if have_hmp + system_ss.add(files('virtio-hmp-cmds.c')) +endif system_ss.add(when: 'CONFIG_ACPI', if_true: files('virtio-acpi.c')) diff --git a/migration/meson.build b/migration/meson.build index e583822dec6..bb39d987110 100644 --- a/migration/meson.build +++ b/migration/meson.build @@ -36,7 +36,9 @@ system_ss.add(files( 'socket.c', 'tls.c', ), gnutls, zlib) -system_ss.add([spice_headers, files('migration-hmp-cmds.c'), spice]) +if have_hmp + system_ss.add([spice_headers, files('migration-hmp-cmds.c'), spice]) +endif if get_option('replication').allowed() system_ss.add(files('colo-failover.c', 'colo.c', 'multifd-colo.c')) diff --git a/monitor/meson.build b/monitor/meson.build index 4c58dd148c0..f67e0291a42 100644 --- a/monitor/meson.build +++ b/monitor/meson.build @@ -2,8 +2,13 @@ qmp_ss.add(files('monitor.c', 'qmp.c', 'qmp-cmds-control.c')) system_ss.add(files( 'fds.c', - 'hmp-cmds.c', - 'hmp.c', 'qemu-config-qmp.c', 'qmp-cmds.c', )) + +if have_hmp + system_ss.add(files( + 'hmp-cmds.c', + 'hmp.c', + )) +endif diff --git a/net/meson.build b/net/meson.build index da6ea635e95..bb7d70c6c36 100644 --- a/net/meson.build +++ b/net/meson.build @@ -8,7 +8,6 @@ system_ss.add(files( 'filter-mirror.c', 'filter.c', 'hub.c', - 'net-hmp-cmds.c', 'net.c', 'queue.c', 'socket.c', @@ -16,6 +15,9 @@ system_ss.add(files( 'stream_data.c', 'util.c', )) +if have_hmp + system_ss.add(files('net-hmp-cmds.c')) +endif if get_option('replication').allowed() or \ get_option('colo_proxy').allowed() diff --git a/qom/meson.build b/qom/meson.build index bd6f4aadd78..022d3ad5c8f 100644 --- a/qom/meson.build +++ b/qom/meson.build @@ -10,4 +10,6 @@ if have_system endif qmp_ss.add(files('qom-qmp-cmds.c')) -system_ss.add(files('qom-hmp-cmds.c')) +if have_hmp + system_ss.add(files('qom-hmp-cmds.c')) +endif diff --git a/stats/meson.build b/stats/meson.build index 0728dafcd1c..b5f68a94052 100644 --- a/stats/meson.build +++ b/stats/meson.build @@ -1 +1,4 @@ -system_ss.add(files('stats-hmp-cmds.c', 'stats-qmp-cmds.c')) +system_ss.add(files('stats-qmp-cmds.c')) +if have_hmp + system_ss.add(files('stats-hmp-cmds.c')) +endif diff --git a/stubs/meson.build b/stubs/meson.build index 3b2f2680b19..fe77107cc86 100644 --- a/stubs/meson.build +++ b/stubs/meson.build @@ -85,11 +85,13 @@ if have_system stub_ss.add(files('qmp-cpu.c')) stub_ss.add(files('qmp-cpu-s390x.c')) stub_ss.add(files('qmp-cpu-s390x-kvm.c')) - stub_ss.add(files('hmp-cmd-info_mem.c')) - stub_ss.add(files('hmp-cmd-info_sev.c')) - stub_ss.add(files('hmp-cmd-info_tlb.c')) - stub_ss.add(files('hmp-cmds-hw-s390x.c')) - stub_ss.add(files('hmp-cmds-target-i386.c')) + if have_hmp + stub_ss.add(files('hmp-cmd-info_mem.c')) + stub_ss.add(files('hmp-cmd-info_sev.c')) + stub_ss.add(files('hmp-cmd-info_tlb.c')) + stub_ss.add(files('hmp-cmds-hw-s390x.c')) + stub_ss.add(files('hmp-cmds-target-i386.c')) + endif endif if have_system or have_user diff --git a/system/meson.build b/system/meson.build index 9cdfe1b3e75..a1afc6fee5f 100644 --- a/system/meson.build +++ b/system/meson.build @@ -21,12 +21,17 @@ system_ss.add(files( 'qtest.c', 'rtc.c', 'runstate-action.c', - 'runstate-hmp-cmds.c', 'runstate.c', - 'tpm-hmp-cmds.c', 'watchpoint.c', )) +if have_hmp + system_ss.add(files( + 'runstate-hmp-cmds.c', + 'tpm-hmp-cmds.c', + )) +endif + if have_tpm system_ss.add(files('tpm.c')) endif diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index 728dde54b3f..acd175a679c 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -26,7 +26,13 @@ qtests_generic = [ 'qmp-test', 'qmp-cmd-test', 'qom-test', - 'test-hmp', +] +if have_hmp + qtests_generic += [ + 'test-hmp', + ] +endif +qtests_generic += [ 'qos-test', 'readconfig-test', 'netdev-socket', diff --git a/trace/meson.build b/trace/meson.build index d89a0db82a1..4e5681c44ca 100644 --- a/trace/meson.build +++ b/trace/meson.build @@ -1,4 +1,7 @@ -system_ss.add(files('control-target.c', 'trace-hmp-cmds.c')) +system_ss.add(files('control-target.c')) +if have_hmp + system_ss.add(files('trace-hmp-cmds.c')) +endif trace_rs_targets = [] trace_events_files = [] foreach item : [ '.' ] + trace_events_subdirs + qapi_trace_events diff --git a/ui/meson.build b/ui/meson.build index 1b8f71796e4..66790c29f44 100644 --- a/ui/meson.build +++ b/ui/meson.build @@ -57,10 +57,12 @@ system_ss.add(files( 'input-legacy.c', 'input-barrier.c', 'input.c', - 'ui-hmp-cmds.c', 'ui-qmp-cmds.c', 'util.c', )) +if have_hmp + system_ss.add(files('ui-hmp-cmds.c')) +endif system_ss.add(ui) system_ss.add(when: pixman, if_true: files('console-vc.c'), if_false: files('console-vc-stubs.c')) if dbus_display -- 2.54.0
