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