main
meson.build
1project('swc', 'c',
2 version: '0.0',
3 meson_version: '>=1.7.99',
4 license: 'MIT',
5 default_options: [
6 'c_std=c11',
7 'warning_level=1',
8 'default_library=both',
9 ],
10)
11
12cc = meson.get_compiler('c')
13os = host_machine.system()
14pkg = import('pkgconfig')
15wl = import('wayland')
16
17add_project_arguments(cc.get_supported_arguments([
18 '-fvisibility=hidden',
19
20 '-Werror=implicit-function-declaration',
21 '-Werror=implicit-int',
22 '-Werror=pointer-sign',
23 '-Werror=pointer-arith',
24 '-Wno-missing-braces',
25]) + [
26 '-D_GNU_SOURCE', # Required for mkostemp
27 get_option('buildtype').startswith('debug') ? '-DENABLE_DEBUG=1' : [],
28], language: 'c')
29
30requires = [
31 dependency('wayland-server', version: '>=1.6.0'),
32]
33requires_private = [
34 dependency('libdrm'),
35 dependency('pixman-1'),
36 dependency('wayland-protocols'),
37 dependency('wld'),
38 dependency('xkbcommon'),
39]
40
41xwayland = dependency('xwayland', required: get_option('xwayland'))
42xwayland_deps = [
43 'xcb',
44 'xcb-composite',
45 'xcb-ewmh',
46 'xcb-icccm',
47]
48if xwayland.found()
49 add_project_arguments('-DENABLE_XWAYLAND', language: 'c')
50 requires_private += xwayland
51 foreach dep : xwayland_deps
52 requires_private += dependency(dep, required: xwayland.found())
53 endforeach
54endif
55
56input_backend = get_option('input')
57libinput = dependency('libinput', version: '>=0.4', required: input_backend == 'libinput')
58
59if input_backend == 'auto'
60 if os == 'linux'
61 input_backend = libinput.found() ? 'libinput' : 'evdev'
62 elif os == 'netbsd'
63 input_backend = 'wscons'
64 else
65 error('Failed to determine input backend for ' + os)
66 endif
67endif
68
69if input_backend == 'libinput'
70 udev = dependency('libudev', required: get_option('udev'))
71 if udev.found()
72 add_project_arguments('-DENABLE_LIBUDEV', language: 'c')
73 endif
74 requires_private += [libinput, udev]
75elif input_backend == 'evdev'
76 add_project_arguments([
77 '-DEVDEV_KBD_DEVICE="@0@"'.format(get_option('evdev-keyboard')),
78 '-DEVDEV_POINTER_DEVICE="@0@"'.format(get_option('evdev-pointer')),
79 ], language: 'c')
80endif
81
82subdir('protocol')
83subdir('cursor')
84subdir('launch')
85subdir('libswc')
86
87if get_option('extra')
88 subdir('extra')
89endif
90
91if get_option('example')
92 subdir('example')
93endif
94
95summary({
96 'Xwayland support': xwayland.found(),
97 'Input backend': input_backend,
98}, bool_yn: true)