qemu/qapi/meson.build
<<
>>
Prefs
   1util_ss.add(files(
   2  'opts-visitor.c',
   3  'qapi-clone-visitor.c',
   4  'qapi-dealloc-visitor.c',
   5  'qapi-forward-visitor.c',
   6  'qapi-util.c',
   7  'qapi-visit-core.c',
   8  'qobject-input-visitor.c',
   9  'qobject-output-visitor.c',
  10  'string-input-visitor.c',
  11  'string-output-visitor.c',
  12))
  13if have_system
  14  util_ss.add(files('qapi-type-helpers.c'))
  15endif
  16if have_system or have_tools
  17  util_ss.add(files(
  18    'qmp-dispatch.c',
  19    'qmp-event.c',
  20    'qmp-registry.c',
  21  ))
  22endif
  23
  24qapi_all_modules = [
  25  'authz',
  26  'block',
  27  'block-core',
  28  'block-export',
  29  'char',
  30  'common',
  31  'compat',
  32  'control',
  33  'crypto',
  34  'dump',
  35  'error',
  36  'introspect',
  37  'job',
  38  'machine',
  39  'machine-target',
  40  'migration',
  41  'misc',
  42  'misc-target',
  43  'net',
  44  'pragma',
  45  'qom',
  46  'replay',
  47  'run-state',
  48  'sockets',
  49  'trace',
  50  'transaction',
  51  'yank',
  52]
  53if have_system
  54  qapi_all_modules += [
  55    'acpi',
  56    'audio',
  57    'qdev',
  58    'pci',
  59    'rdma',
  60    'rocker',
  61    'tpm',
  62  ]
  63endif
  64if have_system or have_tools
  65  qapi_all_modules += [
  66    'ui',
  67  ]
  68endif
  69
  70qapi_storage_daemon_modules = [
  71  'block-core',
  72  'block-export',
  73  'char',
  74  'common',
  75  'control',
  76  'crypto',
  77  'introspect',
  78  'job',
  79  'qom',
  80  'sockets',
  81  'pragma',
  82  'transaction',
  83]
  84
  85qapi_nonmodule_outputs = [
  86  'qapi-introspect.c', 'qapi-introspect.h',
  87  'qapi-types.c', 'qapi-types.h',
  88  'qapi-visit.h', 'qapi-visit.c',
  89  'qapi-commands.h', 'qapi-commands.c',
  90  'qapi-init-commands.h', 'qapi-init-commands.c',
  91  'qapi-events.h', 'qapi-events.c',
  92  'qapi-emit-events.c', 'qapi-emit-events.h',
  93]
  94
  95# First build all sources
  96qapi_util_outputs = [
  97  'qapi-builtin-types.c', 'qapi-builtin-visit.c',
  98  'qapi-builtin-types.h', 'qapi-builtin-visit.h',
  99]
 100
 101qapi_inputs = []
 102qapi_specific_outputs = []
 103foreach module : qapi_all_modules
 104  qapi_inputs += [ files(module + '.json') ]
 105  qapi_module_outputs = [
 106    'qapi-types-@0@.c'.format(module),
 107    'qapi-types-@0@.h'.format(module),
 108    'qapi-visit-@0@.c'.format(module),
 109    'qapi-visit-@0@.h'.format(module),
 110  ]
 111  if have_system or have_tools
 112    qapi_module_outputs += [
 113      'qapi-events-@0@.c'.format(module),
 114      'qapi-events-@0@.h'.format(module),
 115      'qapi-commands-@0@.c'.format(module),
 116      'qapi-commands-@0@.h'.format(module),
 117    ]
 118  endif
 119  if module.endswith('-target')
 120    qapi_specific_outputs += qapi_module_outputs
 121  else
 122    qapi_util_outputs += qapi_module_outputs
 123  endif
 124endforeach
 125
 126qapi_files = custom_target('shared QAPI source files',
 127  output: qapi_util_outputs + qapi_specific_outputs + qapi_nonmodule_outputs,
 128  input: [ files('qapi-schema.json') ],
 129  command: [ qapi_gen, '-o', 'qapi', '-b', '@INPUT0@' ],
 130  depend_files: [ qapi_inputs, qapi_gen_depends ])
 131
 132# Now go through all the outputs and add them to the right sourceset.
 133# These loops must be synchronized with the output of the above custom target.
 134
 135i = 0
 136foreach output : qapi_util_outputs
 137  if output.endswith('.h')
 138    genh += qapi_files[i]
 139  endif
 140  util_ss.add(qapi_files[i])
 141  i = i + 1
 142endforeach
 143
 144foreach output : qapi_specific_outputs + qapi_nonmodule_outputs
 145  if output.endswith('.h')
 146    genh += qapi_files[i]
 147  endif
 148  specific_ss.add(when: 'CONFIG_SOFTMMU', if_true: qapi_files[i])
 149  i = i + 1
 150endforeach
 151