xref: /qemu/block/meson.build (revision 53e8868d)
1block_ss.add(genh)
2block_ss.add(files(
3  'accounting.c',
4  'aio_task.c',
5  'amend.c',
6  'backup.c',
7  'blkdebug.c',
8  'blklogwrites.c',
9  'blkverify.c',
10  'block-backend.c',
11  'block-copy.c',
12  'commit.c',
13  'copy-before-write.c',
14  'copy-on-read.c',
15  'create.c',
16  'crypto.c',
17  'dirty-bitmap.c',
18  'filter-compress.c',
19  'graph-lock.c',
20  'io.c',
21  'mirror.c',
22  'nbd.c',
23  'null.c',
24  'preallocate.c',
25  'progress_meter.c',
26  'qapi.c',
27  'qcow2.c',
28  'qcow2-bitmap.c',
29  'qcow2-cache.c',
30  'qcow2-cluster.c',
31  'qcow2-refcount.c',
32  'qcow2-snapshot.c',
33  'qcow2-threads.c',
34  'quorum.c',
35  'raw-format.c',
36  'reqlist.c',
37  'snapshot.c',
38  'snapshot-access.c',
39  'throttle.c',
40  'throttle-groups.c',
41  'write-threshold.c',
42), zstd, zlib, gnutls)
43
44system_ss.add(when: 'CONFIG_TCG', if_true: files('blkreplay.c'))
45system_ss.add(files('block-ram-registrar.c'))
46
47if get_option('qcow1').allowed()
48  block_ss.add(files('qcow.c'))
49endif
50if get_option('vdi').allowed()
51  block_ss.add(files('vdi.c'))
52endif
53if get_option('vhdx').allowed()
54  block_ss.add(files(
55    'vhdx-endian.c',
56    'vhdx-log.c',
57    'vhdx.c'
58  ))
59endif
60if get_option('vmdk').allowed()
61  block_ss.add(files('vmdk.c'))
62endif
63if get_option('vpc').allowed()
64  block_ss.add(files('vpc.c'))
65endif
66if get_option('cloop').allowed()
67  block_ss.add(files('cloop.c'))
68endif
69if get_option('bochs').allowed()
70  block_ss.add(files('bochs.c'))
71endif
72if get_option('vvfat').allowed()
73  block_ss.add(files('vvfat.c'))
74endif
75if get_option('dmg').allowed()
76  block_ss.add(files('dmg.c'))
77endif
78if get_option('qed').allowed()
79  block_ss.add(files(
80    'qed-check.c',
81    'qed-cluster.c',
82    'qed-l2-cache.c',
83    'qed-table.c',
84    'qed.c',
85  ))
86endif
87if get_option('parallels').allowed()
88  block_ss.add(files('parallels.c', 'parallels-ext.c'))
89endif
90
91block_ss.add(when: 'CONFIG_WIN32', if_true: files('file-win32.c', 'win32-aio.c'))
92block_ss.add(when: 'CONFIG_POSIX', if_true: [files('file-posix.c'), coref, iokit])
93block_ss.add(when: libiscsi, if_true: files('iscsi-opts.c'))
94if targetos == 'linux'
95  block_ss.add(files('nvme.c'))
96endif
97if get_option('replication').allowed()
98  block_ss.add(files('replication.c'))
99endif
100block_ss.add(when: libaio, if_true: files('linux-aio.c'))
101block_ss.add(when: linux_io_uring, if_true: files('io_uring.c'))
102
103block_modules = {}
104
105modsrc = []
106foreach m : [
107  [blkio, 'blkio', files('blkio.c')],
108  [curl, 'curl', files('curl.c')],
109  [glusterfs, 'gluster', files('gluster.c')],
110  [libiscsi, 'iscsi', [files('iscsi.c'), libm]],
111  [libnfs, 'nfs', files('nfs.c')],
112  [libssh, 'ssh', files('ssh.c')],
113  [rbd, 'rbd', files('rbd.c')],
114]
115  if m[0].found()
116    module_ss = ss.source_set()
117    module_ss.add(when: m[0], if_true: m[2])
118    if enable_modules
119      modsrc += module_ss.all_sources()
120    endif
121    block_modules += {m[1] : module_ss}
122  endif
123endforeach
124
125# those are not exactly regular block modules, so treat them apart
126if get_option('dmg').allowed()
127  foreach m : [
128    [liblzfse, 'dmg-lzfse', liblzfse, 'dmg-lzfse.c'],
129    [libbzip2, 'dmg-bz2', [glib, libbzip2], 'dmg-bz2.c']
130  ]
131    if m[0].found()
132      module_ss = ss.source_set()
133      module_ss.add(when: m[2], if_true: files(m[3]))
134      block_modules += {m[1] : module_ss}
135    endif
136  endforeach
137endif
138
139module_block_py = find_program('../scripts/modules/module_block.py')
140module_block_h = custom_target('module_block.h',
141                               output: 'module_block.h',
142                               input: modsrc,
143                               command: [module_block_py, '@OUTPUT0@', modsrc])
144block_ss.add(module_block_h)
145
146wrapper_py = find_program('../scripts/block-coroutine-wrapper.py')
147block_gen_c = custom_target('block-gen.c',
148                            output: 'block-gen.c',
149                            input: files(
150                                      '../include/block/block-io.h',
151                                      '../include/block/dirty-bitmap.h',
152                                      '../include/block/block_int-io.h',
153                                      '../include/block/block-global-state.h',
154                                      '../include/sysemu/block-backend-global-state.h',
155                                      '../include/sysemu/block-backend-io.h',
156                                      'coroutines.h'
157                                      ),
158                            command: [wrapper_py, '@OUTPUT@', '@INPUT@'])
159block_ss.add(block_gen_c)
160
161block_ss.add(files('stream.c'))
162
163system_ss.add(files('qapi-sysemu.c'))
164
165subdir('export')
166subdir('monitor')
167
168modules += {'block': block_modules}
169