blob: 6fbe79ae94d656ccbab7d9a859d10b9f648db936 [file] [log] [blame]
Paolo Bonzinia5665052019-06-10 12:05:14 +02001project('qemu', ['c'], meson_version: '>=0.55.0',
Gerd Hoffmann90756b22020-08-25 08:43:42 +02002 default_options: ['warning_level=1', 'c_std=gnu99', 'cpp_std=gnu++11',
Paolo Bonzini3e0e5192020-09-01 12:48:00 -04003 'b_colorout=auto'],
Paolo Bonzinia5665052019-06-10 12:05:14 +02004 version: run_command('head', meson.source_root() / 'VERSION').stdout().strip())
5
6not_found = dependency('', required: false)
Paolo Bonzinib29b40f2020-08-10 18:04:43 +02007if meson.version().version_compare('>=0.56.0')
8 keyval = import('keyval')
9else
10 keyval = import('unstable-keyval')
11endif
Paolo Bonzinia81df1b2020-08-19 08:44:56 -040012ss = import('sourceset')
13
Paolo Bonzinice1c1e72020-01-28 16:41:44 +010014sh = find_program('sh')
Paolo Bonzinia81df1b2020-08-19 08:44:56 -040015cc = meson.get_compiler('c')
Paolo Bonzinia5665052019-06-10 12:05:14 +020016config_host = keyval.load(meson.current_build_dir() / 'config-host.mak')
Marc-André Lureau3154fee2019-08-29 22:07:01 +040017enable_modules = 'CONFIG_MODULES' in config_host
Paolo Bonzini35be72b2020-02-06 14:17:15 +010018enable_static = 'CONFIG_STATIC' in config_host
Paolo Bonzinif8aa24e2020-08-05 15:49:10 +020019build_docs = 'BUILD_DOCS' in config_host
Marc-André Lureauab4c0992020-08-26 15:04:16 +040020qemu_datadir = get_option('datadir') / get_option('qemu_suffix')
Marc-André Lureau491e74c2020-08-26 15:04:17 +040021qemu_docdir = get_option('docdir') / get_option('qemu_suffix')
Paolo Bonzini859aef02020-08-04 18:14:26 +020022config_host_data = configuration_data()
23genh = []
Paolo Bonzinia5665052019-06-10 12:05:14 +020024
Paolo Bonzini760e4322020-08-26 08:09:48 +020025target_dirs = config_host['TARGET_DIRS'].split()
26have_user = false
27have_system = false
28foreach target : target_dirs
29 have_user = have_user or target.endswith('-user')
30 have_system = have_system or target.endswith('-softmmu')
31endforeach
32have_tools = 'CONFIG_TOOLS' in config_host
33have_block = have_system or have_tools
34
Paolo Bonzinia5665052019-06-10 12:05:14 +020035add_project_arguments(config_host['QEMU_CFLAGS'].split(),
36 native: false, language: ['c', 'objc'])
37add_project_arguments(config_host['QEMU_CXXFLAGS'].split(),
38 native: false, language: 'cpp')
39add_project_link_arguments(config_host['QEMU_LDFLAGS'].split(),
40 native: false, language: ['c', 'cpp', 'objc'])
41add_project_arguments(config_host['QEMU_INCLUDES'].split(),
42 language: ['c', 'cpp', 'objc'])
43
Marc-André Lureaufc929892019-07-13 01:47:54 +040044python = import('python').find_installation()
45
46link_language = meson.get_external_property('link_language', 'cpp')
47if link_language == 'cpp'
48 add_languages('cpp', required: true, native: false)
49endif
Paolo Bonzinia5665052019-06-10 12:05:14 +020050if host_machine.system() == 'darwin'
51 add_languages('objc', required: false, native: false)
52endif
53
Paolo Bonzini968b4db2020-02-03 14:45:33 +010054if 'SPARSE_CFLAGS' in config_host
55 run_target('sparse',
56 command: [find_program('scripts/check_sparse.py'),
57 config_host['SPARSE_CFLAGS'].split(),
58 'compile_commands.json'])
59endif
60
Paolo Bonzinia5665052019-06-10 12:05:14 +020061configure_file(input: files('scripts/ninjatool.py'),
62 output: 'ninjatool',
63 configuration: config_host)
Paolo Bonzinif9332752020-02-03 13:28:38 +010064
65supported_oses = ['windows', 'freebsd', 'netbsd', 'openbsd', 'darwin', 'sunos', 'linux']
66supported_cpus = ['ppc', 'ppc64', 's390x', 'sparc64', 'riscv32', 'riscv64', 'x86', 'x86_64',
67 'arm', 'aarch64', 'mips', 'mips64', 'sparc', 'sparc64']
68
69cpu = host_machine.cpu_family()
70targetos = host_machine.system()
71
Paolo Bonzinia81df1b2020-08-19 08:44:56 -040072m = cc.find_library('m', required: false)
73util = cc.find_library('util', required: false)
Paolo Bonzini4a963372020-08-03 16:22:28 +020074winmm = []
Paolo Bonzinia81df1b2020-08-19 08:44:56 -040075socket = []
Marc-André Lureau04c6f1e2019-07-18 00:31:05 +040076version_res = []
Marc-André Lureaud92989a2019-08-20 19:48:59 +040077coref = []
78iokit = []
79cocoa = []
80hvf = []
Paolo Bonzinia81df1b2020-08-19 08:44:56 -040081if targetos == 'windows'
82 socket = cc.find_library('ws2_32')
Paolo Bonzini4a963372020-08-03 16:22:28 +020083 winmm = cc.find_library('winmm')
Marc-André Lureau04c6f1e2019-07-18 00:31:05 +040084
85 win = import('windows')
86 version_res = win.compile_resources('version.rc',
87 depend_files: files('pc-bios/qemu-nsis.ico'),
88 include_directories: include_directories('.'))
Marc-André Lureaud92989a2019-08-20 19:48:59 +040089elif targetos == 'darwin'
90 coref = dependency('appleframeworks', modules: 'CoreFoundation')
91 iokit = dependency('appleframeworks', modules: 'IOKit')
92 cocoa = dependency('appleframeworks', modules: 'Cocoa')
93 hvf = dependency('appleframeworks', modules: 'Hypervisor')
Paolo Bonzinicfad62f2020-08-09 23:47:45 +020094elif targetos == 'sunos'
95 socket = [cc.find_library('socket'),
96 cc.find_library('nsl'),
97 cc.find_library('resolv')]
98elif targetos == 'haiku'
99 socket = [cc.find_library('posix_error_mapper'),
100 cc.find_library('network'),
101 cc.find_library('bsd')]
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400102endif
103glib = declare_dependency(compile_args: config_host['GLIB_CFLAGS'].split(),
104 link_args: config_host['GLIB_LIBS'].split())
105gio = not_found
106if 'CONFIG_GIO' in config_host
107 gio = declare_dependency(compile_args: config_host['GIO_CFLAGS'].split(),
108 link_args: config_host['GIO_LIBS'].split())
109endif
110lttng = not_found
111if 'CONFIG_TRACE_UST' in config_host
112 lttng = declare_dependency(link_args: config_host['LTTNG_UST_LIBS'].split())
113endif
114urcubp = not_found
115if 'CONFIG_TRACE_UST' in config_host
116 urcubp = declare_dependency(link_args: config_host['URCU_BP_LIBS'].split())
117endif
Daniel P. Berrangé46859d92020-09-01 14:30:49 +0100118gcrypt = not_found
119if 'CONFIG_GCRYPT' in config_host
120 gcrypt = declare_dependency(compile_args: config_host['GCRYPT_CFLAGS'].split(),
121 link_args: config_host['GCRYPT_LIBS'].split())
122endif
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400123nettle = not_found
124if 'CONFIG_NETTLE' in config_host
125 nettle = declare_dependency(compile_args: config_host['NETTLE_CFLAGS'].split(),
126 link_args: config_host['NETTLE_LIBS'].split())
127endif
128gnutls = not_found
129if 'CONFIG_GNUTLS' in config_host
130 gnutls = declare_dependency(compile_args: config_host['GNUTLS_CFLAGS'].split(),
131 link_args: config_host['GNUTLS_LIBS'].split())
132endif
Paolo Bonzinib7612f42020-08-26 08:22:58 +0200133pixman = not_found
134if have_system or have_tools
135 pixman = dependency('pixman-1', required: have_system, version:'>=0.21.8',
Paolo Bonzini1a949332020-08-31 06:27:00 -0400136 method: 'pkg-config', static: enable_static)
Paolo Bonzinib7612f42020-08-26 08:22:58 +0200137endif
Marc-André Lureau5e7fbd22019-07-15 22:54:34 +0400138pam = not_found
139if 'CONFIG_AUTH_PAM' in config_host
140 pam = cc.find_library('pam')
141endif
Marc-André Lureau5e5733e2019-08-29 22:34:43 +0400142libaio = cc.find_library('aio', required: false)
Paolo Bonzini1ffb3bb2020-08-28 19:33:54 +0200143zlib = dependency('zlib', required: true, static: enable_static)
Marc-André Lureau5e5733e2019-08-29 22:34:43 +0400144linux_io_uring = not_found
145if 'CONFIG_LINUX_IO_URING' in config_host
146 linux_io_uring = declare_dependency(compile_args: config_host['LINUX_IO_URING_CFLAGS'].split(),
147 link_args: config_host['LINUX_IO_URING_LIBS'].split())
148endif
149libxml2 = not_found
150if 'CONFIG_LIBXML2' in config_host
151 libxml2 = declare_dependency(compile_args: config_host['LIBXML2_CFLAGS'].split(),
152 link_args: config_host['LIBXML2_LIBS'].split())
153endif
154libnfs = not_found
155if 'CONFIG_LIBNFS' in config_host
156 libnfs = declare_dependency(link_args: config_host['LIBNFS_LIBS'].split())
157endif
Marc-André Lureauec0d5892019-07-15 15:04:49 +0400158libattr = not_found
159if 'CONFIG_ATTR' in config_host
160 libattr = declare_dependency(link_args: config_host['LIBATTR_LIBS'].split())
161endif
Paolo Bonzini3f99cf52020-02-05 09:45:39 +0100162seccomp = not_found
163if 'CONFIG_SECCOMP' in config_host
164 seccomp = declare_dependency(compile_args: config_host['SECCOMP_CFLAGS'].split(),
165 link_args: config_host['SECCOMP_LIBS'].split())
166endif
167libcap_ng = not_found
168if 'CONFIG_LIBCAP_NG' in config_host
169 libcap_ng = declare_dependency(link_args: config_host['LIBCAP_NG_LIBS'].split())
170endif
Paolo Bonzini1917ec62020-08-26 03:24:11 -0400171if get_option('xkbcommon').auto() and not have_system and not have_tools
172 xkbcommon = not_found
173else
174 xkbcommon = dependency('xkbcommon', required: get_option('xkbcommon'),
Paolo Bonzini1a949332020-08-31 06:27:00 -0400175 method: 'pkg-config', static: enable_static)
Marc-André Lureauade60d42019-07-15 14:48:31 +0400176endif
Marc-André Lureaucdaf0722019-07-22 23:47:50 +0400177slirp = not_found
178if config_host.has_key('CONFIG_SLIRP')
179 slirp = declare_dependency(compile_args: config_host['SLIRP_CFLAGS'].split(),
180 link_args: config_host['SLIRP_LIBS'].split())
181endif
182vde = not_found
183if config_host.has_key('CONFIG_VDE')
184 vde = declare_dependency(link_args: config_host['VDE_LIBS'].split())
185endif
Paolo Bonzini478e9432020-08-17 12:47:55 +0200186pulse = not_found
187if 'CONFIG_LIBPULSE' in config_host
188 pulse = declare_dependency(compile_args: config_host['PULSE_CFLAGS'].split(),
189 link_args: config_host['PULSE_LIBS'].split())
190endif
191alsa = not_found
192if 'CONFIG_ALSA' in config_host
193 alsa = declare_dependency(compile_args: config_host['ALSA_CFLAGS'].split(),
194 link_args: config_host['ALSA_LIBS'].split())
195endif
196jack = not_found
197if 'CONFIG_LIBJACK' in config_host
198 jack = declare_dependency(link_args: config_host['JACK_LIBS'].split())
199endif
Paolo Bonzini26347332019-07-29 15:40:07 +0200200spice = not_found
201if 'CONFIG_SPICE' in config_host
202 spice = declare_dependency(compile_args: config_host['SPICE_CFLAGS'].split(),
203 link_args: config_host['SPICE_LIBS'].split())
204endif
Marc-André Lureau5ee24e72019-07-12 23:16:54 +0400205rt = cc.find_library('rt', required: false)
Marc-André Lureau897b5af2019-07-16 21:54:15 +0400206libmpathpersist = not_found
207if config_host.has_key('CONFIG_MPATH')
208 libmpathpersist = cc.find_library('mpathpersist')
209endif
Paolo Bonzini99650b62019-06-10 12:21:14 +0200210libiscsi = not_found
211if 'CONFIG_LIBISCSI' in config_host
212 libiscsi = declare_dependency(compile_args: config_host['LIBISCSI_CFLAGS'].split(),
213 link_args: config_host['LIBISCSI_LIBS'].split())
214endif
Marc-André Lureau5e5733e2019-08-29 22:34:43 +0400215zstd = not_found
216if 'CONFIG_ZSTD' in config_host
217 zstd = declare_dependency(compile_args: config_host['ZSTD_CFLAGS'].split(),
218 link_args: config_host['ZSTD_LIBS'].split())
219endif
Marc-André Lureauea458962019-07-12 22:23:46 +0400220gbm = not_found
221if 'CONFIG_GBM' in config_host
222 gbm = declare_dependency(compile_args: config_host['GBM_CFLAGS'].split(),
223 link_args: config_host['GBM_LIBS'].split())
224endif
225virgl = not_found
226if 'CONFIG_VIRGL' in config_host
227 virgl = declare_dependency(compile_args: config_host['VIRGL_CFLAGS'].split(),
228 link_args: config_host['VIRGL_LIBS'].split())
229endif
Marc-André Lureau1d7bb6a2019-07-12 23:47:06 +0400230curl = not_found
231if 'CONFIG_CURL' in config_host
232 curl = declare_dependency(compile_args: config_host['CURL_CFLAGS'].split(),
233 link_args: config_host['CURL_LIBS'].split())
234endif
Paolo Bonzinif15bff22019-07-18 13:19:02 +0200235libudev = not_found
236if 'CONFIG_LIBUDEV' in config_host
237 libudev = declare_dependency(link_args: config_host['LIBUDEV_LIBS'].split())
238endif
Paolo Bonzini26347332019-07-29 15:40:07 +0200239brlapi = not_found
240if 'CONFIG_BRLAPI' in config_host
241 brlapi = declare_dependency(link_args: config_host['BRLAPI_LIBS'].split())
242endif
Paolo Bonzini35be72b2020-02-06 14:17:15 +0100243
Paolo Bonzini760e4322020-08-26 08:09:48 +0200244sdl = not_found
245if have_system
Yonggang Luo363743d2020-08-26 23:10:03 +0800246 sdl = dependency('sdl2', required: get_option('sdl'), static: enable_static)
Paolo Bonzini760e4322020-08-26 08:09:48 +0200247 sdl_image = not_found
248endif
Paolo Bonzini35be72b2020-02-06 14:17:15 +0100249if sdl.found()
250 # work around 2.0.8 bug
251 sdl = declare_dependency(compile_args: '-Wno-undef',
252 dependencies: sdl)
Volker Rümelin7161a432020-08-29 12:41:58 +0200253 sdl_image = dependency('SDL2_image', required: get_option('sdl_image'),
Paolo Bonzini1a949332020-08-31 06:27:00 -0400254 method: 'pkg-config', static: enable_static)
Paolo Bonzini35be72b2020-02-06 14:17:15 +0100255else
256 if get_option('sdl_image').enabled()
257 error('sdl-image required, but SDL was @0@',
258 get_option('sdl').disabled() ? 'disabled' : 'not found')
259 endif
260 sdl_image = not_found
Paolo Bonzini26347332019-07-29 15:40:07 +0200261endif
Paolo Bonzini35be72b2020-02-06 14:17:15 +0100262
Marc-André Lureau5e5733e2019-08-29 22:34:43 +0400263rbd = not_found
264if 'CONFIG_RBD' in config_host
265 rbd = declare_dependency(link_args: config_host['RBD_LIBS'].split())
266endif
267glusterfs = not_found
268if 'CONFIG_GLUSTERFS' in config_host
269 glusterfs = declare_dependency(compile_args: config_host['GLUSTERFS_CFLAGS'].split(),
270 link_args: config_host['GLUSTERFS_LIBS'].split())
271endif
272libssh = not_found
273if 'CONFIG_LIBSSH' in config_host
274 libssh = declare_dependency(compile_args: config_host['LIBSSH_CFLAGS'].split(),
275 link_args: config_host['LIBSSH_LIBS'].split())
276endif
277libbzip2 = not_found
278if 'CONFIG_BZIP2' in config_host
279 libbzip2 = declare_dependency(link_args: config_host['BZIP2_LIBS'].split())
280endif
281liblzfse = not_found
282if 'CONFIG_LZFSE' in config_host
283 liblzfse = declare_dependency(link_args: config_host['LZFSE_LIBS'].split())
284endif
Paolo Bonzini478e9432020-08-17 12:47:55 +0200285oss = not_found
286if 'CONFIG_AUDIO_OSS' in config_host
287 oss = declare_dependency(link_args: config_host['OSS_LIBS'].split())
288endif
289dsound = not_found
290if 'CONFIG_AUDIO_DSOUND' in config_host
291 dsound = declare_dependency(link_args: config_host['DSOUND_LIBS'].split())
292endif
293coreaudio = not_found
294if 'CONFIG_AUDIO_COREAUDIO' in config_host
295 coreaudio = declare_dependency(link_args: config_host['COREAUDIO_LIBS'].split())
296endif
Marc-André Lureau2b1ccdf2019-07-16 23:21:02 +0400297opengl = not_found
298if 'CONFIG_OPENGL' in config_host
299 opengl = declare_dependency(link_args: config_host['OPENGL_LIBS'].split())
300else
301endif
302gtk = not_found
303if 'CONFIG_GTK' in config_host
304 gtk = declare_dependency(compile_args: config_host['GTK_CFLAGS'].split(),
305 link_args: config_host['GTK_LIBS'].split())
306endif
307vte = not_found
308if 'CONFIG_VTE' in config_host
309 vte = declare_dependency(compile_args: config_host['VTE_CFLAGS'].split(),
310 link_args: config_host['VTE_LIBS'].split())
311endif
312x11 = not_found
313if 'CONFIG_X11' in config_host
314 x11 = declare_dependency(compile_args: config_host['X11_CFLAGS'].split(),
315 link_args: config_host['X11_LIBS'].split())
316endif
317curses = not_found
318if 'CONFIG_CURSES' in config_host
319 curses = declare_dependency(compile_args: config_host['CURSES_CFLAGS'].split(),
320 link_args: config_host['CURSES_LIBS'].split())
321endif
322iconv = not_found
323if 'CONFIG_ICONV' in config_host
324 iconv = declare_dependency(compile_args: config_host['ICONV_CFLAGS'].split(),
325 link_args: config_host['ICONV_LIBS'].split())
326endif
327gio = not_found
328if 'CONFIG_GIO' in config_host
329 gio = declare_dependency(compile_args: config_host['GIO_CFLAGS'].split(),
330 link_args: config_host['GIO_LIBS'].split())
331endif
Paolo Bonzinia0b93232020-02-06 15:48:52 +0100332vnc = not_found
Marc-André Lureau2b1ccdf2019-07-16 23:21:02 +0400333png = not_found
Marc-André Lureau2b1ccdf2019-07-16 23:21:02 +0400334jpeg = not_found
Marc-André Lureau2b1ccdf2019-07-16 23:21:02 +0400335sasl = not_found
Paolo Bonzinia0b93232020-02-06 15:48:52 +0100336if get_option('vnc').enabled()
337 vnc = declare_dependency() # dummy dependency
338 png = dependency('libpng', required: get_option('vnc_png'),
Paolo Bonzini1a949332020-08-31 06:27:00 -0400339 method: 'pkg-config', static: enable_static)
Paolo Bonzinia0b93232020-02-06 15:48:52 +0100340 jpeg = cc.find_library('jpeg', has_headers: ['jpeglib.h'],
341 required: get_option('vnc_jpeg'),
342 static: enable_static)
343 sasl = cc.find_library('sasl2', has_headers: ['sasl/sasl.h'],
344 required: get_option('vnc_sasl'),
345 static: enable_static)
346 if sasl.found()
347 sasl = declare_dependency(dependencies: sasl,
348 compile_args: '-DSTRUCT_IOVEC_DEFINED')
349 endif
Marc-André Lureau2b1ccdf2019-07-16 23:21:02 +0400350endif
Paolo Bonzini4a963372020-08-03 16:22:28 +0200351fdt = not_found
352if 'CONFIG_FDT' in config_host
353 fdt = declare_dependency(compile_args: config_host['FDT_CFLAGS'].split(),
354 link_args: config_host['FDT_LIBS'].split())
355endif
Marc-André Lureau708eab42019-09-03 16:59:33 +0400356snappy = not_found
357if 'CONFIG_SNAPPY' in config_host
358 snappy = declare_dependency(link_args: config_host['SNAPPY_LIBS'].split())
359endif
360lzo = not_found
361if 'CONFIG_LZO' in config_host
362 lzo = declare_dependency(link_args: config_host['LZO_LIBS'].split())
363endif
Marc-André Lureau55166232019-07-24 19:16:22 +0400364rdma = not_found
365if 'CONFIG_RDMA' in config_host
366 rdma = declare_dependency(link_args: config_host['RDMA_LIBS'].split())
367endif
Marc-André Lureauab318052019-07-24 19:23:16 +0400368numa = not_found
369if 'CONFIG_NUMA' in config_host
370 numa = declare_dependency(link_args: config_host['NUMA_LIBS'].split())
371endif
Marc-André Lureau582ea952019-08-15 15:15:32 +0400372xen = not_found
373if 'CONFIG_XEN_BACKEND' in config_host
374 xen = declare_dependency(compile_args: config_host['XEN_CFLAGS'].split(),
375 link_args: config_host['XEN_LIBS'].split())
376endif
Paolo Bonzini06677ce2020-08-06 13:07:39 +0200377cacard = not_found
378if 'CONFIG_SMARTCARD' in config_host
379 cacard = declare_dependency(compile_args: config_host['SMARTCARD_CFLAGS'].split(),
380 link_args: config_host['SMARTCARD_LIBS'].split())
381endif
César Belley0a40bcb2020-08-26 13:42:04 +0200382u2f = not_found
383if have_system
384 u2f = dependency('u2f-emu', required: get_option('u2f'),
385 method: 'pkg-config',
386 static: enable_static)
387endif
Paolo Bonzini06677ce2020-08-06 13:07:39 +0200388usbredir = not_found
389if 'CONFIG_USB_REDIR' in config_host
390 usbredir = declare_dependency(compile_args: config_host['USB_REDIR_CFLAGS'].split(),
391 link_args: config_host['USB_REDIR_LIBS'].split())
392endif
393libusb = not_found
394if 'CONFIG_USB_LIBUSB' in config_host
395 libusb = declare_dependency(compile_args: config_host['LIBUSB_CFLAGS'].split(),
396 link_args: config_host['LIBUSB_LIBS'].split())
397endif
Marc-André Lureauc9322ab2019-08-18 19:51:17 +0400398capstone = not_found
399if 'CONFIG_CAPSTONE' in config_host
400 capstone = declare_dependency(compile_args: config_host['CAPSTONE_CFLAGS'].split(),
401 link_args: config_host['CAPSTONE_LIBS'].split())
402endif
403libpmem = not_found
404if 'CONFIG_LIBPMEM' in config_host
405 libpmem = declare_dependency(compile_args: config_host['LIBPMEM_CFLAGS'].split(),
406 link_args: config_host['LIBPMEM_LIBS'].split())
407endif
Bruce Rogersc7c91a72020-08-24 09:52:12 -0600408libdaxctl = not_found
409if 'CONFIG_LIBDAXCTL' in config_host
410 libdaxctl = declare_dependency(link_args: config_host['LIBDAXCTL_LIBS'].split())
411endif
Marc-André Lureau8ce0a452020-08-28 15:07:20 +0400412tasn1 = not_found
413if 'CONFIG_TASN1' in config_host
414 tasn1 = declare_dependency(compile_args: config_host['TASN1_CFLAGS'].split(),
415 link_args: config_host['TASN1_LIBS'].split())
416endif
Marc-André Lureauaf04e892020-08-28 15:07:25 +0400417keyutils = dependency('libkeyutils', required: false,
418 method: 'pkg-config', static: enable_static)
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400419
Marc-André Lureau3909def2020-08-28 15:07:33 +0400420has_gettid = cc.has_function('gettid')
421
Paolo Bonzini859aef02020-08-04 18:14:26 +0200422# Create config-host.h
423
Paolo Bonzini35be72b2020-02-06 14:17:15 +0100424config_host_data.set('CONFIG_SDL', sdl.found())
425config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found())
Paolo Bonzinia0b93232020-02-06 15:48:52 +0100426config_host_data.set('CONFIG_VNC', vnc.found())
427config_host_data.set('CONFIG_VNC_JPEG', jpeg.found())
428config_host_data.set('CONFIG_VNC_PNG', png.found())
429config_host_data.set('CONFIG_VNC_SASL', sasl.found())
Laurent Vivier4113f4c2020-08-24 17:24:29 +0200430config_host_data.set('CONFIG_XKBCOMMON', xkbcommon.found())
Marc-André Lureauaf04e892020-08-28 15:07:25 +0400431config_host_data.set('CONFIG_KEYUTILS', keyutils.found())
Marc-André Lureau3909def2020-08-28 15:07:33 +0400432config_host_data.set('CONFIG_GETTID', has_gettid)
Paolo Bonzini859aef02020-08-04 18:14:26 +0200433config_host_data.set('QEMU_VERSION', '"@0@"'.format(meson.project_version()))
434config_host_data.set('QEMU_VERSION_MAJOR', meson.project_version().split('.')[0])
435config_host_data.set('QEMU_VERSION_MINOR', meson.project_version().split('.')[1])
436config_host_data.set('QEMU_VERSION_MICRO', meson.project_version().split('.')[2])
437
438arrays = ['CONFIG_AUDIO_DRIVERS', 'CONFIG_BDRV_RW_WHITELIST', 'CONFIG_BDRV_RO_WHITELIST']
439strings = ['HOST_DSOSUF', 'CONFIG_IASL', 'qemu_confdir', 'qemu_datadir',
440 'qemu_moddir', 'qemu_localstatedir', 'qemu_helperdir', 'qemu_localedir',
441 'qemu_icondir', 'qemu_desktopdir', 'qemu_firmwarepath']
442foreach k, v: config_host
443 if arrays.contains(k)
444 if v != ''
445 v = '"' + '", "'.join(v.split()) + '", '
446 endif
447 config_host_data.set(k, v)
448 elif k == 'ARCH'
449 config_host_data.set('HOST_' + v.to_upper(), 1)
450 elif strings.contains(k)
451 if not k.startswith('CONFIG_')
452 k = 'CONFIG_' + k.to_upper()
453 endif
454 config_host_data.set_quoted(k, v)
455 elif k.startswith('CONFIG_') or k.startswith('HAVE_') or k.startswith('HOST_')
456 config_host_data.set(k, v == 'y' ? 1 : v)
457 endif
458endforeach
459genh += configure_file(output: 'config-host.h', configuration: config_host_data)
460
Paolo Bonzini2becc362020-02-03 11:42:03 +0100461minikconf = find_program('scripts/minikconf.py')
Paolo Bonzinia98006b2020-09-01 05:32:23 -0400462config_all_devices = {}
Paolo Bonzinica0fc782020-09-01 06:04:28 -0400463config_all_disas = {}
Paolo Bonzini2becc362020-02-03 11:42:03 +0100464config_devices_mak_list = []
465config_devices_h = {}
Paolo Bonzini859aef02020-08-04 18:14:26 +0200466config_target_h = {}
Paolo Bonzini2becc362020-02-03 11:42:03 +0100467config_target_mak = {}
Paolo Bonzinica0fc782020-09-01 06:04:28 -0400468
469disassemblers = {
470 'alpha' : ['CONFIG_ALPHA_DIS'],
471 'arm' : ['CONFIG_ARM_DIS'],
472 'avr' : ['CONFIG_AVR_DIS'],
473 'cris' : ['CONFIG_CRIS_DIS'],
474 'hppa' : ['CONFIG_HPPA_DIS'],
475 'i386' : ['CONFIG_I386_DIS'],
476 'x86_64' : ['CONFIG_I386_DIS'],
477 'x32' : ['CONFIG_I386_DIS'],
478 'lm32' : ['CONFIG_LM32_DIS'],
479 'm68k' : ['CONFIG_M68K_DIS'],
480 'microblaze' : ['CONFIG_MICROBLAZE_DIS'],
481 'mips' : ['CONFIG_MIPS_DIS'],
482 'moxie' : ['CONFIG_MOXIE_DIS'],
483 'nios2' : ['CONFIG_NIOS2_DIS'],
484 'or1k' : ['CONFIG_OPENRISC_DIS'],
485 'ppc' : ['CONFIG_PPC_DIS'],
486 'riscv' : ['CONFIG_RISCV_DIS'],
487 'rx' : ['CONFIG_RX_DIS'],
488 's390' : ['CONFIG_S390_DIS'],
489 'sh4' : ['CONFIG_SH4_DIS'],
490 'sparc' : ['CONFIG_SPARC_DIS'],
491 'xtensa' : ['CONFIG_XTENSA_DIS'],
492}
493if link_language == 'cpp'
494 disassemblers += {
495 'aarch64' : [ 'CONFIG_ARM_A64_DIS'],
496 'arm' : [ 'CONFIG_ARM_DIS', 'CONFIG_ARM_A64_DIS'],
497 'mips' : [ 'CONFIG_MIPS_DIS', 'CONFIG_NANOMIPS_DIS'],
498 }
499endif
500
Paolo Bonzini2becc362020-02-03 11:42:03 +0100501kconfig_external_symbols = [
502 'CONFIG_KVM',
503 'CONFIG_XEN',
504 'CONFIG_TPM',
505 'CONFIG_SPICE',
506 'CONFIG_IVSHMEM',
507 'CONFIG_OPENGL',
508 'CONFIG_X11',
509 'CONFIG_VHOST_USER',
510 'CONFIG_VHOST_KERNEL',
511 'CONFIG_VIRTFS',
512 'CONFIG_LINUX',
513 'CONFIG_PVRDMA',
514]
Paolo Bonzini859aef02020-08-04 18:14:26 +0200515ignored = ['TARGET_XML_FILES', 'TARGET_ABI_DIR', 'TARGET_DIRS']
Paolo Bonzinica0fc782020-09-01 06:04:28 -0400516
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400517foreach target : target_dirs
Paolo Bonzini859aef02020-08-04 18:14:26 +0200518 config_target = keyval.load(meson.current_build_dir() / target / 'config-target.mak')
519
Paolo Bonzinica0fc782020-09-01 06:04:28 -0400520 foreach k, v: disassemblers
521 if config_host['ARCH'].startswith(k) or config_target['TARGET_BASE_ARCH'].startswith(k)
522 foreach sym: v
523 config_target += { sym: 'y' }
524 config_all_disas += { sym: 'y' }
525 endforeach
526 endif
527 endforeach
528
Paolo Bonzini859aef02020-08-04 18:14:26 +0200529 config_target_data = configuration_data()
530 foreach k, v: config_target
531 if not k.startswith('TARGET_') and not k.startswith('CONFIG_')
532 # do nothing
533 elif ignored.contains(k)
534 # do nothing
535 elif k == 'TARGET_BASE_ARCH'
536 config_target_data.set('TARGET_' + v.to_upper(), 1)
537 elif k == 'TARGET_NAME'
538 config_target_data.set_quoted(k, v)
539 elif v == 'y'
540 config_target_data.set(k, 1)
541 else
542 config_target_data.set(k, v)
543 endif
544 endforeach
545 config_target_h += {target: configure_file(output: target + '-config-target.h',
546 configuration: config_target_data)}
Paolo Bonzini2becc362020-02-03 11:42:03 +0100547
548 if target.endswith('-softmmu')
Paolo Bonzini2becc362020-02-03 11:42:03 +0100549 base_kconfig = []
550 foreach sym : kconfig_external_symbols
Paolo Bonzini859aef02020-08-04 18:14:26 +0200551 if sym in config_target or sym in config_host
Paolo Bonzini2becc362020-02-03 11:42:03 +0100552 base_kconfig += '@0@=y'.format(sym)
553 endif
554 endforeach
555
556 config_devices_mak = target + '-config-devices.mak'
557 config_devices_mak = configure_file(
558 input: ['default-configs' / target + '.mak', 'Kconfig'],
559 output: config_devices_mak,
560 depfile: config_devices_mak + '.d',
561 capture: true,
562 command: [minikconf, config_host['CONFIG_MINIKCONF_MODE'],
563 config_devices_mak, '@DEPFILE@', '@INPUT@',
564 base_kconfig])
Paolo Bonzini859aef02020-08-04 18:14:26 +0200565
566 config_devices_data = configuration_data()
567 config_devices = keyval.load(config_devices_mak)
568 foreach k, v: config_devices
569 config_devices_data.set(k, 1)
570 endforeach
Paolo Bonzini2becc362020-02-03 11:42:03 +0100571 config_devices_mak_list += config_devices_mak
Paolo Bonzini859aef02020-08-04 18:14:26 +0200572 config_devices_h += {target: configure_file(output: target + '-config-devices.h',
573 configuration: config_devices_data)}
574 config_target += config_devices
Paolo Bonzinia98006b2020-09-01 05:32:23 -0400575 config_all_devices += config_devices
Paolo Bonzini2becc362020-02-03 11:42:03 +0100576 endif
577 config_target_mak += {target: config_target}
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400578endforeach
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400579
Paolo Bonzini2becc362020-02-03 11:42:03 +0100580# This configuration is used to build files that are shared by
581# multiple binaries, and then extracted out of the "common"
582# static_library target.
583#
584# We do not use all_sources()/all_dependencies(), because it would
585# build literally all source files, including devices only used by
586# targets that are not built for this compilation. The CONFIG_ALL
587# pseudo symbol replaces it.
588
Paolo Bonzini2becc362020-02-03 11:42:03 +0100589config_all = config_all_devices
590config_all += config_host
591config_all += config_all_disas
592config_all += {
593 'CONFIG_XEN': config_host.has_key('CONFIG_XEN_BACKEND'),
594 'CONFIG_SOFTMMU': have_system,
595 'CONFIG_USER_ONLY': have_user,
596 'CONFIG_ALL': true,
597}
598
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400599# Generators
600
Marc-André Lureau3f885652019-07-15 18:06:04 +0400601hxtool = find_program('scripts/hxtool')
Marc-André Lureau650b5d52019-07-15 17:36:47 +0400602shaderinclude = find_program('scripts/shaderinclude.pl')
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400603qapi_gen = find_program('scripts/qapi-gen.py')
604qapi_gen_depends = [ meson.source_root() / 'scripts/qapi/__init__.py',
605 meson.source_root() / 'scripts/qapi/commands.py',
606 meson.source_root() / 'scripts/qapi/common.py',
607 meson.source_root() / 'scripts/qapi/doc.py',
608 meson.source_root() / 'scripts/qapi/error.py',
609 meson.source_root() / 'scripts/qapi/events.py',
610 meson.source_root() / 'scripts/qapi/expr.py',
611 meson.source_root() / 'scripts/qapi/gen.py',
612 meson.source_root() / 'scripts/qapi/introspect.py',
613 meson.source_root() / 'scripts/qapi/parser.py',
614 meson.source_root() / 'scripts/qapi/schema.py',
615 meson.source_root() / 'scripts/qapi/source.py',
616 meson.source_root() / 'scripts/qapi/types.py',
617 meson.source_root() / 'scripts/qapi/visit.py',
618 meson.source_root() / 'scripts/qapi/common.py',
619 meson.source_root() / 'scripts/qapi/doc.py',
620 meson.source_root() / 'scripts/qapi-gen.py'
621]
622
623tracetool = [
624 python, files('scripts/tracetool.py'),
625 '--backend=' + config_host['TRACE_BACKENDS']
626]
627
Marc-André Lureau2c273f32019-07-15 17:10:19 +0400628qemu_version_cmd = [find_program('scripts/qemu-version.sh'),
629 meson.current_source_dir(),
Paolo Bonzini859aef02020-08-04 18:14:26 +0200630 config_host['PKGVERSION'], meson.project_version()]
Marc-André Lureau2c273f32019-07-15 17:10:19 +0400631qemu_version = custom_target('qemu-version.h',
632 output: 'qemu-version.h',
633 command: qemu_version_cmd,
634 capture: true,
635 build_by_default: true,
636 build_always_stale: true)
637genh += qemu_version
638
Marc-André Lureau3f885652019-07-15 18:06:04 +0400639hxdep = []
640hx_headers = [
641 ['qemu-options.hx', 'qemu-options.def'],
642 ['qemu-img-cmds.hx', 'qemu-img-cmds.h'],
643]
644if have_system
645 hx_headers += [
646 ['hmp-commands.hx', 'hmp-commands.h'],
647 ['hmp-commands-info.hx', 'hmp-commands-info.h'],
648 ]
649endif
650foreach d : hx_headers
Marc-André Lureaub7c70bf2019-07-16 21:37:25 +0400651 hxdep += custom_target(d[1],
Marc-André Lureau3f885652019-07-15 18:06:04 +0400652 input: files(d[0]),
653 output: d[1],
654 capture: true,
655 build_by_default: true, # to be removed when added to a target
656 command: [hxtool, '-h', '@INPUT0@'])
657endforeach
658genh += hxdep
659
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400660# Collect sourcesets.
661
662util_ss = ss.source_set()
663stub_ss = ss.source_set()
664trace_ss = ss.source_set()
Marc-André Lureau3154fee2019-08-29 22:07:01 +0400665block_ss = ss.source_set()
Paolo Bonzini4a963372020-08-03 16:22:28 +0200666blockdev_ss = ss.source_set()
Paolo Bonziniff219dc2020-08-04 21:14:26 +0200667qmp_ss = ss.source_set()
Paolo Bonzini2becc362020-02-03 11:42:03 +0100668common_ss = ss.source_set()
669softmmu_ss = ss.source_set()
670user_ss = ss.source_set()
671bsd_user_ss = ss.source_set()
672linux_user_ss = ss.source_set()
673specific_ss = ss.source_set()
Paolo Bonzini64ed6f92020-08-03 17:04:25 +0200674specific_fuzz_ss = ss.source_set()
Paolo Bonzini2becc362020-02-03 11:42:03 +0100675
Marc-André Lureau3154fee2019-08-29 22:07:01 +0400676modules = {}
Paolo Bonzini2becc362020-02-03 11:42:03 +0100677hw_arch = {}
678target_arch = {}
679target_softmmu_arch = {}
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400680
681###############
682# Trace files #
683###############
684
Marc-André Lureauc9322ab2019-08-18 19:51:17 +0400685# TODO: add each directory to the subdirs from its own meson.build, once
686# we have those
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400687trace_events_subdirs = [
688 'accel/kvm',
689 'accel/tcg',
690 'crypto',
691 'monitor',
692]
693if have_user
694 trace_events_subdirs += [ 'linux-user' ]
695endif
696if have_block
697 trace_events_subdirs += [
698 'authz',
699 'block',
700 'io',
701 'nbd',
702 'scsi',
703 ]
704endif
705if have_system
706 trace_events_subdirs += [
707 'audio',
708 'backends',
709 'backends/tpm',
710 'chardev',
711 'hw/9pfs',
712 'hw/acpi',
713 'hw/alpha',
714 'hw/arm',
715 'hw/audio',
716 'hw/block',
717 'hw/block/dataplane',
718 'hw/char',
719 'hw/display',
720 'hw/dma',
721 'hw/hppa',
722 'hw/hyperv',
723 'hw/i2c',
724 'hw/i386',
725 'hw/i386/xen',
726 'hw/ide',
727 'hw/input',
728 'hw/intc',
729 'hw/isa',
730 'hw/mem',
731 'hw/mips',
732 'hw/misc',
733 'hw/misc/macio',
734 'hw/net',
735 'hw/nvram',
736 'hw/pci',
737 'hw/pci-host',
738 'hw/ppc',
739 'hw/rdma',
740 'hw/rdma/vmw',
741 'hw/rtc',
742 'hw/s390x',
743 'hw/scsi',
744 'hw/sd',
745 'hw/sparc',
746 'hw/sparc64',
747 'hw/ssi',
748 'hw/timer',
749 'hw/tpm',
750 'hw/usb',
751 'hw/vfio',
752 'hw/virtio',
753 'hw/watchdog',
754 'hw/xen',
755 'hw/gpio',
756 'hw/riscv',
757 'migration',
758 'net',
759 'ui',
760 ]
761endif
762trace_events_subdirs += [
763 'hw/core',
764 'qapi',
765 'qom',
766 'target/arm',
767 'target/hppa',
768 'target/i386',
769 'target/mips',
770 'target/ppc',
771 'target/riscv',
772 'target/s390x',
773 'target/sparc',
774 'util',
775]
776
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400777subdir('qapi')
778subdir('qobject')
779subdir('stubs')
780subdir('trace')
781subdir('util')
Marc-André Lureau5582c582019-07-16 19:28:54 +0400782subdir('qom')
783subdir('authz')
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400784subdir('crypto')
Marc-André Lureau2d78b562019-07-15 16:00:36 +0400785subdir('ui')
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400786
Marc-André Lureau3154fee2019-08-29 22:07:01 +0400787
788if enable_modules
789 libmodulecommon = static_library('module-common', files('module-common.c') + genh, pic: true, c_args: '-DBUILD_DSO')
790 modulecommon = declare_dependency(link_whole: libmodulecommon, compile_args: '-DBUILD_DSO')
791endif
792
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400793# Build targets from sourcesets
794
Paolo Bonzini2becc362020-02-03 11:42:03 +0100795stub_ss = stub_ss.apply(config_all, strict: false)
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400796
797util_ss.add_all(trace_ss)
Paolo Bonzini2becc362020-02-03 11:42:03 +0100798util_ss = util_ss.apply(config_all, strict: false)
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400799libqemuutil = static_library('qemuutil',
800 sources: util_ss.sources() + stub_ss.sources() + genh,
801 dependencies: [util_ss.dependencies(), m, glib, socket])
802qemuutil = declare_dependency(link_with: libqemuutil,
Marc-André Lureau04c6f1e2019-07-18 00:31:05 +0400803 sources: genh + version_res)
Paolo Bonzinia81df1b2020-08-19 08:44:56 -0400804
Paolo Bonziniabff1ab2020-08-07 12:10:23 +0200805decodetree = generator(find_program('scripts/decodetree.py'),
806 output: 'decode-@BASENAME@.c.inc',
807 arguments: ['@INPUT@', '@EXTRA_ARGS@', '-o', '@OUTPUT@'])
808
Paolo Bonzini478e9432020-08-17 12:47:55 +0200809subdir('audio')
Marc-André Lureau7fcfd452019-07-16 19:33:55 +0400810subdir('io')
Marc-André Lureau848e8ff2019-07-15 23:18:07 +0400811subdir('chardev')
Marc-André Lureauec0d5892019-07-15 15:04:49 +0400812subdir('fsdev')
Paolo Bonziniabff1ab2020-08-07 12:10:23 +0200813subdir('libdecnumber')
Marc-André Lureaud3b18482019-08-17 14:55:32 +0400814subdir('target')
Marc-André Lureau708eab42019-09-03 16:59:33 +0400815subdir('dump')
Marc-André Lureauec0d5892019-07-15 15:04:49 +0400816
Marc-André Lureau5e5733e2019-08-29 22:34:43 +0400817block_ss.add(files(
818 'block.c',
819 'blockjob.c',
820 'job.c',
821 'qemu-io-cmds.c',
822))
823block_ss.add(when: 'CONFIG_REPLICATION', if_true: files('replication.c'))
824
825subdir('nbd')
826subdir('scsi')
827subdir('block')
828
Paolo Bonzini4a963372020-08-03 16:22:28 +0200829blockdev_ss.add(files(
830 'blockdev.c',
831 'blockdev-nbd.c',
832 'iothread.c',
833 'job-qmp.c',
834))
835
836# os-posix.c contains POSIX-specific functions used by qemu-storage-daemon,
837# os-win32.c does not
838blockdev_ss.add(when: 'CONFIG_POSIX', if_true: files('os-posix.c'))
839softmmu_ss.add(when: 'CONFIG_WIN32', if_true: [files('os-win32.c')])
840
841softmmu_ss.add_all(blockdev_ss)
842softmmu_ss.add(files(
843 'bootdevice.c',
844 'dma-helpers.c',
845 'qdev-monitor.c',
846), sdl)
847
848softmmu_ss.add(when: 'CONFIG_TPM', if_true: files('tpm.c'))
849softmmu_ss.add(when: 'CONFIG_SECCOMP', if_true: [files('qemu-seccomp.c'), seccomp])
850softmmu_ss.add(when: ['CONFIG_FDT', fdt], if_true: [files('device_tree.c')])
851
852common_ss.add(files('cpus-common.c'))
853
Paolo Bonzini5d3ea0e2020-08-06 13:40:26 +0200854subdir('softmmu')
Marc-André Lureauc9322ab2019-08-18 19:51:17 +0400855
Bruce Rogersc7c91a72020-08-24 09:52:12 -0600856specific_ss.add(files('disas.c', 'exec.c', 'gdbstub.c'), capstone, libpmem, libdaxctl)
Marc-André Lureauc9322ab2019-08-18 19:51:17 +0400857specific_ss.add(files('exec-vary.c'))
858specific_ss.add(when: 'CONFIG_TCG', if_true: files(
859 'fpu/softfloat.c',
860 'tcg/optimize.c',
861 'tcg/tcg-common.c',
862 'tcg/tcg-op-gvec.c',
863 'tcg/tcg-op-vec.c',
864 'tcg/tcg-op.c',
865 'tcg/tcg.c',
866))
867specific_ss.add(when: 'CONFIG_TCG_INTERPRETER', if_true: files('disas/tci.c', 'tcg/tci.c'))
868
Marc-André Lureauab318052019-07-24 19:23:16 +0400869subdir('backends')
Marc-André Lureauc574e162019-07-26 12:02:31 +0400870subdir('disas')
Marc-André Lureau55166232019-07-24 19:16:22 +0400871subdir('migration')
Paolo Bonziniff219dc2020-08-04 21:14:26 +0200872subdir('monitor')
Marc-André Lureaucdaf0722019-07-22 23:47:50 +0400873subdir('net')
Marc-André Lureau17ef2af2019-07-22 23:40:45 +0400874subdir('replay')
Marc-André Lureau582ea952019-08-15 15:15:32 +0400875subdir('hw')
Marc-André Lureau1a828782019-08-18 16:13:08 +0400876subdir('accel')
Paolo Bonzinif556b4a2020-01-24 13:08:01 +0100877subdir('plugins')
Marc-André Lureaub309c322019-08-18 19:20:37 +0400878subdir('bsd-user')
Marc-André Lureau3a304462019-08-18 16:13:08 +0400879subdir('linux-user')
880
Marc-André Lureaub309c322019-08-18 19:20:37 +0400881bsd_user_ss.add(files('gdbstub.c'))
882specific_ss.add_all(when: 'CONFIG_BSD_USER', if_true: bsd_user_ss)
883
Marc-André Lureau3a304462019-08-18 16:13:08 +0400884linux_user_ss.add(files('gdbstub.c', 'thunk.c'))
885specific_ss.add_all(when: 'CONFIG_LINUX_USER', if_true: linux_user_ss)
Paolo Bonzini5d3ea0e2020-08-06 13:40:26 +0200886
Paolo Bonzinia2ce7db2020-08-04 20:00:40 +0200887# needed for fuzzing binaries
888subdir('tests/qtest/libqos')
Paolo Bonzini64ed6f92020-08-03 17:04:25 +0200889subdir('tests/qtest/fuzz')
Paolo Bonzinia2ce7db2020-08-04 20:00:40 +0200890
Marc-André Lureau3154fee2019-08-29 22:07:01 +0400891block_mods = []
892softmmu_mods = []
893foreach d, list : modules
894 foreach m, module_ss : list
895 if enable_modules and targetos != 'windows'
896 module_ss = module_ss.apply(config_host, strict: false)
897 sl = static_library(d + '-' + m, [genh, module_ss.sources()],
898 dependencies: [modulecommon, module_ss.dependencies()], pic: true)
899 if d == 'block'
900 block_mods += sl
901 else
902 softmmu_mods += sl
903 endif
904 else
905 if d == 'block'
906 block_ss.add_all(module_ss)
907 else
908 softmmu_ss.add_all(module_ss)
909 endif
910 endif
911 endforeach
912endforeach
913
914nm = find_program('nm')
915undefsym = find_program('scripts/undefsym.sh')
916block_syms = custom_target('block.syms', output: 'block.syms',
917 input: [libqemuutil, block_mods],
918 capture: true,
919 command: [undefsym, nm, '@INPUT@'])
920qemu_syms = custom_target('qemu.syms', output: 'qemu.syms',
921 input: [libqemuutil, softmmu_mods],
922 capture: true,
923 command: [undefsym, nm, '@INPUT@'])
924
Marc-André Lureau5e5733e2019-08-29 22:34:43 +0400925block_ss = block_ss.apply(config_host, strict: false)
926libblock = static_library('block', block_ss.sources() + genh,
927 dependencies: block_ss.dependencies(),
928 link_depends: block_syms,
929 name_suffix: 'fa',
930 build_by_default: false)
931
932block = declare_dependency(link_whole: [libblock],
Marc-André Lureaub7c70bf2019-07-16 21:37:25 +0400933 link_args: '@block.syms',
934 dependencies: [crypto, io])
Marc-André Lureau5e5733e2019-08-29 22:34:43 +0400935
Paolo Bonziniff219dc2020-08-04 21:14:26 +0200936qmp_ss = qmp_ss.apply(config_host, strict: false)
937libqmp = static_library('qmp', qmp_ss.sources() + genh,
938 dependencies: qmp_ss.dependencies(),
939 name_suffix: 'fa',
940 build_by_default: false)
941
942qmp = declare_dependency(link_whole: [libqmp])
943
Marc-André Lureau3154fee2019-08-29 22:07:01 +0400944foreach m : block_mods + softmmu_mods
945 shared_module(m.name(),
946 name_prefix: '',
947 link_whole: m,
948 install: true,
949 install_dir: config_host['qemu_moddir'])
950endforeach
951
Paolo Bonzini64ed6f92020-08-03 17:04:25 +0200952softmmu_ss.add(authz, block, chardev, crypto, io, qmp)
953common_ss.add(qom, qemuutil)
954
955common_ss.add_all(when: 'CONFIG_SOFTMMU', if_true: [softmmu_ss])
Paolo Bonzini2becc362020-02-03 11:42:03 +0100956common_ss.add_all(when: 'CONFIG_USER_ONLY', if_true: user_ss)
957
958common_all = common_ss.apply(config_all, strict: false)
959common_all = static_library('common',
960 build_by_default: false,
961 sources: common_all.sources() + genh,
962 dependencies: common_all.dependencies(),
963 name_suffix: 'fa')
964
Marc-André Lureauc9322ab2019-08-18 19:51:17 +0400965feature_to_c = find_program('scripts/feature_to_c.sh')
966
Paolo Bonzini64ed6f92020-08-03 17:04:25 +0200967emulators = []
Paolo Bonzini2becc362020-02-03 11:42:03 +0100968foreach target : target_dirs
969 config_target = config_target_mak[target]
970 target_name = config_target['TARGET_NAME']
971 arch = config_target['TARGET_BASE_ARCH']
Paolo Bonzini859aef02020-08-04 18:14:26 +0200972 arch_srcs = [config_target_h[target]]
Paolo Bonzini64ed6f92020-08-03 17:04:25 +0200973 arch_deps = []
974 c_args = ['-DNEED_CPU_H',
975 '-DCONFIG_TARGET="@0@-config-target.h"'.format(target),
976 '-DCONFIG_DEVICES="@0@-config-devices.h"'.format(target)]
977 link_args = []
Paolo Bonzini2becc362020-02-03 11:42:03 +0100978
Paolo Bonzini859aef02020-08-04 18:14:26 +0200979 config_target += config_host
Paolo Bonzini2becc362020-02-03 11:42:03 +0100980 target_inc = [include_directories('target' / config_target['TARGET_BASE_ARCH'])]
981 if targetos == 'linux'
982 target_inc += include_directories('linux-headers', is_system: true)
983 endif
984 if target.endswith('-softmmu')
985 qemu_target_name = 'qemu-system-' + target_name
986 target_type='system'
Paolo Bonziniabff1ab2020-08-07 12:10:23 +0200987 t = target_softmmu_arch[arch].apply(config_target, strict: false)
988 arch_srcs += t.sources()
Paolo Bonzini64ed6f92020-08-03 17:04:25 +0200989 arch_deps += t.dependencies()
Paolo Bonziniabff1ab2020-08-07 12:10:23 +0200990
Marc-André Lureau2c442202019-08-17 13:55:58 +0400991 hw_dir = target_name == 'sparc64' ? 'sparc64' : arch
992 hw = hw_arch[hw_dir].apply(config_target, strict: false)
993 arch_srcs += hw.sources()
Paolo Bonzini64ed6f92020-08-03 17:04:25 +0200994 arch_deps += hw.dependencies()
Marc-André Lureau2c442202019-08-17 13:55:58 +0400995
Paolo Bonzini2becc362020-02-03 11:42:03 +0100996 arch_srcs += config_devices_h[target]
Paolo Bonzini64ed6f92020-08-03 17:04:25 +0200997 link_args += ['@block.syms', '@qemu.syms']
Paolo Bonzini2becc362020-02-03 11:42:03 +0100998 else
Marc-André Lureau3a304462019-08-18 16:13:08 +0400999 abi = config_target['TARGET_ABI_DIR']
Paolo Bonzini2becc362020-02-03 11:42:03 +01001000 target_type='user'
1001 qemu_target_name = 'qemu-' + target_name
1002 if 'CONFIG_LINUX_USER' in config_target
1003 base_dir = 'linux-user'
1004 target_inc += include_directories('linux-user/host/' / config_host['ARCH'])
1005 else
1006 base_dir = 'bsd-user'
1007 endif
1008 target_inc += include_directories(
1009 base_dir,
Marc-André Lureau3a304462019-08-18 16:13:08 +04001010 base_dir / abi,
Paolo Bonzini2becc362020-02-03 11:42:03 +01001011 )
Marc-André Lureau3a304462019-08-18 16:13:08 +04001012 if 'CONFIG_LINUX_USER' in config_target
1013 dir = base_dir / abi
1014 arch_srcs += files(dir / 'signal.c', dir / 'cpu_loop.c')
1015 if config_target.has_key('TARGET_SYSTBL_ABI')
1016 arch_srcs += \
1017 syscall_nr_generators[abi].process(base_dir / abi / config_target['TARGET_SYSTBL'],
1018 extra_args : config_target['TARGET_SYSTBL_ABI'])
1019 endif
1020 endif
Paolo Bonzini2becc362020-02-03 11:42:03 +01001021 endif
1022
Marc-André Lureauc9322ab2019-08-18 19:51:17 +04001023 if 'TARGET_XML_FILES' in config_target
1024 gdbstub_xml = custom_target(target + '-gdbstub-xml.c',
1025 output: target + '-gdbstub-xml.c',
1026 input: files(config_target['TARGET_XML_FILES'].split()),
1027 command: [feature_to_c, '@INPUT@'],
1028 capture: true)
1029 arch_srcs += gdbstub_xml
1030 endif
1031
Paolo Bonziniabff1ab2020-08-07 12:10:23 +02001032 t = target_arch[arch].apply(config_target, strict: false)
1033 arch_srcs += t.sources()
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001034 arch_deps += t.dependencies()
Paolo Bonziniabff1ab2020-08-07 12:10:23 +02001035
Paolo Bonzini2becc362020-02-03 11:42:03 +01001036 target_common = common_ss.apply(config_target, strict: false)
1037 objects = common_all.extract_objects(target_common.sources())
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001038 deps = target_common.dependencies()
Paolo Bonzini2becc362020-02-03 11:42:03 +01001039
Paolo Bonzini2becc362020-02-03 11:42:03 +01001040 target_specific = specific_ss.apply(config_target, strict: false)
1041 arch_srcs += target_specific.sources()
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001042 arch_deps += target_specific.dependencies()
Paolo Bonzini2becc362020-02-03 11:42:03 +01001043
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001044 lib = static_library('qemu-' + target,
Paolo Bonzini859aef02020-08-04 18:14:26 +02001045 sources: arch_srcs + genh,
Paolo Bonzinib7612f42020-08-26 08:22:58 +02001046 dependencies: arch_deps,
Paolo Bonzini2becc362020-02-03 11:42:03 +01001047 objects: objects,
1048 include_directories: target_inc,
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001049 c_args: c_args,
1050 build_by_default: false,
Paolo Bonzini2becc362020-02-03 11:42:03 +01001051 name_suffix: 'fa')
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001052
1053 if target.endswith('-softmmu')
1054 execs = [{
1055 'name': 'qemu-system-' + target_name,
1056 'gui': false,
1057 'sources': files('softmmu/main.c'),
1058 'dependencies': []
1059 }]
Paolo Bonzini35be72b2020-02-06 14:17:15 +01001060 if targetos == 'windows' and (sdl.found() or gtk.found())
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001061 execs += [{
1062 'name': 'qemu-system-' + target_name + 'w',
1063 'gui': true,
1064 'sources': files('softmmu/main.c'),
1065 'dependencies': []
1066 }]
1067 endif
1068 if config_host.has_key('CONFIG_FUZZ')
1069 specific_fuzz = specific_fuzz_ss.apply(config_target, strict: false)
1070 execs += [{
1071 'name': 'qemu-fuzz-' + target_name,
1072 'gui': false,
1073 'sources': specific_fuzz.sources(),
1074 'dependencies': specific_fuzz.dependencies(),
1075 'link_depends': [files('tests/qtest/fuzz/fork_fuzz.ld')],
1076 }]
1077 endif
1078 else
1079 execs = [{
1080 'name': 'qemu-' + target_name,
1081 'gui': false,
1082 'sources': [],
1083 'dependencies': []
1084 }]
1085 endif
1086 foreach exe: execs
1087 emulators += executable(exe['name'], exe['sources'],
1088 install: true,
1089 c_args: c_args,
1090 dependencies: arch_deps + deps + exe['dependencies'],
1091 objects: lib.extract_all_objects(recursive: true),
1092 link_language: link_language,
1093 link_depends: [block_syms, qemu_syms] + exe.get('link_depends', []),
1094 link_args: link_args,
1095 gui_app: exe['gui'])
Marc-André Lureau10e1d262019-08-20 12:29:52 +04001096
1097 if 'CONFIG_TRACE_SYSTEMTAP' in config_host
1098 foreach stp: [
Stefan Hajnoczibd5f9732020-08-25 08:49:53 +02001099 {'ext': '.stp-build', 'fmt': 'stap', 'bin': meson.current_build_dir() / exe['name'], 'install': false},
1100 {'ext': '.stp', 'fmt': 'stap', 'bin': get_option('prefix') / get_option('bindir') / exe['name'], 'install': true},
Marc-André Lureau10e1d262019-08-20 12:29:52 +04001101 {'ext': '-simpletrace.stp', 'fmt': 'simpletrace-stap', 'bin': '', 'install': true},
1102 {'ext': '-log.stp', 'fmt': 'log-stap', 'bin': '', 'install': true},
1103 ]
Stefan Hajnoczibd5f9732020-08-25 08:49:53 +02001104 custom_target(exe['name'] + stp['ext'],
Marc-André Lureau10e1d262019-08-20 12:29:52 +04001105 input: trace_events_all,
Stefan Hajnoczibd5f9732020-08-25 08:49:53 +02001106 output: exe['name'] + stp['ext'],
Marc-André Lureau10e1d262019-08-20 12:29:52 +04001107 capture: true,
1108 install: stp['install'],
Marc-André Lureauab4c0992020-08-26 15:04:16 +04001109 install_dir: qemu_datadir / '../systemtap/tapset',
Marc-André Lureau10e1d262019-08-20 12:29:52 +04001110 command: [
1111 tracetool, '--group=all', '--format=' + stp['fmt'],
1112 '--binary=' + stp['bin'],
1113 '--target-name=' + target_name,
1114 '--target-type=' + target_type,
1115 '--probe-prefix=qemu.' + target_type + '.' + target_name,
1116 '@INPUT@',
1117 ])
1118 endforeach
1119 endif
Paolo Bonzini64ed6f92020-08-03 17:04:25 +02001120 endforeach
Paolo Bonzini2becc362020-02-03 11:42:03 +01001121endforeach
1122
Paolo Bonzini931049b2020-02-05 09:44:24 +01001123# Other build targets
Marc-André Lureau897b5af2019-07-16 21:54:15 +04001124
Paolo Bonzinif556b4a2020-01-24 13:08:01 +01001125if 'CONFIG_PLUGIN' in config_host
1126 install_headers('include/qemu/qemu-plugin.h')
1127endif
1128
Paolo Bonzinif15bff22019-07-18 13:19:02 +02001129if 'CONFIG_GUEST_AGENT' in config_host
1130 subdir('qga')
1131endif
1132
Laurent Vivier9755c942020-08-24 17:24:30 +02001133# Don't build qemu-keymap if xkbcommon is not explicitly enabled
1134# when we don't build tools or system
Laurent Vivier4113f4c2020-08-24 17:24:29 +02001135if xkbcommon.found()
Marc-André Lureau28742462019-09-19 20:24:43 +04001136 # used for the update-keymaps target, so include rules even if !have_tools
1137 qemu_keymap = executable('qemu-keymap', files('qemu-keymap.c', 'ui/input-keymap.c') + genh,
1138 dependencies: [qemuutil, xkbcommon], install: have_tools)
1139endif
1140
Philippe Mathieu-Daudé8855e8f2020-08-21 17:05:56 +02001141qemu_block_tools = []
Paolo Bonzini931049b2020-02-05 09:44:24 +01001142if have_tools
Marc-André Lureaub7c70bf2019-07-16 21:37:25 +04001143 qemu_img = executable('qemu-img', [files('qemu-img.c'), hxdep],
1144 dependencies: [authz, block, crypto, io, qom, qemuutil], install: true)
1145 qemu_io = executable('qemu-io', files('qemu-io.c'),
1146 dependencies: [block, qemuutil], install: true)
Daniel P. Berrangéeb705982020-08-25 11:38:50 +01001147 qemu_nbd = executable('qemu-nbd', files('qemu-nbd.c'),
Marc-André Lureaub7c70bf2019-07-16 21:37:25 +04001148 dependencies: [block, qemuutil], install: true)
Marc-André Lureaub7c70bf2019-07-16 21:37:25 +04001149
Paolo Bonzini7c58bb72020-08-04 20:18:36 +02001150 subdir('storage-daemon')
Paolo Bonzinia9c97272019-06-10 12:27:52 +02001151 subdir('contrib/rdmacm-mux')
Marc-André Lureau1d7bb6a2019-07-12 23:47:06 +04001152 subdir('contrib/elf2dmp')
Paolo Bonzinia9c97272019-06-10 12:27:52 +02001153
Marc-André Lureau157e7b12019-07-15 14:50:58 +04001154 executable('qemu-edid', files('qemu-edid.c', 'hw/display/edid-generate.c'),
1155 dependencies: qemuutil,
1156 install: true)
1157
Paolo Bonzini931049b2020-02-05 09:44:24 +01001158 if 'CONFIG_VHOST_USER' in config_host
1159 subdir('contrib/libvhost-user')
Paolo Bonzini2d7ac0a2019-06-10 12:18:02 +02001160 subdir('contrib/vhost-user-blk')
Paolo Bonzinib7612f42020-08-26 08:22:58 +02001161 subdir('contrib/vhost-user-gpu')
Marc-André Lureau32fcc622019-07-12 22:11:20 +04001162 subdir('contrib/vhost-user-input')
Paolo Bonzini99650b62019-06-10 12:21:14 +02001163 subdir('contrib/vhost-user-scsi')
Paolo Bonzini931049b2020-02-05 09:44:24 +01001164 endif
Marc-André Lureau8f51e012019-07-15 14:39:25 +04001165
1166 if targetos == 'linux'
1167 executable('qemu-bridge-helper', files('qemu-bridge-helper.c'),
1168 dependencies: [qemuutil, libcap_ng],
1169 install: true,
1170 install_dir: get_option('libexecdir'))
Marc-André Lureau897b5af2019-07-16 21:54:15 +04001171
1172 executable('qemu-pr-helper', files('scsi/qemu-pr-helper.c', 'scsi/utils.c'),
1173 dependencies: [authz, crypto, io, qom, qemuutil,
1174 libcap_ng, libudev, libmpathpersist],
1175 install: true)
Marc-André Lureau8f51e012019-07-15 14:39:25 +04001176 endif
1177
Marc-André Lureau5ee24e72019-07-12 23:16:54 +04001178 if 'CONFIG_IVSHMEM' in config_host
1179 subdir('contrib/ivshmem-client')
1180 subdir('contrib/ivshmem-server')
1181 endif
Paolo Bonzini931049b2020-02-05 09:44:24 +01001182endif
1183
Marc-André Lureauf5aa6322020-08-26 17:06:18 +04001184subdir('scripts')
Paolo Bonzini3f99cf52020-02-05 09:45:39 +01001185subdir('tools')
Marc-André Lureaubdcbea72019-07-15 21:22:31 +04001186subdir('pc-bios')
Paolo Bonzinice1c1e72020-01-28 16:41:44 +01001187subdir('tests')
Paolo Bonzinif8aa24e2020-08-05 15:49:10 +02001188subdir('docs')
Marc-André Lureaue8f3bd72019-09-19 21:02:09 +04001189if 'CONFIG_GTK' in config_host
1190 subdir('po')
1191endif
Paolo Bonzini3f99cf52020-02-05 09:45:39 +01001192
Paolo Bonziniacfdaac2020-08-05 13:07:48 +02001193if build_docs
1194 makeinfo = find_program('makeinfo', required: build_docs)
1195
1196 docs_inc = [
1197 '-I', meson.current_source_dir(),
1198 '-I', meson.current_build_dir() / 'docs',
1199 '-I', '@OUTDIR@',
1200 ]
1201
1202 version_texi = configure_file(output: 'version.texi',
1203 input: 'version.texi.in',
1204 configuration: {'VERSION': meson.project_version(),
1205 'qemu_confdir': config_host['qemu_confdir']})
1206
1207 texi = {
1208 'qemu-qmp-ref': ['docs/interop/qemu-qmp-ref.texi', qapi_doc_texi, version_texi],
1209 }
1210 if 'CONFIG_GUEST_AGENT' in config_host
1211 texi += {'qemu-ga-ref': ['docs/interop/qemu-ga-ref.texi', qga_qapi_doc_texi, version_texi]}
1212 endif
1213
1214 if makeinfo.found()
1215 cmd = [
1216 'env', 'LC_ALL=C', makeinfo, '--no-split', '--number-sections', docs_inc,
1217 '@INPUT0@', '-o', '@OUTPUT@',
1218 ]
1219 foreach ext, args: {
1220 'info': [],
1221 'html': ['--no-headers', '--html'],
1222 'txt': ['--no-headers', '--plaintext'],
1223 }
1224 t = []
1225 foreach doc, input: texi
1226 output = doc + '.' + ext
1227 t += custom_target(output,
1228 input: input,
1229 output: output,
1230 install: true,
Marc-André Lureau491e74c2020-08-26 15:04:17 +04001231 install_dir: qemu_docdir / 'interop',
Paolo Bonziniacfdaac2020-08-05 13:07:48 +02001232 command: cmd + args)
1233 endforeach
1234 alias_target(ext, t)
1235 endforeach
1236 endif
1237
1238 texi2pdf = find_program('texi2pdf', required: false)
1239
1240 if texi2pdf.found()
1241 pdfs = []
1242 foreach doc, input: texi
1243 output = doc + '.pdf'
1244 pdfs += custom_target(output,
1245 input: input,
1246 output: output,
1247 command: [texi2pdf, '-q', docs_inc, '@INPUT0@', '-o', '@OUTPUT@'],
1248 build_by_default: false)
1249 endforeach
1250 alias_target('pdf', pdfs)
1251 endif
1252
1253 texi2pod = find_program('scripts/texi2pod.pl')
1254 pod2man = find_program('pod2man', required: build_docs)
1255
1256 if pod2man.found()
1257 foreach doc, input: texi
1258 man = doc + '.7'
1259 pod = custom_target(man + '.pod',
1260 input: input,
1261 output: man + '.pod',
1262 command: [texi2pod,
1263 '-DVERSION="' + meson.project_version() + '"',
1264 '-DCONFDIR="' + config_host['qemu_confdir'] + '"',
1265 '@INPUT0@', '@OUTPUT@'])
1266 man = custom_target(man,
1267 input: pod,
1268 output: man,
1269 capture: true,
1270 install: true,
Marc-André Lureaub81efab2020-08-26 15:04:18 +04001271 install_dir: get_option('mandir') / 'man7',
Paolo Bonziniacfdaac2020-08-05 13:07:48 +02001272 command: [pod2man, '--utf8', '--section=7', '--center=" "',
1273 '--release=" "', '@INPUT@'])
1274 endforeach
1275 endif
1276endif
1277
Marc-André Lureau8adfeba2020-08-26 15:04:19 +04001278if host_machine.system() == 'windows'
1279 nsis_cmd = [
1280 find_program('scripts/nsis.py'),
1281 '@OUTPUT@',
1282 get_option('prefix'),
1283 meson.current_source_dir(),
1284 host_machine.cpu_family(),
1285 '--',
1286 '-DDISPLAYVERSION=' + meson.project_version(),
1287 ]
1288 if build_docs
1289 nsis_cmd += '-DCONFIG_DOCUMENTATION=y'
1290 endif
1291 if 'CONFIG_GTK' in config_host
1292 nsis_cmd += '-DCONFIG_GTK=y'
1293 endif
1294
1295 nsis = custom_target('nsis',
1296 output: 'qemu-setup-' + meson.project_version() + '.exe',
1297 input: files('qemu.nsi'),
1298 build_always_stale: true,
1299 command: nsis_cmd + ['@INPUT@'])
1300 alias_target('installer', nsis)
1301endif
1302
Paolo Bonzinif9332752020-02-03 13:28:38 +01001303summary_info = {}
1304summary_info += {'Install prefix': config_host['prefix']}
1305summary_info += {'BIOS directory': config_host['qemu_datadir']}
1306summary_info += {'firmware path': config_host['qemu_firmwarepath']}
1307summary_info += {'binary directory': config_host['bindir']}
1308summary_info += {'library directory': config_host['libdir']}
1309summary_info += {'module directory': config_host['qemu_moddir']}
1310summary_info += {'libexec directory': config_host['libexecdir']}
1311summary_info += {'include directory': config_host['includedir']}
1312summary_info += {'config directory': config_host['sysconfdir']}
1313if targetos != 'windows'
1314 summary_info += {'local state directory': config_host['qemu_localstatedir']}
Marc-André Lureaub81efab2020-08-26 15:04:18 +04001315 summary_info += {'Manual directory': get_option('mandir')}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001316else
1317 summary_info += {'local state directory': 'queried at runtime'}
1318endif
Marc-André Lureau491e74c2020-08-26 15:04:17 +04001319summary_info += {'Doc directory': get_option('docdir')}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001320summary_info += {'Build directory': meson.current_build_dir()}
1321summary_info += {'Source path': meson.current_source_dir()}
1322summary_info += {'GIT binary': config_host['GIT']}
1323summary_info += {'GIT submodules': config_host['GIT_SUBMODULES']}
1324summary_info += {'C compiler': meson.get_compiler('c').cmd_array()[0]}
1325summary_info += {'Host C compiler': meson.get_compiler('c', native: true).cmd_array()[0]}
1326if link_language == 'cpp'
1327 summary_info += {'C++ compiler': meson.get_compiler('cpp').cmd_array()[0]}
1328else
1329 summary_info += {'C++ compiler': false}
1330endif
1331if targetos == 'darwin'
1332 summary_info += {'Objective-C compiler': meson.get_compiler('objc').cmd_array()[0]}
1333endif
1334summary_info += {'ARFLAGS': config_host['ARFLAGS']}
1335summary_info += {'CFLAGS': config_host['CFLAGS']}
1336summary_info += {'QEMU_CFLAGS': config_host['QEMU_CFLAGS']}
1337summary_info += {'QEMU_LDFLAGS': config_host['QEMU_LDFLAGS']}
1338summary_info += {'make': config_host['MAKE']}
1339summary_info += {'install': config_host['INSTALL']}
1340summary_info += {'python': '@0@ (version: @1@)'.format(python.full_path(), python.language_version())}
1341summary_info += {'sphinx-build': config_host['SPHINX_BUILD']}
1342summary_info += {'genisoimage': config_host['GENISOIMAGE']}
1343# TODO: add back version
1344summary_info += {'slirp support': config_host.has_key('CONFIG_SLIRP')}
1345if config_host.has_key('CONFIG_SLIRP')
1346 summary_info += {'smbd': config_host['CONFIG_SMBD_COMMAND']}
1347endif
1348summary_info += {'module support': config_host.has_key('CONFIG_MODULES')}
1349if config_host.has_key('CONFIG_MODULES')
1350 summary_info += {'alternative module path': config_host.has_key('CONFIG_MODULE_UPGRADES')}
1351endif
1352summary_info += {'host CPU': cpu}
1353summary_info += {'host endianness': build_machine.endian()}
1354summary_info += {'target list': config_host['TARGET_DIRS']}
1355summary_info += {'gprof enabled': config_host.has_key('CONFIG_GPROF')}
1356summary_info += {'sparse enabled': meson.get_compiler('c').cmd_array().contains('cgcc')}
1357summary_info += {'strip binaries': get_option('strip')}
1358summary_info += {'profiler': config_host.has_key('CONFIG_PROFILER')}
1359summary_info += {'static build': config_host.has_key('CONFIG_TOOLS')}
1360if targetos == 'darwin'
1361 summary_info += {'Cocoa support': config_host.has_key('CONFIG_COCOA')}
1362endif
1363# TODO: add back version
Paolo Bonzini35be72b2020-02-06 14:17:15 +01001364summary_info += {'SDL support': sdl.found()}
1365summary_info += {'SDL image support': sdl_image.found()}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001366# TODO: add back version
1367summary_info += {'GTK support': config_host.has_key('CONFIG_GTK')}
1368summary_info += {'GTK GL support': config_host.has_key('CONFIG_GTK_GL')}
Paolo Bonzinib7612f42020-08-26 08:22:58 +02001369summary_info += {'pixman': pixman.found()}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001370# TODO: add back version
1371summary_info += {'VTE support': config_host.has_key('CONFIG_VTE')}
1372summary_info += {'TLS priority': config_host['CONFIG_TLS_PRIORITY']}
1373summary_info += {'GNUTLS support': config_host.has_key('CONFIG_GNUTLS')}
1374# TODO: add back version
1375summary_info += {'libgcrypt': config_host.has_key('CONFIG_GCRYPT')}
1376if config_host.has_key('CONFIG_GCRYPT')
1377 summary_info += {' hmac': config_host.has_key('CONFIG_GCRYPT_HMAC')}
1378 summary_info += {' XTS': not config_host.has_key('CONFIG_QEMU_PRIVATE_XTS')}
1379endif
1380# TODO: add back version
1381summary_info += {'nettle': config_host.has_key('CONFIG_NETTLE')}
1382if config_host.has_key('CONFIG_NETTLE')
1383 summary_info += {' XTS': not config_host.has_key('CONFIG_QEMU_PRIVATE_XTS')}
1384endif
1385summary_info += {'libtasn1': config_host.has_key('CONFIG_TASN1')}
1386summary_info += {'PAM': config_host.has_key('CONFIG_AUTH_PAM')}
1387summary_info += {'iconv support': config_host.has_key('CONFIG_ICONV')}
1388summary_info += {'curses support': config_host.has_key('CONFIG_CURSES')}
1389# TODO: add back version
1390summary_info += {'virgl support': config_host.has_key('CONFIG_VIRGL')}
1391summary_info += {'curl support': config_host.has_key('CONFIG_CURL')}
1392summary_info += {'mingw32 support': targetos == 'windows'}
1393summary_info += {'Audio drivers': config_host['CONFIG_AUDIO_DRIVERS']}
1394summary_info += {'Block whitelist (rw)': config_host['CONFIG_BDRV_RW_WHITELIST']}
1395summary_info += {'Block whitelist (ro)': config_host['CONFIG_BDRV_RO_WHITELIST']}
1396summary_info += {'VirtFS support': config_host.has_key('CONFIG_VIRTFS')}
1397summary_info += {'Multipath support': config_host.has_key('CONFIG_MPATH')}
Paolo Bonzinia0b93232020-02-06 15:48:52 +01001398summary_info += {'VNC support': vnc.found()}
1399if vnc.found()
1400 summary_info += {'VNC SASL support': sasl.found()}
1401 summary_info += {'VNC JPEG support': jpeg.found()}
1402 summary_info += {'VNC PNG support': png.found()}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001403endif
1404summary_info += {'xen support': config_host.has_key('CONFIG_XEN_BACKEND')}
1405if config_host.has_key('CONFIG_XEN_BACKEND')
1406 summary_info += {'xen ctrl version': config_host['CONFIG_XEN_CTRL_INTERFACE_VERSION']}
1407endif
1408summary_info += {'brlapi support': config_host.has_key('CONFIG_BRLAPI')}
1409summary_info += {'Documentation': config_host.has_key('BUILD_DOCS')}
1410summary_info += {'PIE': get_option('b_pie')}
1411summary_info += {'vde support': config_host.has_key('CONFIG_VDE')}
1412summary_info += {'netmap support': config_host.has_key('CONFIG_NETMAP')}
1413summary_info += {'Linux AIO support': config_host.has_key('CONFIG_LINUX_AIO')}
1414summary_info += {'Linux io_uring support': config_host.has_key('CONFIG_LINUX_IO_URING')}
1415summary_info += {'ATTR/XATTR support': config_host.has_key('CONFIG_ATTR')}
1416summary_info += {'Install blobs': config_host.has_key('INSTALL_BLOBS')}
1417# TODO: add back KVM/HAX/HVF/WHPX/TCG
1418#summary_info += {'KVM support': have_kvm'}
1419#summary_info += {'HAX support': have_hax'}
1420#summary_info += {'HVF support': have_hvf'}
1421#summary_info += {'WHPX support': have_whpx'}
1422#summary_info += {'TCG support': have_tcg'}
1423#if get_option('tcg')
1424# summary_info += {'TCG debug enabled': config_host.has_key('CONFIG_DEBUG_TCG')}
1425# summary_info += {'TCG interpreter': config_host.has_key('CONFIG_TCG_INTERPRETER')}
1426#endif
1427summary_info += {'malloc trim support': config_host.has_key('CONFIG_MALLOC_TRIM')}
1428summary_info += {'RDMA support': config_host.has_key('CONFIG_RDMA')}
1429summary_info += {'PVRDMA support': config_host.has_key('CONFIG_PVRDMA')}
1430summary_info += {'fdt support': config_host.has_key('CONFIG_FDT')}
1431summary_info += {'membarrier': config_host.has_key('CONFIG_MEMBARRIER')}
1432summary_info += {'preadv support': config_host.has_key('CONFIG_PREADV')}
1433summary_info += {'fdatasync': config_host.has_key('CONFIG_FDATASYNC')}
1434summary_info += {'madvise': config_host.has_key('CONFIG_MADVISE')}
1435summary_info += {'posix_madvise': config_host.has_key('CONFIG_POSIX_MADVISE')}
1436summary_info += {'posix_memalign': config_host.has_key('CONFIG_POSIX_MEMALIGN')}
1437summary_info += {'libcap-ng support': config_host.has_key('CONFIG_LIBCAP_NG')}
1438summary_info += {'vhost-net support': config_host.has_key('CONFIG_VHOST_NET')}
1439summary_info += {'vhost-crypto support': config_host.has_key('CONFIG_VHOST_CRYPTO')}
1440summary_info += {'vhost-scsi support': config_host.has_key('CONFIG_VHOST_SCSI')}
1441summary_info += {'vhost-vsock support': config_host.has_key('CONFIG_VHOST_VSOCK')}
1442summary_info += {'vhost-user support': config_host.has_key('CONFIG_VHOST_KERNEL')}
1443summary_info += {'vhost-user-fs support': config_host.has_key('CONFIG_VHOST_USER_FS')}
1444summary_info += {'vhost-vdpa support': config_host.has_key('CONFIG_VHOST_VDPA')}
1445summary_info += {'Trace backends': config_host['TRACE_BACKENDS']}
1446if config_host['TRACE_BACKENDS'].split().contains('simple')
1447 summary_info += {'Trace output file': config_host['CONFIG_TRACE_FILE'] + '-<pid>'}
1448endif
1449# TODO: add back protocol and server version
1450summary_info += {'spice support': config_host.has_key('CONFIG_SPICE')}
1451summary_info += {'rbd support': config_host.has_key('CONFIG_RBD')}
1452summary_info += {'xfsctl support': config_host.has_key('CONFIG_XFS')}
1453summary_info += {'smartcard support': config_host.has_key('CONFIG_SMARTCARD')}
César Belley0a40bcb2020-08-26 13:42:04 +02001454summary_info += {'U2F support': u2f.found()}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001455summary_info += {'libusb': config_host.has_key('CONFIG_USB_LIBUSB')}
1456summary_info += {'usb net redir': config_host.has_key('CONFIG_USB_REDIR')}
1457summary_info += {'OpenGL support': config_host.has_key('CONFIG_OPENGL')}
1458summary_info += {'OpenGL dmabufs': config_host.has_key('CONFIG_OPENGL_DMABUF')}
1459summary_info += {'libiscsi support': config_host.has_key('CONFIG_LIBISCSI')}
1460summary_info += {'libnfs support': config_host.has_key('CONFIG_LIBNFS')}
1461summary_info += {'build guest agent': config_host.has_key('CONFIG_GUEST_AGENT')}
1462if targetos == 'windows'
1463 if 'WIN_SDK' in config_host
1464 summary_info += {'Windows SDK': config_host['WIN_SDK']}
1465 endif
1466 summary_info += {'QGA VSS support': config_host.has_key('CONFIG_QGA_VSS')}
1467 summary_info += {'QGA w32 disk info': config_host.has_key('CONFIG_QGA_NTDDSCSI')}
1468 summary_info += {'QGA MSI support': config_host.has_key('CONFIG_QGA_MSI_ENABLED')}
1469endif
1470summary_info += {'seccomp support': config_host.has_key('CONFIG_SECCOMP')}
1471summary_info += {'coroutine backend': config_host['CONFIG_COROUTINE_BACKEND']}
1472summary_info += {'coroutine pool': config_host['CONFIG_COROUTINE_POOL'] == '1'}
1473summary_info += {'debug stack usage': config_host.has_key('CONFIG_DEBUG_STACK_USAGE')}
1474summary_info += {'mutex debugging': config_host.has_key('CONFIG_DEBUG_MUTEX')}
1475summary_info += {'crypto afalg': config_host.has_key('CONFIG_AF_ALG')}
1476summary_info += {'GlusterFS support': config_host.has_key('CONFIG_GLUSTERFS')}
Marc-André Lureaubf0e56a2019-10-04 17:35:16 +04001477summary_info += {'gcov': get_option('b_coverage')}
Paolo Bonzinif9332752020-02-03 13:28:38 +01001478summary_info += {'TPM support': config_host.has_key('CONFIG_TPM')}
1479summary_info += {'libssh support': config_host.has_key('CONFIG_LIBSSH')}
1480summary_info += {'QOM debugging': config_host.has_key('CONFIG_QOM_CAST_DEBUG')}
1481summary_info += {'Live block migration': config_host.has_key('CONFIG_LIVE_BLOCK_MIGRATION')}
1482summary_info += {'lzo support': config_host.has_key('CONFIG_LZO')}
1483summary_info += {'snappy support': config_host.has_key('CONFIG_SNAPPY')}
1484summary_info += {'bzip2 support': config_host.has_key('CONFIG_BZIP2')}
1485summary_info += {'lzfse support': config_host.has_key('CONFIG_LZFSE')}
1486summary_info += {'zstd support': config_host.has_key('CONFIG_ZSTD')}
1487summary_info += {'NUMA host support': config_host.has_key('CONFIG_NUMA')}
1488summary_info += {'libxml2': config_host.has_key('CONFIG_LIBXML2')}
1489summary_info += {'tcmalloc support': config_host.has_key('CONFIG_TCMALLOC')}
1490summary_info += {'jemalloc support': config_host.has_key('CONFIG_JEMALLOC')}
1491summary_info += {'avx2 optimization': config_host.has_key('CONFIG_AVX2_OPT')}
1492summary_info += {'avx512f optimization': config_host.has_key('CONFIG_AVX512F_OPT')}
1493summary_info += {'replication support': config_host.has_key('CONFIG_REPLICATION')}
1494summary_info += {'bochs support': config_host.has_key('CONFIG_BOCHS')}
1495summary_info += {'cloop support': config_host.has_key('CONFIG_CLOOP')}
1496summary_info += {'dmg support': config_host.has_key('CONFIG_DMG')}
1497summary_info += {'qcow v1 support': config_host.has_key('CONFIG_QCOW1')}
1498summary_info += {'vdi support': config_host.has_key('CONFIG_VDI')}
1499summary_info += {'vvfat support': config_host.has_key('CONFIG_VVFAT')}
1500summary_info += {'qed support': config_host.has_key('CONFIG_QED')}
1501summary_info += {'parallels support': config_host.has_key('CONFIG_PARALLELS')}
1502summary_info += {'sheepdog support': config_host.has_key('CONFIG_SHEEPDOG')}
1503summary_info += {'capstone': config_host.has_key('CONFIG_CAPSTONE')}
1504summary_info += {'libpmem support': config_host.has_key('CONFIG_LIBPMEM')}
1505summary_info += {'libdaxctl support': config_host.has_key('CONFIG_LIBDAXCTL')}
1506summary_info += {'libudev': config_host.has_key('CONFIG_LIBUDEV')}
1507summary_info += {'default devices': config_host['CONFIG_MINIKCONF_MODE'] == '--defconfig'}
1508summary_info += {'plugin support': config_host.has_key('CONFIG_PLUGIN')}
1509summary_info += {'fuzzing support': config_host.has_key('CONFIG_FUZZ')}
1510if config_host.has_key('HAVE_GDB_BIN')
1511 summary_info += {'gdb': config_host['HAVE_GDB_BIN']}
1512endif
1513summary_info += {'thread sanitizer': config_host.has_key('CONFIG_TSAN')}
1514summary_info += {'rng-none': config_host.has_key('CONFIG_RNG_NONE')}
1515summary_info += {'Linux keyring': config_host.has_key('CONFIG_SECRET_KEYRING')}
1516summary(summary_info, bool_yn: true)
1517
1518if not supported_cpus.contains(cpu)
1519 message()
1520 warning('SUPPORT FOR THIS HOST CPU WILL GO AWAY IN FUTURE RELEASES!')
1521 message()
1522 message('CPU host architecture ' + cpu + ' support is not currently maintained.')
1523 message('The QEMU project intends to remove support for this host CPU in')
1524 message('a future release if nobody volunteers to maintain it and to')
1525 message('provide a build host for our continuous integration setup.')
1526 message('configure has succeeded and you can continue to build, but')
1527 message('if you care about QEMU on this platform you should contact')
1528 message('us upstream at qemu-devel@nongnu.org.')
1529endif
1530
1531if not supported_oses.contains(targetos)
1532 message()
1533 warning('WARNING: SUPPORT FOR THIS HOST OS WILL GO AWAY IN FUTURE RELEASES!')
1534 message()
1535 message('Host OS ' + targetos + 'support is not currently maintained.')
1536 message('The QEMU project intends to remove support for this host OS in')
1537 message('a future release if nobody volunteers to maintain it and to')
1538 message('provide a build host for our continuous integration setup.')
1539 message('configure has succeeded and you can continue to build, but')
1540 message('if you care about QEMU on this platform you should contact')
1541 message('us upstream at qemu-devel@nongnu.org.')
1542endif