aboutsummaryrefslogtreecommitdiff
path: root/meson.build
blob: 561128f116ccc728e98cc43ef8607befd4f411cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
project('wlroots', 'c',
    license: 'MIT',
    default_options: 'c_std=c11')

add_project_arguments('-Wall', '-Wextra', '-Wno-unused-parameter', '-Werror', language: 'c')
add_project_arguments('-DWLR_SRC_DIR="@0@"'.format(meson.source_root()), language: 'c')
add_project_arguments('-I@0@/include'.format(meson.source_root()), language: 'c')

#add_project_arguments('-flto', language: 'c')
#add_project_link_arguments('-flto', language: 'c')

cc = meson.get_compiler('c')

# Clang complains about some zeroed initialiser lists (= {0}), even though they are valid
if cc.get_id() == 'clang'
    add_project_arguments('-Wno-missing-field-initializers', language: 'c')
    add_project_arguments('-Wno-missing-braces', language: 'c')
endif

dep_wayland_server = dependency('wayland-server')
dep_wayland_client = dependency('wayland-client')
dep_wayland_egl    = dependency('wayland-egl')
dep_wayland_proto  = dependency('wayland-protocols')
dep_egl            = dependency('egl')
dep_glesv2         = dependency('glesv2')
dep_drm            = dependency('libdrm')
dep_gbm            = dependency('gbm')
dep_libinput       = dependency('libinput')
dep_xkbcommon      = dependency('xkbcommon')
dep_udev           = dependency('libudev')
dep_libcap         = dependency('libcap', required: false)
dep_systemd        = dependency('libsystemd', required: false)
dep_math           = cc.find_library('m', required: false)

all_deps = [
    dep_wayland_server,
    dep_wayland_client,
    dep_wayland_egl,
    dep_wayland_proto,
    dep_egl,
    dep_glesv2,
    dep_drm,
    dep_gbm,
    dep_libinput,
    dep_xkbcommon,
    dep_udev,
    dep_libcap,
    dep_systemd,
    dep_math,
]

wlr_src = [
    'backend/wayland/backend.c',
    'backend/wayland/registry.c',
    'backend/wayland/wl_seat.c',
    'backend/wayland/output.c',
    'backend/drm/backend.c',
    'backend/drm/drm.c',
    'backend/backend.c',
    'backend/libinput/backend.c',
    'backend/libinput/events.c',
    'backend/libinput/keyboard.c',
    'backend/libinput/pointer.c',
    'backend/libinput/tablet_pad.c',
    'backend/libinput/tablet_tool.c',
    'backend/libinput/touch.c',
    'backend/multi/backend.c',
    'backend/udev.c',
    'backend/egl.c',
    'session/direct-ipc.c',
    'session/direct.c',
    'session/session.c',
    'types/wlr_input_device.c',
    'types/wlr_keyboard.c',
    'types/wlr_pointer.c',
    'types/wlr_tablet_pad.c',
    'types/wlr_tablet_tool.c',
    'types/wlr_touch.c',
    'types/wlr_output.c',
    'render/matrix.c',
    'render/gles2/pixel_format.c',
    'render/gles2/renderer.c',
    'render/gles2/shaders.c',
    'render/gles2/surface.c',
    'render/gles2/util.c',
    'render/wlr_renderer.c',
    'render/wlr_surface.c',
    'util/list.c',
    'util/log.c',
]

if dep_libcap.found()
    add_project_arguments('-DHAS_LIBCAP', language: 'c')
endif

if dep_systemd.found()
    wlr_src = wlr_src + ['session/logind.c']
    add_project_arguments('-DHAS_SYSTEMD', language: 'c')
endif

lib_wlr = library('wlroots', wlr_src,
    dependencies: all_deps)
dep_wlr = declare_dependency(link_with: lib_wlr,
    dependencies: all_deps)

lib_shared = static_library('shared',
    ['examples/shared.c', 'examples/cat.c'],
    dependencies: dep_wlr)

all_libs = [
    lib_shared,
    lib_wlr,
]

executable('simple', 'examples/simple.c', link_with: all_libs)
executable('rotation', 'examples/rotation.c', link_with: all_libs)
executable('pointer', 'examples/pointer.c', link_with: all_libs)
executable('touch', 'examples/touch.c', link_with: all_libs)
executable('tablet', 'examples/tablet.c', link_with: all_libs)

compositor_src = [
    'examples/compositor/main.c',
    'examples/compositor/wl_compositor.c',
    'examples/compositor/wl_shell.c',
]

executable('compositor', compositor_src, link_with: all_libs)