xref: /openbmc/qemu/ui/meson.build (revision afb81fe8)
1system_ss.add(pixman)
2specific_ss.add(when: ['CONFIG_SYSTEM_ONLY'], if_true: pixman)   # for the include path
3specific_ss.add(when: ['CONFIG_SYSTEM_ONLY'], if_true: opengl)   # for the include path
4
5system_ss.add(png)
6system_ss.add(files(
7  'clipboard.c',
8  'console.c',
9  'console-vc.c',
10  'cursor.c',
11  'input-keymap.c',
12  'input-legacy.c',
13  'input-barrier.c',
14  'input.c',
15  'kbd-state.c',
16  'keymaps.c',
17  'qemu-pixman.c',
18  'ui-hmp-cmds.c',
19  'ui-qmp-cmds.c',
20  'util.c',
21))
22if dbus_display
23  system_ss.add(files('dbus-module.c'))
24endif
25system_ss.add([spice_headers, files('spice-module.c')])
26system_ss.add(when: spice_protocol, if_true: files('vdagent.c'))
27
28system_ss.add(when: 'CONFIG_LINUX', if_true: files(
29  'input-linux.c',
30  'udmabuf.c',
31))
32system_ss.add(when: cocoa, if_true: files('cocoa.m'))
33
34vnc_ss = ss.source_set()
35vnc_ss.add(files(
36  'vnc.c',
37  'vnc-enc-zlib.c',
38  'vnc-enc-hextile.c',
39  'vnc-enc-tight.c',
40  'vnc-palette.c',
41  'vnc-enc-zrle.c',
42  'vnc-auth-vencrypt.c',
43  'vnc-ws.c',
44  'vnc-jobs.c',
45  'vnc-clipboard.c',
46))
47vnc_ss.add(zlib, jpeg, gnutls)
48vnc_ss.add(when: sasl, if_true: files('vnc-auth-sasl.c'))
49system_ss.add_all(when: vnc, if_true: vnc_ss)
50system_ss.add(when: vnc, if_false: files('vnc-stubs.c'))
51
52ui_modules = {}
53
54if curses.found()
55  curses_ss = ss.source_set()
56  curses_ss.add(when: [curses, iconv], if_true: [files('curses.c'), pixman])
57  ui_modules += {'curses' : curses_ss}
58endif
59
60system_ss.add(opengl)
61if opengl.found()
62  opengl_ss = ss.source_set()
63  opengl_ss.add(gbm)
64  opengl_ss.add(when: [opengl, pixman],
65               if_true: files('shader.c', 'console-gl.c', 'egl-helpers.c', 'egl-context.c'))
66  ui_modules += {'opengl' : opengl_ss}
67endif
68
69if opengl.found()
70  egl_headless_ss = ss.source_set()
71  egl_headless_ss.add(when: [opengl, pixman],
72                      if_true: [files('egl-headless.c'), gbm])
73  ui_modules += {'egl-headless' : egl_headless_ss}
74endif
75
76if dbus_display
77  dbus_ss = ss.source_set()
78  env = environment()
79  env.set('TARGETOS', targetos)
80  xml = custom_target('dbus-display preprocess',
81                      input: 'dbus-display1.xml',
82                      output: 'dbus-display1.xml',
83                      env: env,
84                      command: [xml_pp, '@INPUT@', '@OUTPUT@'])
85  dbus_display1 = custom_target('dbus-display gdbus-codegen',
86                                output: ['dbus-display1.h', 'dbus-display1.c'],
87                                input: xml,
88                                command: [gdbus_codegen, '@INPUT@',
89                                          '--glib-min-required', '2.64',
90                                          '--output-directory', meson.current_build_dir(),
91                                          '--interface-prefix', 'org.qemu.',
92                                          '--c-namespace', 'QemuDBus',
93                                          '--generate-c-code', '@BASENAME@'])
94  dbus_display1_lib = static_library('dbus-display1', dbus_display1, dependencies: gio)
95  dbus_display1_dep = declare_dependency(link_with: dbus_display1_lib, include_directories: include_directories('.'))
96  dbus_ss.add(when: [gio, pixman, dbus_display1_dep],
97              if_true: [files(
98                'dbus-chardev.c',
99                'dbus-clipboard.c',
100                'dbus-console.c',
101                'dbus-error.c',
102                'dbus-listener.c',
103                'dbus.c',
104              ), opengl, gbm])
105  ui_modules += {'dbus' : dbus_ss}
106endif
107
108if gtk.found()
109  system_ss.add(when: 'CONFIG_WIN32', if_true: files('win32-kbd-hook.c'))
110
111  gtk_ss = ss.source_set()
112  gtk_ss.add(gtk, vte, pixman, files('gtk.c'))
113  if have_gtk_clipboard
114    gtk_ss.add(files('gtk-clipboard.c'))
115  endif
116  gtk_ss.add(when: x11, if_true: files('x_keymap.c'))
117  gtk_ss.add(when: opengl, if_true: files('gtk-gl-area.c'))
118  gtk_ss.add(when: [x11, opengl], if_true: files('gtk-egl.c'))
119  ui_modules += {'gtk' : gtk_ss}
120endif
121
122if sdl.found()
123  system_ss.add(when: 'CONFIG_WIN32', if_true: files('win32-kbd-hook.c'))
124
125  sdl_ss = ss.source_set()
126  sdl_ss.add(sdl, sdl_image, pixman, glib, files(
127    'sdl2-2d.c',
128    'sdl2-input.c',
129    'sdl2.c',
130  ))
131  sdl_ss.add(when: opengl, if_true: files('sdl2-gl.c'))
132  sdl_ss.add(when: x11, if_true: files('x_keymap.c'))
133  ui_modules += {'sdl' : sdl_ss}
134endif
135
136if spice.found()
137  spice_core_ss = ss.source_set()
138  spice_core_ss.add(spice, pixman, files(
139    'spice-core.c',
140    'spice-input.c',
141    'spice-display.c'
142  ))
143  ui_modules += {'spice-core' : spice_core_ss}
144endif
145
146if spice.found() and gio.found()
147  spice_ss = ss.source_set()
148  spice_ss.add(spice, gio, pixman, files('spice-app.c'))
149  ui_modules += {'spice-app': spice_ss}
150endif
151
152keymaps = [
153  ['atset1', 'qcode'],
154  ['linux', 'qcode'],
155  ['qcode', 'atset1'],
156  ['qcode', 'atset2'],
157  ['qcode', 'atset3'],
158  ['qcode', 'linux'],
159  ['qcode', 'qnum'],
160  ['qcode', 'sun'],
161  ['qnum', 'qcode'],
162  ['usb', 'qcode'],
163  ['win32', 'qcode'],
164  ['x11', 'qcode'],
165  ['xorgevdev', 'qcode'],
166  ['xorgkbd', 'qcode'],
167  ['xorgxquartz', 'qcode'],
168  ['xorgxwin', 'qcode'],
169  ['osx', 'qcode'],
170]
171
172if have_system or xkbcommon.found()
173  keycodemapdb_proj = subproject('keycodemapdb', required: true)
174  foreach e : keymaps
175    output = 'input-keymap-@0@-to-@1@.c.inc'.format(e[0], e[1])
176    genh += custom_target(output,
177                  output: output,
178                  capture: true,
179                  input: keycodemapdb_proj.get_variable('keymaps_csv'),
180                  command: [python, keycodemapdb_proj.get_variable('keymap_gen').full_path(),
181                            'code-map', '--lang', 'glib2',
182                            '--varname', 'qemu_input_map_@0@_to_@1@'.format(e[0], e[1]),
183                            '@INPUT0@', e[0], e[1]])
184  endforeach
185endif
186
187subdir('shader')
188
189if have_system
190  subdir('icons')
191
192  install_data('qemu.desktop', install_dir: qemu_desktopdir)
193endif
194
195modules += {'ui': ui_modules}
196