]>
Commit | Line | Data |
---|---|---|
a5665051 | 1 | project('qemu', ['c'], meson_version: '>=0.55.0', |
90756b2f | 2 | default_options: ['warning_level=1', 'c_std=gnu99', 'cpp_std=gnu++11', |
3e0e5190 | 3 | 'b_colorout=auto'], |
a5665051 PB |
4 | version: run_command('head', meson.source_root() / 'VERSION').stdout().strip()) |
5 | ||
6 | not_found = dependency('', required: false) | |
b29b40f4 PB |
7 | if meson.version().version_compare('>=0.56.0') |
8 | keyval = import('keyval') | |
9 | else | |
10 | keyval = import('unstable-keyval') | |
11 | endif | |
a81df1b6 | 12 | ss = import('sourceset') |
8b18cdbf | 13 | fs = import('fs') |
a81df1b6 | 14 | |
ce1c1e7a | 15 | sh = find_program('sh') |
a81df1b6 | 16 | cc = meson.get_compiler('c') |
a5665051 | 17 | config_host = keyval.load(meson.current_build_dir() / 'config-host.mak') |
3154fee4 | 18 | enable_modules = 'CONFIG_MODULES' in config_host |
35be72ba | 19 | enable_static = 'CONFIG_STATIC' in config_host |
f8aa24ea | 20 | build_docs = 'BUILD_DOCS' in config_host |
8fe11232 MAL |
21 | |
22 | if get_option('qemu_suffix').startswith('/') | |
23 | error('qemu_suffix cannot start with a /') | |
24 | endif | |
25 | ||
ab4c0996 | 26 | qemu_datadir = get_option('datadir') / get_option('qemu_suffix') |
491e74c1 | 27 | qemu_docdir = get_option('docdir') / get_option('qemu_suffix') |
859aef02 PB |
28 | config_host_data = configuration_data() |
29 | genh = [] | |
a5665051 | 30 | |
760e4327 PB |
31 | target_dirs = config_host['TARGET_DIRS'].split() |
32 | have_user = false | |
33 | have_system = false | |
34 | foreach target : target_dirs | |
35 | have_user = have_user or target.endswith('-user') | |
36 | have_system = have_system or target.endswith('-softmmu') | |
37 | endforeach | |
38 | have_tools = 'CONFIG_TOOLS' in config_host | |
39 | have_block = have_system or have_tools | |
40 | ||
201e8ed7 PB |
41 | python = import('python').find_installation() |
42 | ||
43 | supported_oses = ['windows', 'freebsd', 'netbsd', 'openbsd', 'darwin', 'sunos', 'linux'] | |
6125673e | 44 | supported_cpus = ['ppc', 'ppc64', 's390x', 'riscv32', 'riscv64', 'x86', 'x86_64', |
201e8ed7 PB |
45 | 'arm', 'aarch64', 'mips', 'mips64', 'sparc', 'sparc64'] |
46 | ||
47 | cpu = host_machine.cpu_family() | |
48 | targetos = host_machine.system() | |
49 | ||
8a19980e PB |
50 | if cpu in ['x86', 'x86_64'] |
51 | kvm_targets = ['i386-softmmu', 'x86_64-softmmu'] | |
52 | elif cpu == 'aarch64' | |
53 | kvm_targets = ['aarch64-softmmu'] | |
54 | elif cpu == 's390x' | |
55 | kvm_targets = ['s390x-softmmu'] | |
56 | elif cpu in ['ppc', 'ppc64'] | |
57 | kvm_targets = ['ppc-softmmu', 'ppc64-softmmu'] | |
fbc5884c HC |
58 | elif cpu in ['mips', 'mips64'] |
59 | kvm_targets = ['mips-softmmu', 'mipsel-softmmu', 'mips64-softmmu', 'mips64el-softmmu'] | |
8a19980e PB |
60 | else |
61 | kvm_targets = [] | |
62 | endif | |
63 | ||
64 | accelerator_targets = { 'CONFIG_KVM': kvm_targets } | |
65 | if cpu in ['x86', 'x86_64'] | |
66 | accelerator_targets += { | |
67 | 'CONFIG_HAX': ['i386-softmmu', 'x86_64-softmmu'], | |
68 | 'CONFIG_XEN': ['i386-softmmu', 'x86_64-softmmu'], | |
69 | 'CONFIG_HVF': ['x86_64-softmmu'], | |
70 | 'CONFIG_WHPX': ['i386-softmmu', 'x86_64-softmmu'], | |
71 | } | |
72 | endif | |
73 | ||
201e8ed7 PB |
74 | ################## |
75 | # Compiler flags # | |
76 | ################## | |
77 | ||
ff9ed62b AB |
78 | # Specify linker-script with add_project_link_arguments so that it is not placed |
79 | # within a linker --start-group/--end-group pair | |
80 | if 'CONFIG_FUZZ' in config_host | |
81 | add_project_link_arguments(['-Wl,-T,', | |
82 | (meson.current_source_dir() / 'tests/qtest/fuzz/fork_fuzz.ld')], | |
83 | native: false, language: ['c', 'cpp', 'objc']) | |
84 | endif | |
85 | ||
a5665051 PB |
86 | add_project_arguments(config_host['QEMU_CFLAGS'].split(), |
87 | native: false, language: ['c', 'objc']) | |
88 | add_project_arguments(config_host['QEMU_CXXFLAGS'].split(), | |
89 | native: false, language: 'cpp') | |
90 | add_project_link_arguments(config_host['QEMU_LDFLAGS'].split(), | |
91 | native: false, language: ['c', 'cpp', 'objc']) | |
a5665051 | 92 | |
1e6e616d PB |
93 | if targetos == 'linux' |
94 | add_project_arguments('-isystem', meson.current_source_dir() / 'linux-headers', | |
95 | '-isystem', 'linux-headers', | |
96 | language: ['c', 'cpp']) | |
97 | endif | |
98 | ||
99 | if 'CONFIG_TCG_INTERPRETER' in config_host | |
100 | tcg_arch = 'tci' | |
101 | elif config_host['ARCH'] == 'sparc64' | |
102 | tcg_arch = 'sparc' | |
103 | elif config_host['ARCH'] == 's390x' | |
104 | tcg_arch = 's390' | |
105 | elif config_host['ARCH'] in ['x86_64', 'x32'] | |
106 | tcg_arch = 'i386' | |
107 | elif config_host['ARCH'] == 'ppc64' | |
108 | tcg_arch = 'ppc' | |
109 | elif config_host['ARCH'] in ['riscv32', 'riscv64'] | |
110 | tcg_arch = 'riscv' | |
111 | else | |
112 | tcg_arch = config_host['ARCH'] | |
113 | endif | |
114 | add_project_arguments('-iquote', meson.current_source_dir() / 'tcg' / tcg_arch, | |
115 | '-iquote', '.', | |
116 | '-iquote', meson.current_source_dir(), | |
117 | '-iquote', meson.current_source_dir() / 'accel/tcg', | |
118 | '-iquote', meson.current_source_dir() / 'include', | |
119 | '-iquote', meson.current_source_dir() / 'disas/libvixl', | |
120 | language: ['c', 'cpp', 'objc']) | |
c46f76d1 | 121 | |
fc929892 MAL |
122 | link_language = meson.get_external_property('link_language', 'cpp') |
123 | if link_language == 'cpp' | |
124 | add_languages('cpp', required: true, native: false) | |
125 | endif | |
a5665051 PB |
126 | if host_machine.system() == 'darwin' |
127 | add_languages('objc', required: false, native: false) | |
128 | endif | |
129 | ||
deb62371 PB |
130 | sparse = find_program('cgcc', required: get_option('sparse')) |
131 | if sparse.found() | |
968b4db3 PB |
132 | run_target('sparse', |
133 | command: [find_program('scripts/check_sparse.py'), | |
deb62371 PB |
134 | 'compile_commands.json', sparse.full_path(), '-Wbitwise', |
135 | '-Wno-transparent-union', '-Wno-old-initializer', | |
136 | '-Wno-non-pointer-null']) | |
968b4db3 PB |
137 | endif |
138 | ||
6ec0e15d PB |
139 | ########################################### |
140 | # Target-specific checks and dependencies # | |
141 | ########################################### | |
142 | ||
143 | if targetos != 'linux' and get_option('mpath').enabled() | |
144 | error('Multipath is supported only on Linux') | |
145 | endif | |
146 | ||
a81df1b6 PB |
147 | m = cc.find_library('m', required: false) |
148 | util = cc.find_library('util', required: false) | |
4a96337d | 149 | winmm = [] |
a81df1b6 | 150 | socket = [] |
04c6f1e7 | 151 | version_res = [] |
d92989aa MAL |
152 | coref = [] |
153 | iokit = [] | |
b6c7cfd4 | 154 | emulator_link_args = [] |
b4e312e9 | 155 | cocoa = not_found |
8a19980e | 156 | hvf = not_found |
a81df1b6 PB |
157 | if targetos == 'windows' |
158 | socket = cc.find_library('ws2_32') | |
4a96337d | 159 | winmm = cc.find_library('winmm') |
04c6f1e7 MAL |
160 | |
161 | win = import('windows') | |
162 | version_res = win.compile_resources('version.rc', | |
163 | depend_files: files('pc-bios/qemu-nsis.ico'), | |
164 | include_directories: include_directories('.')) | |
d92989aa MAL |
165 | elif targetos == 'darwin' |
166 | coref = dependency('appleframeworks', modules: 'CoreFoundation') | |
167 | iokit = dependency('appleframeworks', modules: 'IOKit') | |
b4e312e9 | 168 | cocoa = dependency('appleframeworks', modules: 'Cocoa', required: get_option('cocoa')) |
cfad62f1 PB |
169 | elif targetos == 'sunos' |
170 | socket = [cc.find_library('socket'), | |
171 | cc.find_library('nsl'), | |
172 | cc.find_library('resolv')] | |
173 | elif targetos == 'haiku' | |
174 | socket = [cc.find_library('posix_error_mapper'), | |
175 | cc.find_library('network'), | |
176 | cc.find_library('bsd')] | |
b6c7cfd4 PB |
177 | elif targetos == 'openbsd' |
178 | if not get_option('tcg').disabled() and target_dirs.length() > 0 | |
179 | # Disable OpenBSD W^X if available | |
180 | emulator_link_args = cc.get_supported_link_arguments('-Wl,-z,wxneeded') | |
181 | endif | |
a81df1b6 | 182 | endif |
6ec0e15d | 183 | |
8a19980e PB |
184 | accelerators = [] |
185 | if not get_option('kvm').disabled() and targetos == 'linux' | |
186 | accelerators += 'CONFIG_KVM' | |
187 | endif | |
188 | if not get_option('xen').disabled() and 'CONFIG_XEN_BACKEND' in config_host | |
189 | accelerators += 'CONFIG_XEN' | |
190 | have_xen_pci_passthrough = not get_option('xen_pci_passthrough').disabled() and targetos == 'linux' | |
191 | else | |
192 | have_xen_pci_passthrough = false | |
193 | endif | |
194 | if not get_option('whpx').disabled() and targetos == 'windows' | |
195 | if get_option('whpx').enabled() and cpu != 'x86_64' | |
196 | error('WHPX requires 64-bit host') | |
197 | elif cc.has_header('WinHvPlatform.h', required: get_option('whpx')) and \ | |
198 | cc.has_header('WinHvEmulation.h', required: get_option('whpx')) | |
199 | accelerators += 'CONFIG_WHPX' | |
200 | endif | |
201 | endif | |
202 | if not get_option('hvf').disabled() | |
203 | hvf = dependency('appleframeworks', modules: 'Hypervisor', | |
204 | required: get_option('hvf')) | |
205 | if hvf.found() | |
206 | accelerators += 'CONFIG_HVF' | |
207 | endif | |
208 | endif | |
209 | if not get_option('hax').disabled() | |
210 | if get_option('hax').enabled() or targetos in ['windows', 'darwin', 'netbsd'] | |
211 | accelerators += 'CONFIG_HAX' | |
212 | endif | |
213 | endif | |
214 | if not get_option('tcg').disabled() | |
215 | if cpu not in supported_cpus | |
216 | if 'CONFIG_TCG_INTERPRETER' in config_host | |
217 | warning('Unsupported CPU @0@, will use TCG with TCI (experimental)'.format(cpu)) | |
218 | else | |
219 | error('Unsupported CPU @0@, try --enable-tcg-interpreter'.format(cpu)) | |
220 | endif | |
221 | endif | |
222 | accelerators += 'CONFIG_TCG' | |
223 | config_host += { 'CONFIG_TCG': 'y' } | |
224 | endif | |
225 | ||
226 | if 'CONFIG_KVM' not in accelerators and get_option('kvm').enabled() | |
227 | error('KVM not available on this platform') | |
228 | endif | |
229 | if 'CONFIG_HVF' not in accelerators and get_option('hvf').enabled() | |
230 | error('HVF not available on this platform') | |
231 | endif | |
232 | if 'CONFIG_WHPX' not in accelerators and get_option('whpx').enabled() | |
233 | error('WHPX not available on this platform') | |
234 | endif | |
235 | if not have_xen_pci_passthrough and get_option('xen_pci_passthrough').enabled() | |
236 | if 'CONFIG_XEN' in accelerators | |
237 | error('Xen PCI passthrough not available on this platform') | |
238 | else | |
239 | error('Xen PCI passthrough requested but Xen not enabled') | |
240 | endif | |
241 | endif | |
b4e312e9 PB |
242 | if not cocoa.found() and get_option('cocoa').enabled() |
243 | error('Cocoa not available on this platform') | |
244 | endif | |
245 | ||
6ec0e15d PB |
246 | ################ |
247 | # Dependencies # | |
248 | ################ | |
249 | ||
215b0c2f PB |
250 | # The path to glib.h is added to all compilation commands. This was |
251 | # grandfathered in from the QEMU Makefiles. | |
252 | add_project_arguments(config_host['GLIB_CFLAGS'].split(), | |
253 | native: false, language: ['c', 'cpp', 'objc']) | |
254 | glib = declare_dependency(link_args: config_host['GLIB_LIBS'].split()) | |
a81df1b6 PB |
255 | gio = not_found |
256 | if 'CONFIG_GIO' in config_host | |
257 | gio = declare_dependency(compile_args: config_host['GIO_CFLAGS'].split(), | |
258 | link_args: config_host['GIO_LIBS'].split()) | |
259 | endif | |
260 | lttng = not_found | |
261 | if 'CONFIG_TRACE_UST' in config_host | |
262 | lttng = declare_dependency(link_args: config_host['LTTNG_UST_LIBS'].split()) | |
263 | endif | |
264 | urcubp = not_found | |
265 | if 'CONFIG_TRACE_UST' in config_host | |
266 | urcubp = declare_dependency(link_args: config_host['URCU_BP_LIBS'].split()) | |
267 | endif | |
46859d93 DB |
268 | gcrypt = not_found |
269 | if 'CONFIG_GCRYPT' in config_host | |
270 | gcrypt = declare_dependency(compile_args: config_host['GCRYPT_CFLAGS'].split(), | |
271 | link_args: config_host['GCRYPT_LIBS'].split()) | |
272 | endif | |
a81df1b6 PB |
273 | nettle = not_found |
274 | if 'CONFIG_NETTLE' in config_host | |
275 | nettle = declare_dependency(compile_args: config_host['NETTLE_CFLAGS'].split(), | |
276 | link_args: config_host['NETTLE_LIBS'].split()) | |
277 | endif | |
278 | gnutls = not_found | |
279 | if 'CONFIG_GNUTLS' in config_host | |
280 | gnutls = declare_dependency(compile_args: config_host['GNUTLS_CFLAGS'].split(), | |
281 | link_args: config_host['GNUTLS_LIBS'].split()) | |
282 | endif | |
b7612f45 PB |
283 | pixman = not_found |
284 | if have_system or have_tools | |
285 | pixman = dependency('pixman-1', required: have_system, version:'>=0.21.8', | |
1a94933f | 286 | method: 'pkg-config', static: enable_static) |
b7612f45 | 287 | endif |
5e7fbd25 MAL |
288 | pam = not_found |
289 | if 'CONFIG_AUTH_PAM' in config_host | |
290 | pam = cc.find_library('pam') | |
291 | endif | |
5e5733e5 | 292 | libaio = cc.find_library('aio', required: false) |
1ffb3bbb | 293 | zlib = dependency('zlib', required: true, static: enable_static) |
5e5733e5 MAL |
294 | linux_io_uring = not_found |
295 | if 'CONFIG_LINUX_IO_URING' in config_host | |
296 | linux_io_uring = declare_dependency(compile_args: config_host['LINUX_IO_URING_CFLAGS'].split(), | |
297 | link_args: config_host['LINUX_IO_URING_LIBS'].split()) | |
298 | endif | |
299 | libxml2 = not_found | |
300 | if 'CONFIG_LIBXML2' in config_host | |
301 | libxml2 = declare_dependency(compile_args: config_host['LIBXML2_CFLAGS'].split(), | |
302 | link_args: config_host['LIBXML2_LIBS'].split()) | |
303 | endif | |
304 | libnfs = not_found | |
305 | if 'CONFIG_LIBNFS' in config_host | |
306 | libnfs = declare_dependency(link_args: config_host['LIBNFS_LIBS'].split()) | |
307 | endif | |
ec0d5893 MAL |
308 | libattr = not_found |
309 | if 'CONFIG_ATTR' in config_host | |
310 | libattr = declare_dependency(link_args: config_host['LIBATTR_LIBS'].split()) | |
311 | endif | |
3f99cf57 PB |
312 | seccomp = not_found |
313 | if 'CONFIG_SECCOMP' in config_host | |
314 | seccomp = declare_dependency(compile_args: config_host['SECCOMP_CFLAGS'].split(), | |
315 | link_args: config_host['SECCOMP_LIBS'].split()) | |
316 | endif | |
317 | libcap_ng = not_found | |
318 | if 'CONFIG_LIBCAP_NG' in config_host | |
319 | libcap_ng = declare_dependency(link_args: config_host['LIBCAP_NG_LIBS'].split()) | |
320 | endif | |
1917ec6d PB |
321 | if get_option('xkbcommon').auto() and not have_system and not have_tools |
322 | xkbcommon = not_found | |
323 | else | |
324 | xkbcommon = dependency('xkbcommon', required: get_option('xkbcommon'), | |
1a94933f | 325 | method: 'pkg-config', static: enable_static) |
ade60d4f | 326 | endif |
cdaf0722 MAL |
327 | vde = not_found |
328 | if config_host.has_key('CONFIG_VDE') | |
329 | vde = declare_dependency(link_args: config_host['VDE_LIBS'].split()) | |
330 | endif | |
478e943f PB |
331 | pulse = not_found |
332 | if 'CONFIG_LIBPULSE' in config_host | |
333 | pulse = declare_dependency(compile_args: config_host['PULSE_CFLAGS'].split(), | |
334 | link_args: config_host['PULSE_LIBS'].split()) | |
335 | endif | |
336 | alsa = not_found | |
337 | if 'CONFIG_ALSA' in config_host | |
338 | alsa = declare_dependency(compile_args: config_host['ALSA_CFLAGS'].split(), | |
339 | link_args: config_host['ALSA_LIBS'].split()) | |
340 | endif | |
341 | jack = not_found | |
342 | if 'CONFIG_LIBJACK' in config_host | |
343 | jack = declare_dependency(link_args: config_host['JACK_LIBS'].split()) | |
344 | endif | |
2634733c PB |
345 | spice = not_found |
346 | if 'CONFIG_SPICE' in config_host | |
347 | spice = declare_dependency(compile_args: config_host['SPICE_CFLAGS'].split(), | |
348 | link_args: config_host['SPICE_LIBS'].split()) | |
349 | endif | |
5ee24e78 | 350 | rt = cc.find_library('rt', required: false) |
ccf7afa5 PB |
351 | libdl = not_found |
352 | if 'CONFIG_PLUGIN' in config_host | |
353 | libdl = cc.find_library('dl', required: true) | |
354 | endif | |
99650b62 PB |
355 | libiscsi = not_found |
356 | if 'CONFIG_LIBISCSI' in config_host | |
357 | libiscsi = declare_dependency(compile_args: config_host['LIBISCSI_CFLAGS'].split(), | |
358 | link_args: config_host['LIBISCSI_LIBS'].split()) | |
359 | endif | |
5e5733e5 MAL |
360 | zstd = not_found |
361 | if 'CONFIG_ZSTD' in config_host | |
362 | zstd = declare_dependency(compile_args: config_host['ZSTD_CFLAGS'].split(), | |
363 | link_args: config_host['ZSTD_LIBS'].split()) | |
364 | endif | |
ea458960 MAL |
365 | gbm = not_found |
366 | if 'CONFIG_GBM' in config_host | |
367 | gbm = declare_dependency(compile_args: config_host['GBM_CFLAGS'].split(), | |
368 | link_args: config_host['GBM_LIBS'].split()) | |
369 | endif | |
370 | virgl = not_found | |
371 | if 'CONFIG_VIRGL' in config_host | |
372 | virgl = declare_dependency(compile_args: config_host['VIRGL_CFLAGS'].split(), | |
373 | link_args: config_host['VIRGL_LIBS'].split()) | |
374 | endif | |
1d7bb6ab MAL |
375 | curl = not_found |
376 | if 'CONFIG_CURL' in config_host | |
377 | curl = declare_dependency(compile_args: config_host['CURL_CFLAGS'].split(), | |
378 | link_args: config_host['CURL_LIBS'].split()) | |
379 | endif | |
f15bff25 | 380 | libudev = not_found |
f01496a3 | 381 | if targetos == 'linux' and (have_system or have_tools) |
6ec0e15d | 382 | libudev = dependency('libudev', |
5c53015a | 383 | required: get_option('libudev'), |
6ec0e15d PB |
384 | static: enable_static) |
385 | endif | |
386 | ||
5c53015a | 387 | mpathlibs = [libudev] |
6ec0e15d PB |
388 | mpathpersist = not_found |
389 | mpathpersist_new_api = false | |
390 | if targetos == 'linux' and have_tools and not get_option('mpath').disabled() | |
391 | mpath_test_source_new = ''' | |
392 | #include <libudev.h> | |
393 | #include <mpath_persist.h> | |
394 | unsigned mpath_mx_alloc_len = 1024; | |
395 | int logsink; | |
396 | static struct config *multipath_conf; | |
397 | extern struct udev *udev; | |
398 | extern struct config *get_multipath_config(void); | |
399 | extern void put_multipath_config(struct config *conf); | |
400 | struct udev *udev; | |
401 | struct config *get_multipath_config(void) { return multipath_conf; } | |
402 | void put_multipath_config(struct config *conf) { } | |
403 | int main(void) { | |
404 | udev = udev_new(); | |
405 | multipath_conf = mpath_lib_init(); | |
406 | return 0; | |
407 | }''' | |
408 | mpath_test_source_old = ''' | |
409 | #include <libudev.h> | |
410 | #include <mpath_persist.h> | |
411 | unsigned mpath_mx_alloc_len = 1024; | |
412 | int logsink; | |
413 | int main(void) { | |
414 | struct udev *udev = udev_new(); | |
415 | mpath_lib_init(udev); | |
416 | return 0; | |
417 | }''' | |
5c53015a PB |
418 | libmpathpersist = cc.find_library('mpathpersist', |
419 | required: get_option('mpath'), | |
420 | static: enable_static) | |
421 | if libmpathpersist.found() | |
422 | mpathlibs += libmpathpersist | |
423 | if enable_static | |
424 | mpathlibs += cc.find_library('devmapper', | |
425 | required: get_option('mpath'), | |
426 | static: enable_static) | |
43b43a40 | 427 | endif |
5c53015a PB |
428 | mpathlibs += cc.find_library('multipath', |
429 | required: get_option('mpath'), | |
430 | static: enable_static) | |
431 | foreach lib: mpathlibs | |
432 | if not lib.found() | |
433 | mpathlibs = [] | |
434 | break | |
435 | endif | |
436 | endforeach | |
437 | if mpathlibs.length() == 0 | |
438 | msg = 'Dependencies missing for libmpathpersist' | |
439 | elif cc.links(mpath_test_source_new, dependencies: mpathlibs) | |
6ec0e15d PB |
440 | mpathpersist = declare_dependency(dependencies: mpathlibs) |
441 | mpathpersist_new_api = true | |
442 | elif cc.links(mpath_test_source_old, dependencies: mpathlibs) | |
443 | mpathpersist = declare_dependency(dependencies: mpathlibs) | |
444 | else | |
5c53015a PB |
445 | msg = 'Cannot detect libmpathpersist API' |
446 | endif | |
447 | if not mpathpersist.found() | |
6ec0e15d | 448 | if get_option('mpath').enabled() |
5c53015a | 449 | error(msg) |
6ec0e15d | 450 | else |
5c53015a | 451 | warning(msg + ', disabling') |
6ec0e15d PB |
452 | endif |
453 | endif | |
454 | endif | |
f15bff25 | 455 | endif |
6ec0e15d | 456 | |
5285e593 YL |
457 | iconv = not_found |
458 | if not get_option('iconv').disabled() | |
459 | libiconv = cc.find_library('iconv', | |
460 | required: false, | |
461 | static: enable_static) | |
ac0c8351 BR |
462 | if cc.links(''' |
463 | #include <iconv.h> | |
464 | int main(void) { | |
465 | iconv_t conv = iconv_open("WCHAR_T", "UCS-2"); | |
466 | return conv != (iconv_t) -1; | |
467 | }''', dependencies: [libiconv]) | |
468 | iconv = declare_dependency(dependencies: [libiconv]) | |
5285e593 YL |
469 | endif |
470 | endif | |
471 | if get_option('iconv').enabled() and not iconv.found() | |
472 | error('Cannot detect iconv API') | |
473 | endif | |
474 | ||
475 | curses = not_found | |
476 | if iconv.found() and not get_option('curses').disabled() | |
477 | curses_libname_list = ['ncursesw', 'ncurses', 'cursesw', 'pdcurses'] | |
478 | curses_test = ''' | |
479 | #include <locale.h> | |
480 | #include <curses.h> | |
481 | #include <wchar.h> | |
482 | int main(void) { | |
483 | wchar_t wch = L'w'; | |
484 | setlocale(LC_ALL, ""); | |
485 | resize_term(0, 0); | |
486 | addwstr(L"wide chars\n"); | |
487 | addnwstr(&wch, 1); | |
488 | add_wch(WACS_DEGREE); | |
489 | return 0; | |
490 | }''' | |
491 | foreach curses_libname : curses_libname_list | |
492 | libcurses = dependency(curses_libname, | |
493 | required: false, | |
494 | method: 'pkg-config', | |
495 | static: enable_static) | |
496 | ||
497 | if not libcurses.found() | |
498 | dirs = ['/usr/include/ncursesw'] | |
499 | if targetos == 'windows' | |
500 | dirs = [] | |
501 | endif | |
502 | libcurses = cc.find_library(curses_libname, | |
503 | required: false, | |
504 | dirs: dirs, | |
505 | static: enable_static) | |
506 | endif | |
507 | if libcurses.found() | |
508 | if cc.links(curses_test, dependencies: [libcurses]) | |
509 | curses = declare_dependency(compile_args: '-DNCURSES_WIDECHAR', dependencies: [libcurses]) | |
510 | break | |
511 | endif | |
512 | endif | |
513 | endforeach | |
514 | endif | |
515 | if get_option('curses').enabled() and not curses.found() | |
516 | if not iconv.found() | |
517 | error('Cannot detect iconv API') | |
518 | else | |
519 | error('Cannot detect curses API') | |
520 | endif | |
521 | endif | |
522 | ||
2634733c PB |
523 | brlapi = not_found |
524 | if 'CONFIG_BRLAPI' in config_host | |
525 | brlapi = declare_dependency(link_args: config_host['BRLAPI_LIBS'].split()) | |
526 | endif | |
35be72ba | 527 | |
760e4327 PB |
528 | sdl = not_found |
529 | if have_system | |
363743da | 530 | sdl = dependency('sdl2', required: get_option('sdl'), static: enable_static) |
760e4327 PB |
531 | sdl_image = not_found |
532 | endif | |
35be72ba PB |
533 | if sdl.found() |
534 | # work around 2.0.8 bug | |
535 | sdl = declare_dependency(compile_args: '-Wno-undef', | |
536 | dependencies: sdl) | |
7161a433 | 537 | sdl_image = dependency('SDL2_image', required: get_option('sdl_image'), |
1a94933f | 538 | method: 'pkg-config', static: enable_static) |
35be72ba PB |
539 | else |
540 | if get_option('sdl_image').enabled() | |
a8dc2ace ST |
541 | error('sdl-image required, but SDL was @0@'.format( |
542 | get_option('sdl').disabled() ? 'disabled' : 'not found')) | |
35be72ba PB |
543 | endif |
544 | sdl_image = not_found | |
2634733c | 545 | endif |
35be72ba | 546 | |
5e5733e5 MAL |
547 | rbd = not_found |
548 | if 'CONFIG_RBD' in config_host | |
549 | rbd = declare_dependency(link_args: config_host['RBD_LIBS'].split()) | |
550 | endif | |
551 | glusterfs = not_found | |
552 | if 'CONFIG_GLUSTERFS' in config_host | |
553 | glusterfs = declare_dependency(compile_args: config_host['GLUSTERFS_CFLAGS'].split(), | |
554 | link_args: config_host['GLUSTERFS_LIBS'].split()) | |
555 | endif | |
556 | libssh = not_found | |
557 | if 'CONFIG_LIBSSH' in config_host | |
558 | libssh = declare_dependency(compile_args: config_host['LIBSSH_CFLAGS'].split(), | |
559 | link_args: config_host['LIBSSH_LIBS'].split()) | |
560 | endif | |
561 | libbzip2 = not_found | |
562 | if 'CONFIG_BZIP2' in config_host | |
563 | libbzip2 = declare_dependency(link_args: config_host['BZIP2_LIBS'].split()) | |
564 | endif | |
565 | liblzfse = not_found | |
566 | if 'CONFIG_LZFSE' in config_host | |
567 | liblzfse = declare_dependency(link_args: config_host['LZFSE_LIBS'].split()) | |
568 | endif | |
478e943f PB |
569 | oss = not_found |
570 | if 'CONFIG_AUDIO_OSS' in config_host | |
571 | oss = declare_dependency(link_args: config_host['OSS_LIBS'].split()) | |
572 | endif | |
573 | dsound = not_found | |
574 | if 'CONFIG_AUDIO_DSOUND' in config_host | |
575 | dsound = declare_dependency(link_args: config_host['DSOUND_LIBS'].split()) | |
576 | endif | |
577 | coreaudio = not_found | |
578 | if 'CONFIG_AUDIO_COREAUDIO' in config_host | |
579 | coreaudio = declare_dependency(link_args: config_host['COREAUDIO_LIBS'].split()) | |
2b1ccdf4 MAL |
580 | endif |
581 | opengl = not_found | |
582 | if 'CONFIG_OPENGL' in config_host | |
de2d3005 PB |
583 | opengl = declare_dependency(compile_args: config_host['OPENGL_CFLAGS'].split(), |
584 | link_args: config_host['OPENGL_LIBS'].split()) | |
2b1ccdf4 MAL |
585 | endif |
586 | gtk = not_found | |
587 | if 'CONFIG_GTK' in config_host | |
588 | gtk = declare_dependency(compile_args: config_host['GTK_CFLAGS'].split(), | |
589 | link_args: config_host['GTK_LIBS'].split()) | |
590 | endif | |
591 | vte = not_found | |
592 | if 'CONFIG_VTE' in config_host | |
593 | vte = declare_dependency(compile_args: config_host['VTE_CFLAGS'].split(), | |
594 | link_args: config_host['VTE_LIBS'].split()) | |
595 | endif | |
596 | x11 = not_found | |
597 | if 'CONFIG_X11' in config_host | |
598 | x11 = declare_dependency(compile_args: config_host['X11_CFLAGS'].split(), | |
599 | link_args: config_host['X11_LIBS'].split()) | |
600 | endif | |
a0b93237 | 601 | vnc = not_found |
2b1ccdf4 | 602 | png = not_found |
2b1ccdf4 | 603 | jpeg = not_found |
2b1ccdf4 | 604 | sasl = not_found |
a0b93237 PB |
605 | if get_option('vnc').enabled() |
606 | vnc = declare_dependency() # dummy dependency | |
607 | png = dependency('libpng', required: get_option('vnc_png'), | |
1a94933f | 608 | method: 'pkg-config', static: enable_static) |
a0b93237 PB |
609 | jpeg = cc.find_library('jpeg', has_headers: ['jpeglib.h'], |
610 | required: get_option('vnc_jpeg'), | |
611 | static: enable_static) | |
612 | sasl = cc.find_library('sasl2', has_headers: ['sasl/sasl.h'], | |
613 | required: get_option('vnc_sasl'), | |
614 | static: enable_static) | |
615 | if sasl.found() | |
616 | sasl = declare_dependency(dependencies: sasl, | |
617 | compile_args: '-DSTRUCT_IOVEC_DEFINED') | |
618 | endif | |
478e943f | 619 | endif |
708eab42 MAL |
620 | snappy = not_found |
621 | if 'CONFIG_SNAPPY' in config_host | |
622 | snappy = declare_dependency(link_args: config_host['SNAPPY_LIBS'].split()) | |
623 | endif | |
624 | lzo = not_found | |
625 | if 'CONFIG_LZO' in config_host | |
626 | lzo = declare_dependency(link_args: config_host['LZO_LIBS'].split()) | |
627 | endif | |
55166230 MAL |
628 | rdma = not_found |
629 | if 'CONFIG_RDMA' in config_host | |
630 | rdma = declare_dependency(link_args: config_host['RDMA_LIBS'].split()) | |
631 | endif | |
ab318051 MAL |
632 | numa = not_found |
633 | if 'CONFIG_NUMA' in config_host | |
634 | numa = declare_dependency(link_args: config_host['NUMA_LIBS'].split()) | |
635 | endif | |
582ea95f MAL |
636 | xen = not_found |
637 | if 'CONFIG_XEN_BACKEND' in config_host | |
638 | xen = declare_dependency(compile_args: config_host['XEN_CFLAGS'].split(), | |
639 | link_args: config_host['XEN_LIBS'].split()) | |
640 | endif | |
06677ce1 PB |
641 | cacard = not_found |
642 | if 'CONFIG_SMARTCARD' in config_host | |
643 | cacard = declare_dependency(compile_args: config_host['SMARTCARD_CFLAGS'].split(), | |
644 | link_args: config_host['SMARTCARD_LIBS'].split()) | |
645 | endif | |
0a40bcb7 CB |
646 | u2f = not_found |
647 | if have_system | |
648 | u2f = dependency('u2f-emu', required: get_option('u2f'), | |
649 | method: 'pkg-config', | |
650 | static: enable_static) | |
651 | endif | |
06677ce1 PB |
652 | usbredir = not_found |
653 | if 'CONFIG_USB_REDIR' in config_host | |
654 | usbredir = declare_dependency(compile_args: config_host['USB_REDIR_CFLAGS'].split(), | |
655 | link_args: config_host['USB_REDIR_LIBS'].split()) | |
656 | endif | |
657 | libusb = not_found | |
658 | if 'CONFIG_USB_LIBUSB' in config_host | |
659 | libusb = declare_dependency(compile_args: config_host['LIBUSB_CFLAGS'].split(), | |
660 | link_args: config_host['LIBUSB_LIBS'].split()) | |
661 | endif | |
c9322ab5 MAL |
662 | libpmem = not_found |
663 | if 'CONFIG_LIBPMEM' in config_host | |
664 | libpmem = declare_dependency(compile_args: config_host['LIBPMEM_CFLAGS'].split(), | |
665 | link_args: config_host['LIBPMEM_LIBS'].split()) | |
666 | endif | |
c7c91a74 BR |
667 | libdaxctl = not_found |
668 | if 'CONFIG_LIBDAXCTL' in config_host | |
669 | libdaxctl = declare_dependency(link_args: config_host['LIBDAXCTL_LIBS'].split()) | |
670 | endif | |
8ce0a45f MAL |
671 | tasn1 = not_found |
672 | if 'CONFIG_TASN1' in config_host | |
673 | tasn1 = declare_dependency(compile_args: config_host['TASN1_CFLAGS'].split(), | |
674 | link_args: config_host['TASN1_LIBS'].split()) | |
675 | endif | |
af04e89d MAL |
676 | keyutils = dependency('libkeyutils', required: false, |
677 | method: 'pkg-config', static: enable_static) | |
a81df1b6 | 678 | |
3909def8 MAL |
679 | has_gettid = cc.has_function('gettid') |
680 | ||
aa087962 PB |
681 | # Malloc tests |
682 | ||
683 | malloc = [] | |
684 | if get_option('malloc') == 'system' | |
685 | has_malloc_trim = \ | |
686 | not get_option('malloc_trim').disabled() and \ | |
687 | cc.links('''#include <malloc.h> | |
688 | int main(void) { malloc_trim(0); return 0; }''') | |
689 | else | |
690 | has_malloc_trim = false | |
691 | malloc = cc.find_library(get_option('malloc'), required: true) | |
692 | endif | |
693 | if not has_malloc_trim and get_option('malloc_trim').enabled() | |
694 | if get_option('malloc') == 'system' | |
695 | error('malloc_trim not available on this platform.') | |
696 | else | |
697 | error('malloc_trim not available with non-libc memory allocator') | |
698 | endif | |
699 | endif | |
700 | ||
a0c9162c PB |
701 | ################# |
702 | # config-host.h # | |
703 | ################# | |
859aef02 | 704 | |
b4e312e9 | 705 | config_host_data.set('CONFIG_COCOA', cocoa.found()) |
f01496a3 | 706 | config_host_data.set('CONFIG_LIBUDEV', libudev.found()) |
6ec0e15d PB |
707 | config_host_data.set('CONFIG_MPATH', mpathpersist.found()) |
708 | config_host_data.set('CONFIG_MPATH_NEW_API', mpathpersist_new_api) | |
5285e593 | 709 | config_host_data.set('CONFIG_CURSES', curses.found()) |
35be72ba PB |
710 | config_host_data.set('CONFIG_SDL', sdl.found()) |
711 | config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found()) | |
a0b93237 PB |
712 | config_host_data.set('CONFIG_VNC', vnc.found()) |
713 | config_host_data.set('CONFIG_VNC_JPEG', jpeg.found()) | |
714 | config_host_data.set('CONFIG_VNC_PNG', png.found()) | |
715 | config_host_data.set('CONFIG_VNC_SASL', sasl.found()) | |
4113f4cf | 716 | config_host_data.set('CONFIG_XKBCOMMON', xkbcommon.found()) |
af04e89d | 717 | config_host_data.set('CONFIG_KEYUTILS', keyutils.found()) |
3909def8 | 718 | config_host_data.set('CONFIG_GETTID', has_gettid) |
aa087962 | 719 | config_host_data.set('CONFIG_MALLOC_TRIM', has_malloc_trim) |
859aef02 PB |
720 | config_host_data.set('QEMU_VERSION', '"@0@"'.format(meson.project_version())) |
721 | config_host_data.set('QEMU_VERSION_MAJOR', meson.project_version().split('.')[0]) | |
722 | config_host_data.set('QEMU_VERSION_MINOR', meson.project_version().split('.')[1]) | |
723 | config_host_data.set('QEMU_VERSION_MICRO', meson.project_version().split('.')[2]) | |
724 | ||
765686d6 | 725 | ignored = ['CONFIG_QEMU_INTERP_PREFIX'] # actually per-target |
859aef02 | 726 | arrays = ['CONFIG_AUDIO_DRIVERS', 'CONFIG_BDRV_RW_WHITELIST', 'CONFIG_BDRV_RO_WHITELIST'] |
f4f5ed2c | 727 | strings = ['HOST_DSOSUF', 'CONFIG_IASL', 'bindir', 'prefix', 'qemu_confdir', 'qemu_datadir', |
859aef02 | 728 | 'qemu_moddir', 'qemu_localstatedir', 'qemu_helperdir', 'qemu_localedir', |
f4f5ed2c | 729 | 'qemu_icondir', 'qemu_desktopdir', 'qemu_firmwarepath', 'sysconfdir'] |
859aef02 | 730 | foreach k, v: config_host |
765686d6 PB |
731 | if ignored.contains(k) |
732 | # do nothing | |
733 | elif arrays.contains(k) | |
859aef02 PB |
734 | if v != '' |
735 | v = '"' + '", "'.join(v.split()) + '", ' | |
736 | endif | |
737 | config_host_data.set(k, v) | |
738 | elif k == 'ARCH' | |
739 | config_host_data.set('HOST_' + v.to_upper(), 1) | |
740 | elif strings.contains(k) | |
741 | if not k.startswith('CONFIG_') | |
742 | k = 'CONFIG_' + k.to_upper() | |
743 | endif | |
744 | config_host_data.set_quoted(k, v) | |
745 | elif k.startswith('CONFIG_') or k.startswith('HAVE_') or k.startswith('HOST_') | |
746 | config_host_data.set(k, v == 'y' ? 1 : v) | |
747 | endif | |
748 | endforeach | |
859aef02 | 749 | |
a0c9162c PB |
750 | ######################## |
751 | # Target configuration # | |
752 | ######################## | |
753 | ||
2becc36a | 754 | minikconf = find_program('scripts/minikconf.py') |
05512f55 | 755 | config_all = {} |
a98006bc | 756 | config_all_devices = {} |
ca0fc784 | 757 | config_all_disas = {} |
2becc36a PB |
758 | config_devices_mak_list = [] |
759 | config_devices_h = {} | |
859aef02 | 760 | config_target_h = {} |
2becc36a | 761 | config_target_mak = {} |
ca0fc784 PB |
762 | |
763 | disassemblers = { | |
764 | 'alpha' : ['CONFIG_ALPHA_DIS'], | |
765 | 'arm' : ['CONFIG_ARM_DIS'], | |
766 | 'avr' : ['CONFIG_AVR_DIS'], | |
767 | 'cris' : ['CONFIG_CRIS_DIS'], | |
768 | 'hppa' : ['CONFIG_HPPA_DIS'], | |
769 | 'i386' : ['CONFIG_I386_DIS'], | |
770 | 'x86_64' : ['CONFIG_I386_DIS'], | |
771 | 'x32' : ['CONFIG_I386_DIS'], | |
772 | 'lm32' : ['CONFIG_LM32_DIS'], | |
773 | 'm68k' : ['CONFIG_M68K_DIS'], | |
774 | 'microblaze' : ['CONFIG_MICROBLAZE_DIS'], | |
775 | 'mips' : ['CONFIG_MIPS_DIS'], | |
776 | 'moxie' : ['CONFIG_MOXIE_DIS'], | |
777 | 'nios2' : ['CONFIG_NIOS2_DIS'], | |
778 | 'or1k' : ['CONFIG_OPENRISC_DIS'], | |
779 | 'ppc' : ['CONFIG_PPC_DIS'], | |
780 | 'riscv' : ['CONFIG_RISCV_DIS'], | |
781 | 'rx' : ['CONFIG_RX_DIS'], | |
782 | 's390' : ['CONFIG_S390_DIS'], | |
783 | 'sh4' : ['CONFIG_SH4_DIS'], | |
784 | 'sparc' : ['CONFIG_SPARC_DIS'], | |
785 | 'xtensa' : ['CONFIG_XTENSA_DIS'], | |
786 | } | |
787 | if link_language == 'cpp' | |
788 | disassemblers += { | |
789 | 'aarch64' : [ 'CONFIG_ARM_A64_DIS'], | |
790 | 'arm' : [ 'CONFIG_ARM_DIS', 'CONFIG_ARM_A64_DIS'], | |
791 | 'mips' : [ 'CONFIG_MIPS_DIS', 'CONFIG_NANOMIPS_DIS'], | |
792 | } | |
793 | endif | |
794 | ||
2becc36a PB |
795 | kconfig_external_symbols = [ |
796 | 'CONFIG_KVM', | |
797 | 'CONFIG_XEN', | |
798 | 'CONFIG_TPM', | |
799 | 'CONFIG_SPICE', | |
800 | 'CONFIG_IVSHMEM', | |
801 | 'CONFIG_OPENGL', | |
802 | 'CONFIG_X11', | |
803 | 'CONFIG_VHOST_USER', | |
40bc0ca9 | 804 | 'CONFIG_VHOST_VDPA', |
2becc36a PB |
805 | 'CONFIG_VHOST_KERNEL', |
806 | 'CONFIG_VIRTFS', | |
807 | 'CONFIG_LINUX', | |
808 | 'CONFIG_PVRDMA', | |
809 | ] | |
a9a74907 | 810 | ignored = [ 'TARGET_XML_FILES', 'TARGET_ABI_DIR', 'TARGET_ARCH' ] |
05512f55 | 811 | |
fdb75aef PB |
812 | default_targets = 'CONFIG_DEFAULT_TARGETS' in config_host |
813 | actual_target_dirs = [] | |
fbb4121d | 814 | fdt_required = [] |
a81df1b6 | 815 | foreach target : target_dirs |
765686d6 PB |
816 | config_target = { 'TARGET_NAME': target.split('-')[0] } |
817 | if target.endswith('linux-user') | |
fdb75aef PB |
818 | if targetos != 'linux' |
819 | if default_targets | |
820 | continue | |
821 | endif | |
822 | error('Target @0@ is only available on a Linux host'.format(target)) | |
823 | endif | |
765686d6 PB |
824 | config_target += { 'CONFIG_LINUX_USER': 'y' } |
825 | elif target.endswith('bsd-user') | |
fdb75aef PB |
826 | if 'CONFIG_BSD' not in config_host |
827 | if default_targets | |
828 | continue | |
829 | endif | |
830 | error('Target @0@ is only available on a BSD host'.format(target)) | |
831 | endif | |
765686d6 PB |
832 | config_target += { 'CONFIG_BSD_USER': 'y' } |
833 | elif target.endswith('softmmu') | |
834 | config_target += { 'CONFIG_SOFTMMU': 'y' } | |
835 | endif | |
836 | if target.endswith('-user') | |
837 | config_target += { | |
838 | 'CONFIG_USER_ONLY': 'y', | |
839 | 'CONFIG_QEMU_INTERP_PREFIX': | |
840 | config_host['CONFIG_QEMU_INTERP_PREFIX'].format(config_target['TARGET_NAME']) | |
841 | } | |
842 | endif | |
859aef02 | 843 | |
8a19980e PB |
844 | have_accel = false |
845 | foreach sym: accelerators | |
846 | if sym == 'CONFIG_TCG' or target in accelerator_targets.get(sym, []) | |
847 | config_target += { sym: 'y' } | |
848 | config_all += { sym: 'y' } | |
849 | if sym == 'CONFIG_XEN' and have_xen_pci_passthrough | |
850 | config_target += { 'CONFIG_XEN_PCI_PASSTHROUGH': 'y' } | |
851 | endif | |
852 | have_accel = true | |
853 | endif | |
854 | endforeach | |
fdb75aef PB |
855 | if not have_accel |
856 | if default_targets | |
857 | continue | |
858 | endif | |
859 | error('No accelerator available for target @0@'.format(target)) | |
860 | endif | |
8a19980e | 861 | |
fdb75aef | 862 | actual_target_dirs += target |
765686d6 | 863 | config_target += keyval.load('default-configs/targets' / target + '.mak') |
a9a74907 | 864 | config_target += { 'TARGET_' + config_target['TARGET_ARCH'].to_upper(): 'y' } |
765686d6 | 865 | |
fbb4121d PB |
866 | if 'TARGET_NEED_FDT' in config_target |
867 | fdt_required += target | |
868 | endif | |
869 | ||
fa73168b PB |
870 | # Add default keys |
871 | if 'TARGET_BASE_ARCH' not in config_target | |
872 | config_target += {'TARGET_BASE_ARCH': config_target['TARGET_ARCH']} | |
873 | endif | |
874 | if 'TARGET_ABI_DIR' not in config_target | |
875 | config_target += {'TARGET_ABI_DIR': config_target['TARGET_ARCH']} | |
876 | endif | |
859aef02 | 877 | |
ca0fc784 PB |
878 | foreach k, v: disassemblers |
879 | if config_host['ARCH'].startswith(k) or config_target['TARGET_BASE_ARCH'].startswith(k) | |
880 | foreach sym: v | |
881 | config_target += { sym: 'y' } | |
882 | config_all_disas += { sym: 'y' } | |
883 | endforeach | |
884 | endif | |
885 | endforeach | |
886 | ||
859aef02 PB |
887 | config_target_data = configuration_data() |
888 | foreach k, v: config_target | |
889 | if not k.startswith('TARGET_') and not k.startswith('CONFIG_') | |
890 | # do nothing | |
891 | elif ignored.contains(k) | |
892 | # do nothing | |
893 | elif k == 'TARGET_BASE_ARCH' | |
a9a74907 PB |
894 | # Note that TARGET_BASE_ARCH ends up in config-target.h but it is |
895 | # not used to select files from sourcesets. | |
859aef02 | 896 | config_target_data.set('TARGET_' + v.to_upper(), 1) |
765686d6 | 897 | elif k == 'TARGET_NAME' or k == 'CONFIG_QEMU_INTERP_PREFIX' |
859aef02 PB |
898 | config_target_data.set_quoted(k, v) |
899 | elif v == 'y' | |
900 | config_target_data.set(k, 1) | |
901 | else | |
902 | config_target_data.set(k, v) | |
903 | endif | |
904 | endforeach | |
905 | config_target_h += {target: configure_file(output: target + '-config-target.h', | |
906 | configuration: config_target_data)} | |
2becc36a PB |
907 | |
908 | if target.endswith('-softmmu') | |
2becc36a PB |
909 | base_kconfig = [] |
910 | foreach sym : kconfig_external_symbols | |
859aef02 | 911 | if sym in config_target or sym in config_host |
2becc36a PB |
912 | base_kconfig += '@0@=y'.format(sym) |
913 | endif | |
914 | endforeach | |
915 | ||
916 | config_devices_mak = target + '-config-devices.mak' | |
917 | config_devices_mak = configure_file( | |
1bb4cb1c | 918 | input: ['default-configs/devices' / target + '.mak', 'Kconfig'], |
2becc36a PB |
919 | output: config_devices_mak, |
920 | depfile: config_devices_mak + '.d', | |
921 | capture: true, | |
922 | command: [minikconf, config_host['CONFIG_MINIKCONF_MODE'], | |
923 | config_devices_mak, '@DEPFILE@', '@INPUT@', | |
924 | base_kconfig]) | |
859aef02 PB |
925 | |
926 | config_devices_data = configuration_data() | |
927 | config_devices = keyval.load(config_devices_mak) | |
928 | foreach k, v: config_devices | |
929 | config_devices_data.set(k, 1) | |
930 | endforeach | |
2becc36a | 931 | config_devices_mak_list += config_devices_mak |
859aef02 PB |
932 | config_devices_h += {target: configure_file(output: target + '-config-devices.h', |
933 | configuration: config_devices_data)} | |
934 | config_target += config_devices | |
a98006bc | 935 | config_all_devices += config_devices |
2becc36a PB |
936 | endif |
937 | config_target_mak += {target: config_target} | |
a81df1b6 | 938 | endforeach |
fdb75aef | 939 | target_dirs = actual_target_dirs |
a81df1b6 | 940 | |
2becc36a PB |
941 | # This configuration is used to build files that are shared by |
942 | # multiple binaries, and then extracted out of the "common" | |
943 | # static_library target. | |
944 | # | |
945 | # We do not use all_sources()/all_dependencies(), because it would | |
946 | # build literally all source files, including devices only used by | |
947 | # targets that are not built for this compilation. The CONFIG_ALL | |
948 | # pseudo symbol replaces it. | |
949 | ||
05512f55 | 950 | config_all += config_all_devices |
2becc36a PB |
951 | config_all += config_host |
952 | config_all += config_all_disas | |
953 | config_all += { | |
954 | 'CONFIG_XEN': config_host.has_key('CONFIG_XEN_BACKEND'), | |
955 | 'CONFIG_SOFTMMU': have_system, | |
956 | 'CONFIG_USER_ONLY': have_user, | |
957 | 'CONFIG_ALL': true, | |
958 | } | |
959 | ||
a0c9162c PB |
960 | ############## |
961 | # Submodules # | |
962 | ############## | |
8b18cdbf RH |
963 | |
964 | capstone = not_found | |
965 | capstone_opt = get_option('capstone') | |
966 | if capstone_opt in ['enabled', 'auto', 'system'] | |
967 | have_internal = fs.exists(meson.current_source_dir() / 'capstone/Makefile') | |
bcf36862 RH |
968 | capstone = dependency('capstone', version: '>=4.0', |
969 | static: enable_static, method: 'pkg-config', | |
8b18cdbf RH |
970 | required: capstone_opt == 'system' or |
971 | capstone_opt == 'enabled' and not have_internal) | |
972 | if capstone.found() | |
973 | capstone_opt = 'system' | |
974 | elif have_internal | |
975 | capstone_opt = 'internal' | |
976 | else | |
977 | capstone_opt = 'disabled' | |
978 | endif | |
979 | endif | |
980 | if capstone_opt == 'internal' | |
981 | capstone_data = configuration_data() | |
982 | capstone_data.set('CAPSTONE_USE_SYS_DYN_MEM', '1') | |
983 | ||
984 | capstone_files = files( | |
985 | 'capstone/cs.c', | |
986 | 'capstone/MCInst.c', | |
987 | 'capstone/MCInstrDesc.c', | |
988 | 'capstone/MCRegisterInfo.c', | |
989 | 'capstone/SStream.c', | |
990 | 'capstone/utils.c' | |
991 | ) | |
992 | ||
993 | if 'CONFIG_ARM_DIS' in config_all_disas | |
994 | capstone_data.set('CAPSTONE_HAS_ARM', '1') | |
995 | capstone_files += files( | |
996 | 'capstone/arch/ARM/ARMDisassembler.c', | |
997 | 'capstone/arch/ARM/ARMInstPrinter.c', | |
998 | 'capstone/arch/ARM/ARMMapping.c', | |
999 | 'capstone/arch/ARM/ARMModule.c' | |
1000 | ) | |
1001 | endif | |
1002 | ||
1003 | # FIXME: This config entry currently depends on a c++ compiler. | |
1004 | # Which is needed for building libvixl, but not for capstone. | |
1005 | if 'CONFIG_ARM_A64_DIS' in config_all_disas | |
1006 | capstone_data.set('CAPSTONE_HAS_ARM64', '1') | |
1007 | capstone_files += files( | |
1008 | 'capstone/arch/AArch64/AArch64BaseInfo.c', | |
1009 | 'capstone/arch/AArch64/AArch64Disassembler.c', | |
1010 | 'capstone/arch/AArch64/AArch64InstPrinter.c', | |
1011 | 'capstone/arch/AArch64/AArch64Mapping.c', | |
1012 | 'capstone/arch/AArch64/AArch64Module.c' | |
1013 | ) | |
1014 | endif | |
1015 | ||
1016 | if 'CONFIG_PPC_DIS' in config_all_disas | |
1017 | capstone_data.set('CAPSTONE_HAS_POWERPC', '1') | |
1018 | capstone_files += files( | |
1019 | 'capstone/arch/PowerPC/PPCDisassembler.c', | |
1020 | 'capstone/arch/PowerPC/PPCInstPrinter.c', | |
1021 | 'capstone/arch/PowerPC/PPCMapping.c', | |
1022 | 'capstone/arch/PowerPC/PPCModule.c' | |
1023 | ) | |
1024 | endif | |
1025 | ||
3d562845 RH |
1026 | if 'CONFIG_S390_DIS' in config_all_disas |
1027 | capstone_data.set('CAPSTONE_HAS_SYSZ', '1') | |
1028 | capstone_files += files( | |
1029 | 'capstone/arch/SystemZ/SystemZDisassembler.c', | |
1030 | 'capstone/arch/SystemZ/SystemZInstPrinter.c', | |
1031 | 'capstone/arch/SystemZ/SystemZMapping.c', | |
1032 | 'capstone/arch/SystemZ/SystemZModule.c', | |
1033 | 'capstone/arch/SystemZ/SystemZMCTargetDesc.c' | |
1034 | ) | |
1035 | endif | |
1036 | ||
8b18cdbf RH |
1037 | if 'CONFIG_I386_DIS' in config_all_disas |
1038 | capstone_data.set('CAPSTONE_HAS_X86', 1) | |
1039 | capstone_files += files( | |
1040 | 'capstone/arch/X86/X86Disassembler.c', | |
1041 | 'capstone/arch/X86/X86DisassemblerDecoder.c', | |
1042 | 'capstone/arch/X86/X86ATTInstPrinter.c', | |
1043 | 'capstone/arch/X86/X86IntelInstPrinter.c', | |
eef20e40 | 1044 | 'capstone/arch/X86/X86InstPrinterCommon.c', |
8b18cdbf RH |
1045 | 'capstone/arch/X86/X86Mapping.c', |
1046 | 'capstone/arch/X86/X86Module.c' | |
1047 | ) | |
1048 | endif | |
1049 | ||
1050 | configure_file(output: 'capstone-defs.h', configuration: capstone_data) | |
1051 | ||
1052 | capstone_cargs = [ | |
1053 | # FIXME: There does not seem to be a way to completely replace the c_args | |
1054 | # that come from add_project_arguments() -- we can only add to them. | |
1055 | # So: disable all warnings with a big hammer. | |
1056 | '-Wno-error', '-w', | |
1057 | ||
1058 | # Include all configuration defines via a header file, which will wind up | |
1059 | # as a dependency on the object file, and thus changes here will result | |
1060 | # in a rebuild. | |
1061 | '-include', 'capstone-defs.h' | |
1062 | ] | |
1063 | ||
1064 | libcapstone = static_library('capstone', | |
1065 | sources: capstone_files, | |
1066 | c_args: capstone_cargs, | |
1067 | include_directories: 'capstone/include') | |
1068 | capstone = declare_dependency(link_with: libcapstone, | |
eef20e40 | 1069 | include_directories: 'capstone/include/capstone') |
8b18cdbf | 1070 | endif |
4d34a86b PB |
1071 | |
1072 | slirp = not_found | |
1073 | slirp_opt = 'disabled' | |
1074 | if have_system | |
1075 | slirp_opt = get_option('slirp') | |
1076 | if slirp_opt in ['enabled', 'auto', 'system'] | |
1077 | have_internal = fs.exists(meson.current_source_dir() / 'slirp/meson.build') | |
1078 | slirp = dependency('slirp', static: enable_static, | |
1079 | method: 'pkg-config', | |
1080 | required: slirp_opt == 'system' or | |
1081 | slirp_opt == 'enabled' and not have_internal) | |
1082 | if slirp.found() | |
1083 | slirp_opt = 'system' | |
1084 | elif have_internal | |
1085 | slirp_opt = 'internal' | |
1086 | else | |
1087 | slirp_opt = 'disabled' | |
1088 | endif | |
1089 | endif | |
1090 | if slirp_opt == 'internal' | |
1091 | slirp_deps = [] | |
1092 | if targetos == 'windows' | |
1093 | slirp_deps = cc.find_library('iphlpapi') | |
1094 | endif | |
1095 | slirp_conf = configuration_data() | |
1096 | slirp_conf.set('SLIRP_MAJOR_VERSION', meson.project_version().split('.')[0]) | |
1097 | slirp_conf.set('SLIRP_MINOR_VERSION', meson.project_version().split('.')[1]) | |
1098 | slirp_conf.set('SLIRP_MICRO_VERSION', meson.project_version().split('.')[2]) | |
1099 | slirp_conf.set_quoted('SLIRP_VERSION_STRING', meson.project_version()) | |
1100 | slirp_cargs = ['-DG_LOG_DOMAIN="Slirp"'] | |
1101 | slirp_files = [ | |
1102 | 'slirp/src/arp_table.c', | |
1103 | 'slirp/src/bootp.c', | |
1104 | 'slirp/src/cksum.c', | |
1105 | 'slirp/src/dhcpv6.c', | |
1106 | 'slirp/src/dnssearch.c', | |
1107 | 'slirp/src/if.c', | |
1108 | 'slirp/src/ip6_icmp.c', | |
1109 | 'slirp/src/ip6_input.c', | |
1110 | 'slirp/src/ip6_output.c', | |
1111 | 'slirp/src/ip_icmp.c', | |
1112 | 'slirp/src/ip_input.c', | |
1113 | 'slirp/src/ip_output.c', | |
1114 | 'slirp/src/mbuf.c', | |
1115 | 'slirp/src/misc.c', | |
1116 | 'slirp/src/ncsi.c', | |
1117 | 'slirp/src/ndp_table.c', | |
1118 | 'slirp/src/sbuf.c', | |
1119 | 'slirp/src/slirp.c', | |
1120 | 'slirp/src/socket.c', | |
1121 | 'slirp/src/state.c', | |
1122 | 'slirp/src/stream.c', | |
1123 | 'slirp/src/tcp_input.c', | |
1124 | 'slirp/src/tcp_output.c', | |
1125 | 'slirp/src/tcp_subr.c', | |
1126 | 'slirp/src/tcp_timer.c', | |
1127 | 'slirp/src/tftp.c', | |
1128 | 'slirp/src/udp.c', | |
1129 | 'slirp/src/udp6.c', | |
1130 | 'slirp/src/util.c', | |
1131 | 'slirp/src/version.c', | |
1132 | 'slirp/src/vmstate.c', | |
1133 | ] | |
1134 | ||
1135 | configure_file( | |
1136 | input : 'slirp/src/libslirp-version.h.in', | |
1137 | output : 'libslirp-version.h', | |
1138 | configuration: slirp_conf) | |
1139 | ||
1140 | slirp_inc = include_directories('slirp', 'slirp/src') | |
1141 | libslirp = static_library('slirp', | |
1142 | sources: slirp_files, | |
1143 | c_args: slirp_cargs, | |
1144 | include_directories: slirp_inc) | |
1145 | slirp = declare_dependency(link_with: libslirp, | |
1146 | dependencies: slirp_deps, | |
1147 | include_directories: slirp_inc) | |
1148 | endif | |
1149 | endif | |
1150 | ||
fbb4121d PB |
1151 | fdt = not_found |
1152 | fdt_opt = get_option('fdt') | |
1153 | if have_system | |
1154 | if fdt_opt in ['enabled', 'auto', 'system'] | |
1155 | have_internal = fs.exists(meson.current_source_dir() / 'dtc/libfdt/Makefile.libfdt') | |
1156 | fdt = cc.find_library('fdt', static: enable_static, | |
1157 | required: fdt_opt == 'system' or | |
1158 | fdt_opt == 'enabled' and not have_internal) | |
1159 | if fdt.found() and cc.links(''' | |
1160 | #include <libfdt.h> | |
1161 | #include <libfdt_env.h> | |
1162 | int main(void) { fdt_check_full(NULL, 0); return 0; }''', | |
1163 | dependencies: fdt) | |
1164 | fdt_opt = 'system' | |
1165 | elif have_internal | |
1166 | fdt_opt = 'internal' | |
1167 | else | |
1168 | fdt_opt = 'disabled' | |
1169 | endif | |
1170 | endif | |
1171 | if fdt_opt == 'internal' | |
1172 | fdt_files = files( | |
1173 | 'dtc/libfdt/fdt.c', | |
1174 | 'dtc/libfdt/fdt_ro.c', | |
1175 | 'dtc/libfdt/fdt_wip.c', | |
1176 | 'dtc/libfdt/fdt_sw.c', | |
1177 | 'dtc/libfdt/fdt_rw.c', | |
1178 | 'dtc/libfdt/fdt_strerror.c', | |
1179 | 'dtc/libfdt/fdt_empty_tree.c', | |
1180 | 'dtc/libfdt/fdt_addresses.c', | |
1181 | 'dtc/libfdt/fdt_overlay.c', | |
1182 | 'dtc/libfdt/fdt_check.c', | |
1183 | ) | |
1184 | ||
1185 | fdt_inc = include_directories('dtc/libfdt') | |
1186 | libfdt = static_library('fdt', | |
1187 | sources: fdt_files, | |
1188 | include_directories: fdt_inc) | |
1189 | fdt = declare_dependency(link_with: libfdt, | |
1190 | include_directories: fdt_inc) | |
1191 | endif | |
1192 | endif | |
1193 | if not fdt.found() and fdt_required.length() > 0 | |
1194 | error('fdt not available but required by targets ' + ', '.join(fdt_required)) | |
1195 | endif | |
1196 | ||
8b18cdbf | 1197 | config_host_data.set('CONFIG_CAPSTONE', capstone.found()) |
fbb4121d | 1198 | config_host_data.set('CONFIG_FDT', fdt.found()) |
4d34a86b | 1199 | config_host_data.set('CONFIG_SLIRP', slirp.found()) |
8b18cdbf | 1200 | |
a0c9162c PB |
1201 | ##################### |
1202 | # Generated sources # | |
1203 | ##################### | |
8b18cdbf | 1204 | |
a0c9162c | 1205 | genh += configure_file(output: 'config-host.h', configuration: config_host_data) |
a81df1b6 | 1206 | |
3f885659 | 1207 | hxtool = find_program('scripts/hxtool') |
650b5d54 | 1208 | shaderinclude = find_program('scripts/shaderinclude.pl') |
a81df1b6 PB |
1209 | qapi_gen = find_program('scripts/qapi-gen.py') |
1210 | qapi_gen_depends = [ meson.source_root() / 'scripts/qapi/__init__.py', | |
1211 | meson.source_root() / 'scripts/qapi/commands.py', | |
1212 | meson.source_root() / 'scripts/qapi/common.py', | |
a81df1b6 PB |
1213 | meson.source_root() / 'scripts/qapi/error.py', |
1214 | meson.source_root() / 'scripts/qapi/events.py', | |
1215 | meson.source_root() / 'scripts/qapi/expr.py', | |
1216 | meson.source_root() / 'scripts/qapi/gen.py', | |
1217 | meson.source_root() / 'scripts/qapi/introspect.py', | |
1218 | meson.source_root() / 'scripts/qapi/parser.py', | |
1219 | meson.source_root() / 'scripts/qapi/schema.py', | |
1220 | meson.source_root() / 'scripts/qapi/source.py', | |
1221 | meson.source_root() / 'scripts/qapi/types.py', | |
1222 | meson.source_root() / 'scripts/qapi/visit.py', | |
1223 | meson.source_root() / 'scripts/qapi/common.py', | |
a81df1b6 PB |
1224 | meson.source_root() / 'scripts/qapi-gen.py' |
1225 | ] | |
1226 | ||
1227 | tracetool = [ | |
1228 | python, files('scripts/tracetool.py'), | |
1229 | '--backend=' + config_host['TRACE_BACKENDS'] | |
1230 | ] | |
1231 | ||
2c273f32 MAL |
1232 | qemu_version_cmd = [find_program('scripts/qemu-version.sh'), |
1233 | meson.current_source_dir(), | |
859aef02 | 1234 | config_host['PKGVERSION'], meson.project_version()] |
2c273f32 MAL |
1235 | qemu_version = custom_target('qemu-version.h', |
1236 | output: 'qemu-version.h', | |
1237 | command: qemu_version_cmd, | |
1238 | capture: true, | |
1239 | build_by_default: true, | |
1240 | build_always_stale: true) | |
1241 | genh += qemu_version | |
1242 | ||
3f885659 MAL |
1243 | hxdep = [] |
1244 | hx_headers = [ | |
1245 | ['qemu-options.hx', 'qemu-options.def'], | |
1246 | ['qemu-img-cmds.hx', 'qemu-img-cmds.h'], | |
1247 | ] | |
1248 | if have_system | |
1249 | hx_headers += [ | |
1250 | ['hmp-commands.hx', 'hmp-commands.h'], | |
1251 | ['hmp-commands-info.hx', 'hmp-commands-info.h'], | |
1252 | ] | |
1253 | endif | |
1254 | foreach d : hx_headers | |
b7c70bf2 | 1255 | hxdep += custom_target(d[1], |
3f885659 MAL |
1256 | input: files(d[0]), |
1257 | output: d[1], | |
1258 | capture: true, | |
1259 | build_by_default: true, # to be removed when added to a target | |
1260 | command: [hxtool, '-h', '@INPUT0@']) | |
1261 | endforeach | |
1262 | genh += hxdep | |
1263 | ||
eb937365 PM |
1264 | SPHINX_ARGS = [config_host['SPHINX_BUILD'], |
1265 | '-Dversion=' + meson.project_version(), | |
1266 | '-Drelease=' + config_host['PKGVERSION']] | |
1267 | ||
1268 | if get_option('werror') | |
1269 | SPHINX_ARGS += [ '-W' ] | |
1270 | endif | |
1271 | ||
b3f4830a PM |
1272 | sphinx_extn_depends = [ meson.source_root() / 'docs/sphinx/depfile.py', |
1273 | meson.source_root() / 'docs/sphinx/hxtool.py', | |
1274 | meson.source_root() / 'docs/sphinx/kerneldoc.py', | |
1275 | meson.source_root() / 'docs/sphinx/kernellog.py', | |
1276 | meson.source_root() / 'docs/sphinx/qapidoc.py', | |
1277 | meson.source_root() / 'docs/sphinx/qmp_lexer.py', | |
1278 | qapi_gen_depends ] | |
1279 | ||
a0c9162c PB |
1280 | ################### |
1281 | # Collect sources # | |
1282 | ################### | |
a81df1b6 | 1283 | |
55567891 | 1284 | authz_ss = ss.source_set() |
4a96337d | 1285 | blockdev_ss = ss.source_set() |
7e2b888f | 1286 | block_ss = ss.source_set() |
2becc36a | 1287 | bsd_user_ss = ss.source_set() |
c2306d71 | 1288 | chardev_ss = ss.source_set() |
7e2b888f | 1289 | common_ss = ss.source_set() |
2389304a | 1290 | crypto_ss = ss.source_set() |
f78536b1 | 1291 | io_ss = ss.source_set() |
2becc36a | 1292 | linux_user_ss = ss.source_set() |
7e2b888f | 1293 | qmp_ss = ss.source_set() |
da33fc09 | 1294 | qom_ss = ss.source_set() |
7e2b888f | 1295 | softmmu_ss = ss.source_set() |
64ed6f92 | 1296 | specific_fuzz_ss = ss.source_set() |
7e2b888f PMD |
1297 | specific_ss = ss.source_set() |
1298 | stub_ss = ss.source_set() | |
1299 | trace_ss = ss.source_set() | |
1300 | user_ss = ss.source_set() | |
1301 | util_ss = ss.source_set() | |
2becc36a | 1302 | |
3154fee4 | 1303 | modules = {} |
2becc36a PB |
1304 | hw_arch = {} |
1305 | target_arch = {} | |
1306 | target_softmmu_arch = {} | |
a81df1b6 PB |
1307 | |
1308 | ############### | |
1309 | # Trace files # | |
1310 | ############### | |
1311 | ||
c9322ab5 MAL |
1312 | # TODO: add each directory to the subdirs from its own meson.build, once |
1313 | # we have those | |
a81df1b6 PB |
1314 | trace_events_subdirs = [ |
1315 | 'accel/kvm', | |
1316 | 'accel/tcg', | |
1317 | 'crypto', | |
1318 | 'monitor', | |
1319 | ] | |
1320 | if have_user | |
1321 | trace_events_subdirs += [ 'linux-user' ] | |
1322 | endif | |
1323 | if have_block | |
1324 | trace_events_subdirs += [ | |
1325 | 'authz', | |
1326 | 'block', | |
1327 | 'io', | |
1328 | 'nbd', | |
1329 | 'scsi', | |
1330 | ] | |
1331 | endif | |
1332 | if have_system | |
1333 | trace_events_subdirs += [ | |
1334 | 'audio', | |
1335 | 'backends', | |
1336 | 'backends/tpm', | |
1337 | 'chardev', | |
1338 | 'hw/9pfs', | |
1339 | 'hw/acpi', | |
1340 | 'hw/alpha', | |
1341 | 'hw/arm', | |
1342 | 'hw/audio', | |
1343 | 'hw/block', | |
1344 | 'hw/block/dataplane', | |
1345 | 'hw/char', | |
1346 | 'hw/display', | |
1347 | 'hw/dma', | |
1348 | 'hw/hppa', | |
1349 | 'hw/hyperv', | |
1350 | 'hw/i2c', | |
1351 | 'hw/i386', | |
1352 | 'hw/i386/xen', | |
1353 | 'hw/ide', | |
1354 | 'hw/input', | |
1355 | 'hw/intc', | |
1356 | 'hw/isa', | |
1357 | 'hw/mem', | |
1358 | 'hw/mips', | |
1359 | 'hw/misc', | |
1360 | 'hw/misc/macio', | |
1361 | 'hw/net', | |
1362 | 'hw/nvram', | |
1363 | 'hw/pci', | |
1364 | 'hw/pci-host', | |
1365 | 'hw/ppc', | |
1366 | 'hw/rdma', | |
1367 | 'hw/rdma/vmw', | |
1368 | 'hw/rtc', | |
1369 | 'hw/s390x', | |
1370 | 'hw/scsi', | |
1371 | 'hw/sd', | |
1372 | 'hw/sparc', | |
1373 | 'hw/sparc64', | |
1374 | 'hw/ssi', | |
1375 | 'hw/timer', | |
1376 | 'hw/tpm', | |
1377 | 'hw/usb', | |
1378 | 'hw/vfio', | |
1379 | 'hw/virtio', | |
1380 | 'hw/watchdog', | |
1381 | 'hw/xen', | |
1382 | 'hw/gpio', | |
a81df1b6 PB |
1383 | 'migration', |
1384 | 'net', | |
8b7a5507 | 1385 | 'softmmu', |
a81df1b6 PB |
1386 | 'ui', |
1387 | ] | |
1388 | endif | |
1389 | trace_events_subdirs += [ | |
1390 | 'hw/core', | |
1391 | 'qapi', | |
1392 | 'qom', | |
1393 | 'target/arm', | |
1394 | 'target/hppa', | |
1395 | 'target/i386', | |
1396 | 'target/mips', | |
1397 | 'target/ppc', | |
1398 | 'target/riscv', | |
1399 | 'target/s390x', | |
1400 | 'target/sparc', | |
1401 | 'util', | |
1402 | ] | |
1403 | ||
a81df1b6 PB |
1404 | subdir('qapi') |
1405 | subdir('qobject') | |
1406 | subdir('stubs') | |
1407 | subdir('trace') | |
1408 | subdir('util') | |
5582c58f MAL |
1409 | subdir('qom') |
1410 | subdir('authz') | |
a81df1b6 | 1411 | subdir('crypto') |
2d78b56e | 1412 | subdir('ui') |
a81df1b6 | 1413 | |
3154fee4 MAL |
1414 | |
1415 | if enable_modules | |
1416 | libmodulecommon = static_library('module-common', files('module-common.c') + genh, pic: true, c_args: '-DBUILD_DSO') | |
1417 | modulecommon = declare_dependency(link_whole: libmodulecommon, compile_args: '-DBUILD_DSO') | |
1418 | endif | |
1419 | ||
2becc36a | 1420 | stub_ss = stub_ss.apply(config_all, strict: false) |
a81df1b6 PB |
1421 | |
1422 | util_ss.add_all(trace_ss) | |
2becc36a | 1423 | util_ss = util_ss.apply(config_all, strict: false) |
a81df1b6 PB |
1424 | libqemuutil = static_library('qemuutil', |
1425 | sources: util_ss.sources() + stub_ss.sources() + genh, | |
aa087962 | 1426 | dependencies: [util_ss.dependencies(), m, glib, socket, malloc]) |
a81df1b6 | 1427 | qemuutil = declare_dependency(link_with: libqemuutil, |
04c6f1e7 | 1428 | sources: genh + version_res) |
a81df1b6 | 1429 | |
abff1abf PB |
1430 | decodetree = generator(find_program('scripts/decodetree.py'), |
1431 | output: 'decode-@BASENAME@.c.inc', | |
1432 | arguments: ['@INPUT@', '@EXTRA_ARGS@', '-o', '@OUTPUT@']) | |
1433 | ||
478e943f | 1434 | subdir('audio') |
7fcfd456 | 1435 | subdir('io') |
848e8ff6 | 1436 | subdir('chardev') |
ec0d5893 | 1437 | subdir('fsdev') |
abff1abf | 1438 | subdir('libdecnumber') |
d3b18480 | 1439 | subdir('target') |
708eab42 | 1440 | subdir('dump') |
ec0d5893 | 1441 | |
5e5733e5 MAL |
1442 | block_ss.add(files( |
1443 | 'block.c', | |
56ee8626 | 1444 | 'blockdev-nbd.c', |
5e5733e5 MAL |
1445 | 'blockjob.c', |
1446 | 'job.c', | |
1447 | 'qemu-io-cmds.c', | |
1448 | )) | |
1449 | block_ss.add(when: 'CONFIG_REPLICATION', if_true: files('replication.c')) | |
1450 | ||
1451 | subdir('nbd') | |
1452 | subdir('scsi') | |
1453 | subdir('block') | |
1454 | ||
4a96337d PB |
1455 | blockdev_ss.add(files( |
1456 | 'blockdev.c', | |
4a96337d PB |
1457 | 'iothread.c', |
1458 | 'job-qmp.c', | |
1459 | )) | |
1460 | ||
1461 | # os-posix.c contains POSIX-specific functions used by qemu-storage-daemon, | |
1462 | # os-win32.c does not | |
1463 | blockdev_ss.add(when: 'CONFIG_POSIX', if_true: files('os-posix.c')) | |
1464 | softmmu_ss.add(when: 'CONFIG_WIN32', if_true: [files('os-win32.c')]) | |
4a96337d | 1465 | softmmu_ss.add_all(blockdev_ss) |
4a96337d PB |
1466 | |
1467 | common_ss.add(files('cpus-common.c')) | |
1468 | ||
5d3ea0e1 | 1469 | subdir('softmmu') |
c9322ab5 | 1470 | |
f343346b | 1471 | common_ss.add(capstone) |
d9f24bf5 | 1472 | specific_ss.add(files('cpu.c', 'disas.c', 'gdbstub.c'), capstone) |
c9322ab5 MAL |
1473 | specific_ss.add(files('exec-vary.c')) |
1474 | specific_ss.add(when: 'CONFIG_TCG', if_true: files( | |
1475 | 'fpu/softfloat.c', | |
1476 | 'tcg/optimize.c', | |
1477 | 'tcg/tcg-common.c', | |
1478 | 'tcg/tcg-op-gvec.c', | |
1479 | 'tcg/tcg-op-vec.c', | |
1480 | 'tcg/tcg-op.c', | |
1481 | 'tcg/tcg.c', | |
1482 | )) | |
1483 | specific_ss.add(when: 'CONFIG_TCG_INTERPRETER', if_true: files('disas/tci.c', 'tcg/tci.c')) | |
1484 | ||
ab318051 | 1485 | subdir('backends') |
c574e161 | 1486 | subdir('disas') |
55166230 | 1487 | subdir('migration') |
ff219dca | 1488 | subdir('monitor') |
cdaf0722 | 1489 | subdir('net') |
17ef2af6 | 1490 | subdir('replay') |
582ea95f | 1491 | subdir('hw') |
1a82878a | 1492 | subdir('accel') |
f556b4a1 | 1493 | subdir('plugins') |
b309c321 | 1494 | subdir('bsd-user') |
3a30446a MAL |
1495 | subdir('linux-user') |
1496 | ||
b309c321 MAL |
1497 | bsd_user_ss.add(files('gdbstub.c')) |
1498 | specific_ss.add_all(when: 'CONFIG_BSD_USER', if_true: bsd_user_ss) | |
1499 | ||
3a30446a MAL |
1500 | linux_user_ss.add(files('gdbstub.c', 'thunk.c')) |
1501 | specific_ss.add_all(when: 'CONFIG_LINUX_USER', if_true: linux_user_ss) | |
5d3ea0e1 | 1502 | |
a2ce7dbd PB |
1503 | # needed for fuzzing binaries |
1504 | subdir('tests/qtest/libqos') | |
64ed6f92 | 1505 | subdir('tests/qtest/fuzz') |
a2ce7dbd | 1506 | |
a0c9162c PB |
1507 | ######################## |
1508 | # Library dependencies # | |
1509 | ######################## | |
1510 | ||
3154fee4 MAL |
1511 | block_mods = [] |
1512 | softmmu_mods = [] | |
1513 | foreach d, list : modules | |
1514 | foreach m, module_ss : list | |
1515 | if enable_modules and targetos != 'windows' | |
3e292c51 | 1516 | module_ss = module_ss.apply(config_all, strict: false) |
3154fee4 MAL |
1517 | sl = static_library(d + '-' + m, [genh, module_ss.sources()], |
1518 | dependencies: [modulecommon, module_ss.dependencies()], pic: true) | |
1519 | if d == 'block' | |
1520 | block_mods += sl | |
1521 | else | |
1522 | softmmu_mods += sl | |
1523 | endif | |
1524 | else | |
1525 | if d == 'block' | |
1526 | block_ss.add_all(module_ss) | |
1527 | else | |
1528 | softmmu_ss.add_all(module_ss) | |
1529 | endif | |
1530 | endif | |
1531 | endforeach | |
1532 | endforeach | |
1533 | ||
1534 | nm = find_program('nm') | |
604f3e4e | 1535 | undefsym = find_program('scripts/undefsym.py') |
3154fee4 MAL |
1536 | block_syms = custom_target('block.syms', output: 'block.syms', |
1537 | input: [libqemuutil, block_mods], | |
1538 | capture: true, | |
1539 | command: [undefsym, nm, '@INPUT@']) | |
1540 | qemu_syms = custom_target('qemu.syms', output: 'qemu.syms', | |
1541 | input: [libqemuutil, softmmu_mods], | |
1542 | capture: true, | |
1543 | command: [undefsym, nm, '@INPUT@']) | |
1544 | ||
da33fc09 PMD |
1545 | qom_ss = qom_ss.apply(config_host, strict: false) |
1546 | libqom = static_library('qom', qom_ss.sources() + genh, | |
1547 | dependencies: [qom_ss.dependencies()], | |
1548 | name_suffix: 'fa') | |
1549 | ||
1550 | qom = declare_dependency(link_whole: libqom) | |
1551 | ||
55567891 PMD |
1552 | authz_ss = authz_ss.apply(config_host, strict: false) |
1553 | libauthz = static_library('authz', authz_ss.sources() + genh, | |
1554 | dependencies: [authz_ss.dependencies()], | |
1555 | name_suffix: 'fa', | |
1556 | build_by_default: false) | |
1557 | ||
1558 | authz = declare_dependency(link_whole: libauthz, | |
1559 | dependencies: qom) | |
1560 | ||
2389304a PMD |
1561 | crypto_ss = crypto_ss.apply(config_host, strict: false) |
1562 | libcrypto = static_library('crypto', crypto_ss.sources() + genh, | |
1563 | dependencies: [crypto_ss.dependencies()], | |
1564 | name_suffix: 'fa', | |
1565 | build_by_default: false) | |
1566 | ||
1567 | crypto = declare_dependency(link_whole: libcrypto, | |
1568 | dependencies: [authz, qom]) | |
1569 | ||
f78536b1 PMD |
1570 | io_ss = io_ss.apply(config_host, strict: false) |
1571 | libio = static_library('io', io_ss.sources() + genh, | |
1572 | dependencies: [io_ss.dependencies()], | |
1573 | link_with: libqemuutil, | |
1574 | name_suffix: 'fa', | |
1575 | build_by_default: false) | |
1576 | ||
1577 | io = declare_dependency(link_whole: libio, dependencies: [crypto, qom]) | |
1578 | ||
7e6edef3 PMD |
1579 | libmigration = static_library('migration', sources: migration_files + genh, |
1580 | name_suffix: 'fa', | |
1581 | build_by_default: false) | |
1582 | migration = declare_dependency(link_with: libmigration, | |
1583 | dependencies: [zlib, qom, io]) | |
1584 | softmmu_ss.add(migration) | |
1585 | ||
5e5733e5 MAL |
1586 | block_ss = block_ss.apply(config_host, strict: false) |
1587 | libblock = static_library('block', block_ss.sources() + genh, | |
1588 | dependencies: block_ss.dependencies(), | |
1589 | link_depends: block_syms, | |
1590 | name_suffix: 'fa', | |
1591 | build_by_default: false) | |
1592 | ||
1593 | block = declare_dependency(link_whole: [libblock], | |
b7c70bf2 MAL |
1594 | link_args: '@block.syms', |
1595 | dependencies: [crypto, io]) | |
5e5733e5 | 1596 | |
ff219dca PB |
1597 | qmp_ss = qmp_ss.apply(config_host, strict: false) |
1598 | libqmp = static_library('qmp', qmp_ss.sources() + genh, | |
1599 | dependencies: qmp_ss.dependencies(), | |
1600 | name_suffix: 'fa', | |
1601 | build_by_default: false) | |
1602 | ||
1603 | qmp = declare_dependency(link_whole: [libqmp]) | |
1604 | ||
c2306d71 PMD |
1605 | libchardev = static_library('chardev', chardev_ss.sources() + genh, |
1606 | name_suffix: 'fa', | |
1607 | build_by_default: false) | |
1608 | ||
1609 | chardev = declare_dependency(link_whole: libchardev) | |
1610 | ||
e28ab096 PMD |
1611 | libhwcore = static_library('hwcore', sources: hwcore_files + genh, |
1612 | name_suffix: 'fa', | |
1613 | build_by_default: false) | |
1614 | hwcore = declare_dependency(link_whole: libhwcore) | |
1615 | common_ss.add(hwcore) | |
1616 | ||
064f8ee7 PMD |
1617 | ########### |
1618 | # Targets # | |
1619 | ########### | |
1620 | ||
3154fee4 MAL |
1621 | foreach m : block_mods + softmmu_mods |
1622 | shared_module(m.name(), | |
1623 | name_prefix: '', | |
1624 | link_whole: m, | |
1625 | install: true, | |
1626 | install_dir: config_host['qemu_moddir']) | |
1627 | endforeach | |
1628 | ||
64ed6f92 PB |
1629 | softmmu_ss.add(authz, block, chardev, crypto, io, qmp) |
1630 | common_ss.add(qom, qemuutil) | |
1631 | ||
1632 | common_ss.add_all(when: 'CONFIG_SOFTMMU', if_true: [softmmu_ss]) | |
2becc36a PB |
1633 | common_ss.add_all(when: 'CONFIG_USER_ONLY', if_true: user_ss) |
1634 | ||
1635 | common_all = common_ss.apply(config_all, strict: false) | |
1636 | common_all = static_library('common', | |
1637 | build_by_default: false, | |
1638 | sources: common_all.sources() + genh, | |
1639 | dependencies: common_all.dependencies(), | |
1640 | name_suffix: 'fa') | |
1641 | ||
c9322ab5 MAL |
1642 | feature_to_c = find_program('scripts/feature_to_c.sh') |
1643 | ||
fd5eef85 | 1644 | emulators = {} |
2becc36a PB |
1645 | foreach target : target_dirs |
1646 | config_target = config_target_mak[target] | |
1647 | target_name = config_target['TARGET_NAME'] | |
1648 | arch = config_target['TARGET_BASE_ARCH'] | |
859aef02 | 1649 | arch_srcs = [config_target_h[target]] |
64ed6f92 PB |
1650 | arch_deps = [] |
1651 | c_args = ['-DNEED_CPU_H', | |
1652 | '-DCONFIG_TARGET="@0@-config-target.h"'.format(target), | |
1653 | '-DCONFIG_DEVICES="@0@-config-devices.h"'.format(target)] | |
b6c7cfd4 | 1654 | link_args = emulator_link_args |
2becc36a | 1655 | |
859aef02 | 1656 | config_target += config_host |
2becc36a PB |
1657 | target_inc = [include_directories('target' / config_target['TARGET_BASE_ARCH'])] |
1658 | if targetos == 'linux' | |
1659 | target_inc += include_directories('linux-headers', is_system: true) | |
1660 | endif | |
1661 | if target.endswith('-softmmu') | |
1662 | qemu_target_name = 'qemu-system-' + target_name | |
1663 | target_type='system' | |
abff1abf PB |
1664 | t = target_softmmu_arch[arch].apply(config_target, strict: false) |
1665 | arch_srcs += t.sources() | |
64ed6f92 | 1666 | arch_deps += t.dependencies() |
abff1abf | 1667 | |
2c44220d MAL |
1668 | hw_dir = target_name == 'sparc64' ? 'sparc64' : arch |
1669 | hw = hw_arch[hw_dir].apply(config_target, strict: false) | |
1670 | arch_srcs += hw.sources() | |
64ed6f92 | 1671 | arch_deps += hw.dependencies() |
2c44220d | 1672 | |
2becc36a | 1673 | arch_srcs += config_devices_h[target] |
64ed6f92 | 1674 | link_args += ['@block.syms', '@qemu.syms'] |
2becc36a | 1675 | else |
3a30446a | 1676 | abi = config_target['TARGET_ABI_DIR'] |
2becc36a PB |
1677 | target_type='user' |
1678 | qemu_target_name = 'qemu-' + target_name | |
1679 | if 'CONFIG_LINUX_USER' in config_target | |
1680 | base_dir = 'linux-user' | |
1681 | target_inc += include_directories('linux-user/host/' / config_host['ARCH']) | |
1682 | else | |
1683 | base_dir = 'bsd-user' | |
1684 | endif | |
1685 | target_inc += include_directories( | |
1686 | base_dir, | |
3a30446a | 1687 | base_dir / abi, |
2becc36a | 1688 | ) |
3a30446a MAL |
1689 | if 'CONFIG_LINUX_USER' in config_target |
1690 | dir = base_dir / abi | |
1691 | arch_srcs += files(dir / 'signal.c', dir / 'cpu_loop.c') | |
1692 | if config_target.has_key('TARGET_SYSTBL_ABI') | |
1693 | arch_srcs += \ | |
1694 | syscall_nr_generators[abi].process(base_dir / abi / config_target['TARGET_SYSTBL'], | |
1695 | extra_args : config_target['TARGET_SYSTBL_ABI']) | |
1696 | endif | |
1697 | endif | |
2becc36a PB |
1698 | endif |
1699 | ||
c9322ab5 MAL |
1700 | if 'TARGET_XML_FILES' in config_target |
1701 | gdbstub_xml = custom_target(target + '-gdbstub-xml.c', | |
1702 | output: target + '-gdbstub-xml.c', | |
1703 | input: files(config_target['TARGET_XML_FILES'].split()), | |
1704 | command: [feature_to_c, '@INPUT@'], | |
1705 | capture: true) | |
1706 | arch_srcs += gdbstub_xml | |
1707 | endif | |
1708 | ||
abff1abf PB |
1709 | t = target_arch[arch].apply(config_target, strict: false) |
1710 | arch_srcs += t.sources() | |
64ed6f92 | 1711 | arch_deps += t.dependencies() |
abff1abf | 1712 | |
2becc36a PB |
1713 | target_common = common_ss.apply(config_target, strict: false) |
1714 | objects = common_all.extract_objects(target_common.sources()) | |
64ed6f92 | 1715 | deps = target_common.dependencies() |
2becc36a | 1716 | |
2becc36a PB |
1717 | target_specific = specific_ss.apply(config_target, strict: false) |
1718 | arch_srcs += target_specific.sources() | |
64ed6f92 | 1719 | arch_deps += target_specific.dependencies() |
2becc36a | 1720 | |
64ed6f92 | 1721 | lib = static_library('qemu-' + target, |
859aef02 | 1722 | sources: arch_srcs + genh, |
b7612f45 | 1723 | dependencies: arch_deps, |
2becc36a PB |
1724 | objects: objects, |
1725 | include_directories: target_inc, | |
64ed6f92 PB |
1726 | c_args: c_args, |
1727 | build_by_default: false, | |
2becc36a | 1728 | name_suffix: 'fa') |
64ed6f92 PB |
1729 | |
1730 | if target.endswith('-softmmu') | |
1731 | execs = [{ | |
1732 | 'name': 'qemu-system-' + target_name, | |
1733 | 'gui': false, | |
1734 | 'sources': files('softmmu/main.c'), | |
1735 | 'dependencies': [] | |
1736 | }] | |
35be72ba | 1737 | if targetos == 'windows' and (sdl.found() or gtk.found()) |
64ed6f92 PB |
1738 | execs += [{ |
1739 | 'name': 'qemu-system-' + target_name + 'w', | |
1740 | 'gui': true, | |
1741 | 'sources': files('softmmu/main.c'), | |
1742 | 'dependencies': [] | |
1743 | }] | |
1744 | endif | |
1745 | if config_host.has_key('CONFIG_FUZZ') | |
1746 | specific_fuzz = specific_fuzz_ss.apply(config_target, strict: false) | |
1747 | execs += [{ | |
1748 | 'name': 'qemu-fuzz-' + target_name, | |
1749 | 'gui': false, | |
1750 | 'sources': specific_fuzz.sources(), | |
1751 | 'dependencies': specific_fuzz.dependencies(), | |
64ed6f92 PB |
1752 | }] |
1753 | endif | |
1754 | else | |
1755 | execs = [{ | |
1756 | 'name': 'qemu-' + target_name, | |
1757 | 'gui': false, | |
1758 | 'sources': [], | |
1759 | 'dependencies': [] | |
1760 | }] | |
1761 | endif | |
1762 | foreach exe: execs | |
fd5eef85 PB |
1763 | emulators += {exe['name']: |
1764 | executable(exe['name'], exe['sources'], | |
64ed6f92 PB |
1765 | install: true, |
1766 | c_args: c_args, | |
1767 | dependencies: arch_deps + deps + exe['dependencies'], | |
1768 | objects: lib.extract_all_objects(recursive: true), | |
1769 | link_language: link_language, | |
1770 | link_depends: [block_syms, qemu_syms] + exe.get('link_depends', []), | |
1771 | link_args: link_args, | |
1772 | gui_app: exe['gui']) | |
fd5eef85 | 1773 | } |
10e1d263 MAL |
1774 | |
1775 | if 'CONFIG_TRACE_SYSTEMTAP' in config_host | |
1776 | foreach stp: [ | |
bd5f973a SH |
1777 | {'ext': '.stp-build', 'fmt': 'stap', 'bin': meson.current_build_dir() / exe['name'], 'install': false}, |
1778 | {'ext': '.stp', 'fmt': 'stap', 'bin': get_option('prefix') / get_option('bindir') / exe['name'], 'install': true}, | |
10e1d263 MAL |
1779 | {'ext': '-simpletrace.stp', 'fmt': 'simpletrace-stap', 'bin': '', 'install': true}, |
1780 | {'ext': '-log.stp', 'fmt': 'log-stap', 'bin': '', 'install': true}, | |
1781 | ] | |
bd5f973a | 1782 | custom_target(exe['name'] + stp['ext'], |
10e1d263 | 1783 | input: trace_events_all, |
bd5f973a | 1784 | output: exe['name'] + stp['ext'], |
10e1d263 MAL |
1785 | capture: true, |
1786 | install: stp['install'], | |
ab4c0996 | 1787 | install_dir: qemu_datadir / '../systemtap/tapset', |
10e1d263 MAL |
1788 | command: [ |
1789 | tracetool, '--group=all', '--format=' + stp['fmt'], | |
1790 | '--binary=' + stp['bin'], | |
1791 | '--target-name=' + target_name, | |
1792 | '--target-type=' + target_type, | |
1793 | '--probe-prefix=qemu.' + target_type + '.' + target_name, | |
1794 | '@INPUT@', | |
1795 | ]) | |
1796 | endforeach | |
1797 | endif | |
64ed6f92 | 1798 | endforeach |
2becc36a PB |
1799 | endforeach |
1800 | ||
931049b4 | 1801 | # Other build targets |
897b5afa | 1802 | |
f556b4a1 PB |
1803 | if 'CONFIG_PLUGIN' in config_host |
1804 | install_headers('include/qemu/qemu-plugin.h') | |
1805 | endif | |
1806 | ||
f15bff25 PB |
1807 | if 'CONFIG_GUEST_AGENT' in config_host |
1808 | subdir('qga') | |
1809 | endif | |
1810 | ||
9755c94a LV |
1811 | # Don't build qemu-keymap if xkbcommon is not explicitly enabled |
1812 | # when we don't build tools or system | |
4113f4cf | 1813 | if xkbcommon.found() |
28742467 MAL |
1814 | # used for the update-keymaps target, so include rules even if !have_tools |
1815 | qemu_keymap = executable('qemu-keymap', files('qemu-keymap.c', 'ui/input-keymap.c') + genh, | |
1816 | dependencies: [qemuutil, xkbcommon], install: have_tools) | |
1817 | endif | |
1818 | ||
931049b4 | 1819 | if have_tools |
b7c70bf2 MAL |
1820 | qemu_img = executable('qemu-img', [files('qemu-img.c'), hxdep], |
1821 | dependencies: [authz, block, crypto, io, qom, qemuutil], install: true) | |
1822 | qemu_io = executable('qemu-io', files('qemu-io.c'), | |
1823 | dependencies: [block, qemuutil], install: true) | |
eb705985 | 1824 | qemu_nbd = executable('qemu-nbd', files('qemu-nbd.c'), |
b7c70bf2 | 1825 | dependencies: [block, qemuutil], install: true) |
b7c70bf2 | 1826 | |
7c58bb76 | 1827 | subdir('storage-daemon') |
a9c9727c | 1828 | subdir('contrib/rdmacm-mux') |
1d7bb6ab | 1829 | subdir('contrib/elf2dmp') |
a9c9727c | 1830 | |
157e7b13 MAL |
1831 | executable('qemu-edid', files('qemu-edid.c', 'hw/display/edid-generate.c'), |
1832 | dependencies: qemuutil, | |
1833 | install: true) | |
1834 | ||
931049b4 PB |
1835 | if 'CONFIG_VHOST_USER' in config_host |
1836 | subdir('contrib/libvhost-user') | |
2d7ac0af | 1837 | subdir('contrib/vhost-user-blk') |
b7612f45 | 1838 | subdir('contrib/vhost-user-gpu') |
32fcc624 | 1839 | subdir('contrib/vhost-user-input') |
99650b62 | 1840 | subdir('contrib/vhost-user-scsi') |
931049b4 | 1841 | endif |
8f51e01c MAL |
1842 | |
1843 | if targetos == 'linux' | |
1844 | executable('qemu-bridge-helper', files('qemu-bridge-helper.c'), | |
1845 | dependencies: [qemuutil, libcap_ng], | |
1846 | install: true, | |
1847 | install_dir: get_option('libexecdir')) | |
897b5afa MAL |
1848 | |
1849 | executable('qemu-pr-helper', files('scsi/qemu-pr-helper.c', 'scsi/utils.c'), | |
1850 | dependencies: [authz, crypto, io, qom, qemuutil, | |
6ec0e15d | 1851 | libcap_ng, mpathpersist], |
897b5afa | 1852 | install: true) |
8f51e01c MAL |
1853 | endif |
1854 | ||
5ee24e78 MAL |
1855 | if 'CONFIG_IVSHMEM' in config_host |
1856 | subdir('contrib/ivshmem-client') | |
1857 | subdir('contrib/ivshmem-server') | |
1858 | endif | |
931049b4 PB |
1859 | endif |
1860 | ||
f5aa6320 | 1861 | subdir('scripts') |
3f99cf57 | 1862 | subdir('tools') |
bdcbea7a | 1863 | subdir('pc-bios') |
ce1c1e7a | 1864 | subdir('tests') |
f8aa24ea | 1865 | subdir('docs') |
e8f3bd71 MAL |
1866 | if 'CONFIG_GTK' in config_host |
1867 | subdir('po') | |
1868 | endif | |
3f99cf57 | 1869 | |
8adfeba9 MAL |
1870 | if host_machine.system() == 'windows' |
1871 | nsis_cmd = [ | |
1872 | find_program('scripts/nsis.py'), | |
1873 | '@OUTPUT@', | |
1874 | get_option('prefix'), | |
1875 | meson.current_source_dir(), | |
1876 | host_machine.cpu_family(), | |
1877 | '--', | |
1878 | '-DDISPLAYVERSION=' + meson.project_version(), | |
1879 | ] | |
1880 | if build_docs | |
1881 | nsis_cmd += '-DCONFIG_DOCUMENTATION=y' | |
1882 | endif | |
1883 | if 'CONFIG_GTK' in config_host | |
1884 | nsis_cmd += '-DCONFIG_GTK=y' | |
1885 | endif | |
1886 | ||
1887 | nsis = custom_target('nsis', | |
1888 | output: 'qemu-setup-' + meson.project_version() + '.exe', | |
1889 | input: files('qemu.nsi'), | |
1890 | build_always_stale: true, | |
1891 | command: nsis_cmd + ['@INPUT@']) | |
1892 | alias_target('installer', nsis) | |
1893 | endif | |
1894 | ||
a0c9162c PB |
1895 | ######################### |
1896 | # Configuration summary # | |
1897 | ######################### | |
1898 | ||
f9332757 PB |
1899 | summary_info = {} |
1900 | summary_info += {'Install prefix': config_host['prefix']} | |
1901 | summary_info += {'BIOS directory': config_host['qemu_datadir']} | |
1902 | summary_info += {'firmware path': config_host['qemu_firmwarepath']} | |
1903 | summary_info += {'binary directory': config_host['bindir']} | |
1904 | summary_info += {'library directory': config_host['libdir']} | |
1905 | summary_info += {'module directory': config_host['qemu_moddir']} | |
1906 | summary_info += {'libexec directory': config_host['libexecdir']} | |
1907 | summary_info += {'include directory': config_host['includedir']} | |
1908 | summary_info += {'config directory': config_host['sysconfdir']} | |
1909 | if targetos != 'windows' | |
1910 | summary_info += {'local state directory': config_host['qemu_localstatedir']} | |
b81efab7 | 1911 | summary_info += {'Manual directory': get_option('mandir')} |
f9332757 PB |
1912 | else |
1913 | summary_info += {'local state directory': 'queried at runtime'} | |
1914 | endif | |
491e74c1 | 1915 | summary_info += {'Doc directory': get_option('docdir')} |
f9332757 PB |
1916 | summary_info += {'Build directory': meson.current_build_dir()} |
1917 | summary_info += {'Source path': meson.current_source_dir()} | |
1918 | summary_info += {'GIT binary': config_host['GIT']} | |
1919 | summary_info += {'GIT submodules': config_host['GIT_SUBMODULES']} | |
1920 | summary_info += {'C compiler': meson.get_compiler('c').cmd_array()[0]} | |
1921 | summary_info += {'Host C compiler': meson.get_compiler('c', native: true).cmd_array()[0]} | |
1922 | if link_language == 'cpp' | |
1923 | summary_info += {'C++ compiler': meson.get_compiler('cpp').cmd_array()[0]} | |
1924 | else | |
1925 | summary_info += {'C++ compiler': false} | |
1926 | endif | |
1927 | if targetos == 'darwin' | |
1928 | summary_info += {'Objective-C compiler': meson.get_compiler('objc').cmd_array()[0]} | |
1929 | endif | |
1930 | summary_info += {'ARFLAGS': config_host['ARFLAGS']} | |
47b30835 PB |
1931 | summary_info += {'CFLAGS': ' '.join(get_option('c_args') |
1932 | + ['-O' + get_option('optimization')] | |
1933 | + (get_option('debug') ? ['-g'] : []))} | |
1934 | if link_language == 'cpp' | |
1935 | summary_info += {'CXXFLAGS': ' '.join(get_option('cpp_args') | |
1936 | + ['-O' + get_option('optimization')] | |
1937 | + (get_option('debug') ? ['-g'] : []))} | |
1938 | endif | |
1939 | link_args = get_option(link_language + '_link_args') | |
1940 | if link_args.length() > 0 | |
1941 | summary_info += {'LDFLAGS': ' '.join(link_args)} | |
1942 | endif | |
f9332757 PB |
1943 | summary_info += {'QEMU_CFLAGS': config_host['QEMU_CFLAGS']} |
1944 | summary_info += {'QEMU_LDFLAGS': config_host['QEMU_LDFLAGS']} | |
1945 | summary_info += {'make': config_host['MAKE']} | |
f9332757 PB |
1946 | summary_info += {'python': '@0@ (version: @1@)'.format(python.full_path(), python.language_version())} |
1947 | summary_info += {'sphinx-build': config_host['SPHINX_BUILD']} | |
1948 | summary_info += {'genisoimage': config_host['GENISOIMAGE']} | |
1949 | # TODO: add back version | |
4d34a86b PB |
1950 | summary_info += {'slirp support': slirp_opt == 'disabled' ? false : slirp_opt} |
1951 | if slirp_opt != 'disabled' | |
f9332757 PB |
1952 | summary_info += {'smbd': config_host['CONFIG_SMBD_COMMAND']} |
1953 | endif | |
1954 | summary_info += {'module support': config_host.has_key('CONFIG_MODULES')} | |
1955 | if config_host.has_key('CONFIG_MODULES') | |
1956 | summary_info += {'alternative module path': config_host.has_key('CONFIG_MODULE_UPGRADES')} | |
1957 | endif | |
1958 | summary_info += {'host CPU': cpu} | |
1959 | summary_info += {'host endianness': build_machine.endian()} | |
fdb75aef | 1960 | summary_info += {'target list': ' '.join(target_dirs)} |
f9332757 | 1961 | summary_info += {'gprof enabled': config_host.has_key('CONFIG_GPROF')} |
deb62371 | 1962 | summary_info += {'sparse enabled': sparse.found()} |
f9332757 PB |
1963 | summary_info += {'strip binaries': get_option('strip')} |
1964 | summary_info += {'profiler': config_host.has_key('CONFIG_PROFILER')} | |
3e8529dd | 1965 | summary_info += {'static build': config_host.has_key('CONFIG_STATIC')} |
f9332757 PB |
1966 | if targetos == 'darwin' |
1967 | summary_info += {'Cocoa support': config_host.has_key('CONFIG_COCOA')} | |
1968 | endif | |
1969 | # TODO: add back version | |
35be72ba PB |
1970 | summary_info += {'SDL support': sdl.found()} |
1971 | summary_info += {'SDL image support': sdl_image.found()} | |
f9332757 PB |
1972 | # TODO: add back version |
1973 | summary_info += {'GTK support': config_host.has_key('CONFIG_GTK')} | |
1974 | summary_info += {'GTK GL support': config_host.has_key('CONFIG_GTK_GL')} | |
b7612f45 | 1975 | summary_info += {'pixman': pixman.found()} |
f9332757 PB |
1976 | # TODO: add back version |
1977 | summary_info += {'VTE support': config_host.has_key('CONFIG_VTE')} | |
1978 | summary_info += {'TLS priority': config_host['CONFIG_TLS_PRIORITY']} | |
1979 | summary_info += {'GNUTLS support': config_host.has_key('CONFIG_GNUTLS')} | |
1980 | # TODO: add back version | |
1981 | summary_info += {'libgcrypt': config_host.has_key('CONFIG_GCRYPT')} | |
1982 | if config_host.has_key('CONFIG_GCRYPT') | |
1983 | summary_info += {' hmac': config_host.has_key('CONFIG_GCRYPT_HMAC')} | |
1984 | summary_info += {' XTS': not config_host.has_key('CONFIG_QEMU_PRIVATE_XTS')} | |
1985 | endif | |
1986 | # TODO: add back version | |
1987 | summary_info += {'nettle': config_host.has_key('CONFIG_NETTLE')} | |
1988 | if config_host.has_key('CONFIG_NETTLE') | |
1989 | summary_info += {' XTS': not config_host.has_key('CONFIG_QEMU_PRIVATE_XTS')} | |
1990 | endif | |
1991 | summary_info += {'libtasn1': config_host.has_key('CONFIG_TASN1')} | |
1992 | summary_info += {'PAM': config_host.has_key('CONFIG_AUTH_PAM')} | |
5285e593 YL |
1993 | summary_info += {'iconv support': iconv.found()} |
1994 | summary_info += {'curses support': curses.found()} | |
f9332757 PB |
1995 | # TODO: add back version |
1996 | summary_info += {'virgl support': config_host.has_key('CONFIG_VIRGL')} | |
1997 | summary_info += {'curl support': config_host.has_key('CONFIG_CURL')} | |
1998 | summary_info += {'mingw32 support': targetos == 'windows'} | |
1999 | summary_info += {'Audio drivers': config_host['CONFIG_AUDIO_DRIVERS']} | |
2000 | summary_info += {'Block whitelist (rw)': config_host['CONFIG_BDRV_RW_WHITELIST']} | |
2001 | summary_info += {'Block whitelist (ro)': config_host['CONFIG_BDRV_RO_WHITELIST']} | |
2002 | summary_info += {'VirtFS support': config_host.has_key('CONFIG_VIRTFS')} | |
6ec0e15d | 2003 | summary_info += {'Multipath support': mpathpersist.found()} |
a0b93237 PB |
2004 | summary_info += {'VNC support': vnc.found()} |
2005 | if vnc.found() | |
2006 | summary_info += {'VNC SASL support': sasl.found()} | |
2007 | summary_info += {'VNC JPEG support': jpeg.found()} | |
2008 | summary_info += {'VNC PNG support': png.found()} | |
f9332757 PB |
2009 | endif |
2010 | summary_info += {'xen support': config_host.has_key('CONFIG_XEN_BACKEND')} | |
2011 | if config_host.has_key('CONFIG_XEN_BACKEND') | |
2012 | summary_info += {'xen ctrl version': config_host['CONFIG_XEN_CTRL_INTERFACE_VERSION']} | |
2013 | endif | |
2014 | summary_info += {'brlapi support': config_host.has_key('CONFIG_BRLAPI')} | |
2015 | summary_info += {'Documentation': config_host.has_key('BUILD_DOCS')} | |
2016 | summary_info += {'PIE': get_option('b_pie')} | |
2017 | summary_info += {'vde support': config_host.has_key('CONFIG_VDE')} | |
2018 | summary_info += {'netmap support': config_host.has_key('CONFIG_NETMAP')} | |
2019 | summary_info += {'Linux AIO support': config_host.has_key('CONFIG_LINUX_AIO')} | |
2020 | summary_info += {'Linux io_uring support': config_host.has_key('CONFIG_LINUX_IO_URING')} | |
2021 | summary_info += {'ATTR/XATTR support': config_host.has_key('CONFIG_ATTR')} | |
2022 | summary_info += {'Install blobs': config_host.has_key('INSTALL_BLOBS')} | |
05512f55 PB |
2023 | summary_info += {'KVM support': config_all.has_key('CONFIG_KVM')} |
2024 | summary_info += {'HAX support': config_all.has_key('CONFIG_HAX')} | |
2025 | summary_info += {'HVF support': config_all.has_key('CONFIG_HVF')} | |
2026 | summary_info += {'WHPX support': config_all.has_key('CONFIG_WHPX')} | |
2027 | summary_info += {'TCG support': config_all.has_key('CONFIG_TCG')} | |
2028 | if config_all.has_key('CONFIG_TCG') | |
2029 | summary_info += {'TCG debug enabled': config_host.has_key('CONFIG_DEBUG_TCG')} | |
2030 | summary_info += {'TCG interpreter': config_host.has_key('CONFIG_TCG_INTERPRETER')} | |
2031 | endif | |
aa087962 | 2032 | summary_info += {'malloc trim support': has_malloc_trim} |
f9332757 PB |
2033 | summary_info += {'RDMA support': config_host.has_key('CONFIG_RDMA')} |
2034 | summary_info += {'PVRDMA support': config_host.has_key('CONFIG_PVRDMA')} | |
fbb4121d | 2035 | summary_info += {'fdt support': fdt_opt == 'disabled' ? false : fdt_opt} |
f9332757 PB |
2036 | summary_info += {'membarrier': config_host.has_key('CONFIG_MEMBARRIER')} |
2037 | summary_info += {'preadv support': config_host.has_key('CONFIG_PREADV')} | |
2038 | summary_info += {'fdatasync': config_host.has_key('CONFIG_FDATASYNC')} | |
2039 | summary_info += {'madvise': config_host.has_key('CONFIG_MADVISE')} | |
2040 | summary_info += {'posix_madvise': config_host.has_key('CONFIG_POSIX_MADVISE')} | |
2041 | summary_info += {'posix_memalign': config_host.has_key('CONFIG_POSIX_MEMALIGN')} | |
2042 | summary_info += {'libcap-ng support': config_host.has_key('CONFIG_LIBCAP_NG')} | |
2043 | summary_info += {'vhost-net support': config_host.has_key('CONFIG_VHOST_NET')} | |
2044 | summary_info += {'vhost-crypto support': config_host.has_key('CONFIG_VHOST_CRYPTO')} | |
2045 | summary_info += {'vhost-scsi support': config_host.has_key('CONFIG_VHOST_SCSI')} | |
2046 | summary_info += {'vhost-vsock support': config_host.has_key('CONFIG_VHOST_VSOCK')} | |
2047 | summary_info += {'vhost-user support': config_host.has_key('CONFIG_VHOST_KERNEL')} | |
2048 | summary_info += {'vhost-user-fs support': config_host.has_key('CONFIG_VHOST_USER_FS')} | |
2049 | summary_info += {'vhost-vdpa support': config_host.has_key('CONFIG_VHOST_VDPA')} | |
2050 | summary_info += {'Trace backends': config_host['TRACE_BACKENDS']} | |
2051 | if config_host['TRACE_BACKENDS'].split().contains('simple') | |
2052 | summary_info += {'Trace output file': config_host['CONFIG_TRACE_FILE'] + '-<pid>'} | |
2053 | endif | |
2054 | # TODO: add back protocol and server version | |
2055 | summary_info += {'spice support': config_host.has_key('CONFIG_SPICE')} | |
2056 | summary_info += {'rbd support': config_host.has_key('CONFIG_RBD')} | |
2057 | summary_info += {'xfsctl support': config_host.has_key('CONFIG_XFS')} | |
2058 | summary_info += {'smartcard support': config_host.has_key('CONFIG_SMARTCARD')} | |
0a40bcb7 | 2059 | summary_info += {'U2F support': u2f.found()} |
f9332757 PB |
2060 | summary_info += {'libusb': config_host.has_key('CONFIG_USB_LIBUSB')} |
2061 | summary_info += {'usb net redir': config_host.has_key('CONFIG_USB_REDIR')} | |
2062 | summary_info += {'OpenGL support': config_host.has_key('CONFIG_OPENGL')} | |
2063 | summary_info += {'OpenGL dmabufs': config_host.has_key('CONFIG_OPENGL_DMABUF')} | |
2064 | summary_info += {'libiscsi support': config_host.has_key('CONFIG_LIBISCSI')} | |
2065 | summary_info += {'libnfs support': config_host.has_key('CONFIG_LIBNFS')} | |
2066 | summary_info += {'build guest agent': config_host.has_key('CONFIG_GUEST_AGENT')} | |
2067 | if targetos == 'windows' | |
2068 | if 'WIN_SDK' in config_host | |
2069 | summary_info += {'Windows SDK': config_host['WIN_SDK']} | |
2070 | endif | |
2071 | summary_info += {'QGA VSS support': config_host.has_key('CONFIG_QGA_VSS')} | |
2072 | summary_info += {'QGA w32 disk info': config_host.has_key('CONFIG_QGA_NTDDSCSI')} | |
4bad7c3b | 2073 | summary_info += {'QGA MSI support': config_host.has_key('CONFIG_QGA_MSI')} |
f9332757 PB |
2074 | endif |
2075 | summary_info += {'seccomp support': config_host.has_key('CONFIG_SECCOMP')} | |
2076 | summary_info += {'coroutine backend': config_host['CONFIG_COROUTINE_BACKEND']} | |
2077 | summary_info += {'coroutine pool': config_host['CONFIG_COROUTINE_POOL'] == '1'} | |
2078 | summary_info += {'debug stack usage': config_host.has_key('CONFIG_DEBUG_STACK_USAGE')} | |
2079 | summary_info += {'mutex debugging': config_host.has_key('CONFIG_DEBUG_MUTEX')} | |
2080 | summary_info += {'crypto afalg': config_host.has_key('CONFIG_AF_ALG')} | |
2081 | summary_info += {'GlusterFS support': config_host.has_key('CONFIG_GLUSTERFS')} | |
bf0e56a3 | 2082 | summary_info += {'gcov': get_option('b_coverage')} |
f9332757 PB |
2083 | summary_info += {'TPM support': config_host.has_key('CONFIG_TPM')} |
2084 | summary_info += {'libssh support': config_host.has_key('CONFIG_LIBSSH')} | |
2085 | summary_info += {'QOM debugging': config_host.has_key('CONFIG_QOM_CAST_DEBUG')} | |
2086 | summary_info += {'Live block migration': config_host.has_key('CONFIG_LIVE_BLOCK_MIGRATION')} | |
2087 | summary_info += {'lzo support': config_host.has_key('CONFIG_LZO')} | |
2088 | summary_info += {'snappy support': config_host.has_key('CONFIG_SNAPPY')} | |
2089 | summary_info += {'bzip2 support': config_host.has_key('CONFIG_BZIP2')} | |
2090 | summary_info += {'lzfse support': config_host.has_key('CONFIG_LZFSE')} | |
2091 | summary_info += {'zstd support': config_host.has_key('CONFIG_ZSTD')} | |
2092 | summary_info += {'NUMA host support': config_host.has_key('CONFIG_NUMA')} | |
2093 | summary_info += {'libxml2': config_host.has_key('CONFIG_LIBXML2')} | |
aa087962 | 2094 | summary_info += {'memory allocator': get_option('malloc')} |
f9332757 PB |
2095 | summary_info += {'avx2 optimization': config_host.has_key('CONFIG_AVX2_OPT')} |
2096 | summary_info += {'avx512f optimization': config_host.has_key('CONFIG_AVX512F_OPT')} | |
2097 | summary_info += {'replication support': config_host.has_key('CONFIG_REPLICATION')} | |
2098 | summary_info += {'bochs support': config_host.has_key('CONFIG_BOCHS')} | |
2099 | summary_info += {'cloop support': config_host.has_key('CONFIG_CLOOP')} | |
2100 | summary_info += {'dmg support': config_host.has_key('CONFIG_DMG')} | |
2101 | summary_info += {'qcow v1 support': config_host.has_key('CONFIG_QCOW1')} | |
2102 | summary_info += {'vdi support': config_host.has_key('CONFIG_VDI')} | |
2103 | summary_info += {'vvfat support': config_host.has_key('CONFIG_VVFAT')} | |
2104 | summary_info += {'qed support': config_host.has_key('CONFIG_QED')} | |
2105 | summary_info += {'parallels support': config_host.has_key('CONFIG_PARALLELS')} | |
2106 | summary_info += {'sheepdog support': config_host.has_key('CONFIG_SHEEPDOG')} | |
8b18cdbf | 2107 | summary_info += {'capstone': capstone_opt == 'disabled' ? false : capstone_opt} |
f9332757 PB |
2108 | summary_info += {'libpmem support': config_host.has_key('CONFIG_LIBPMEM')} |
2109 | summary_info += {'libdaxctl support': config_host.has_key('CONFIG_LIBDAXCTL')} | |
f01496a3 | 2110 | summary_info += {'libudev': libudev.found()} |
f9332757 PB |
2111 | summary_info += {'default devices': config_host['CONFIG_MINIKCONF_MODE'] == '--defconfig'} |
2112 | summary_info += {'plugin support': config_host.has_key('CONFIG_PLUGIN')} | |
2113 | summary_info += {'fuzzing support': config_host.has_key('CONFIG_FUZZ')} | |
2114 | if config_host.has_key('HAVE_GDB_BIN') | |
2115 | summary_info += {'gdb': config_host['HAVE_GDB_BIN']} | |
2116 | endif | |
2117 | summary_info += {'thread sanitizer': config_host.has_key('CONFIG_TSAN')} | |
2118 | summary_info += {'rng-none': config_host.has_key('CONFIG_RNG_NONE')} | |
2119 | summary_info += {'Linux keyring': config_host.has_key('CONFIG_SECRET_KEYRING')} | |
2120 | summary(summary_info, bool_yn: true) | |
2121 | ||
2122 | if not supported_cpus.contains(cpu) | |
2123 | message() | |
2124 | warning('SUPPORT FOR THIS HOST CPU WILL GO AWAY IN FUTURE RELEASES!') | |
2125 | message() | |
2126 | message('CPU host architecture ' + cpu + ' support is not currently maintained.') | |
2127 | message('The QEMU project intends to remove support for this host CPU in') | |
2128 | message('a future release if nobody volunteers to maintain it and to') | |
2129 | message('provide a build host for our continuous integration setup.') | |
2130 | message('configure has succeeded and you can continue to build, but') | |
2131 | message('if you care about QEMU on this platform you should contact') | |
2132 | message('us upstream at qemu-devel@nongnu.org.') | |
2133 | endif | |
2134 | ||
2135 | if not supported_oses.contains(targetos) | |
2136 | message() | |
2137 | warning('WARNING: SUPPORT FOR THIS HOST OS WILL GO AWAY IN FUTURE RELEASES!') | |
2138 | message() | |
2139 | message('Host OS ' + targetos + 'support is not currently maintained.') | |
2140 | message('The QEMU project intends to remove support for this host OS in') | |
2141 | message('a future release if nobody volunteers to maintain it and to') | |
2142 | message('provide a build host for our continuous integration setup.') | |
2143 | message('configure has succeeded and you can continue to build, but') | |
2144 | message('if you care about QEMU on this platform you should contact') | |
2145 | message('us upstream at qemu-devel@nongnu.org.') | |
2146 | endif |