summaryrefslogtreecommitdiff
path: root/libweston/meson.build
blob: 005be947c9f4c55232559be9e78c85989feca5f1 (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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
deps_libweston = [
	dep_wayland_server,
	dep_pixman,
	dep_libm,
	dep_libdl,
	dep_libdrm_headers,
	dep_xkbcommon,
]
srcs_libweston = [
	git_version_h,
	'animation.c',
	'bindings.c',
	'clipboard.c',
	'compositor.c',
	'content-protection.c',
	'data-device.c',
	'input.c',
	'linux-dmabuf.c',
	'linux-explicit-synchronization.c',
	'linux-sync-file.c',
	'log.c',
	'noop-renderer.c',
	'pixel-formats.c',
	'pixman-renderer.c',
	'plugin-registry.c',
	'screenshooter.c',
	'timeline.c',
	'touch-calibration.c',
	'weston-log-wayland.c',
	'weston-log-file.c',
	'weston-log.c',
	'zoom.c',
	'../shared/matrix.c',
	linux_dmabuf_unstable_v1_protocol_c,
	linux_dmabuf_unstable_v1_server_protocol_h,
	linux_explicit_synchronization_unstable_v1_protocol_c,
	linux_explicit_synchronization_unstable_v1_server_protocol_h,
	input_method_unstable_v1_protocol_c,
	input_method_unstable_v1_server_protocol_h,
	input_timestamps_unstable_v1_protocol_c,
	input_timestamps_unstable_v1_server_protocol_h,
	presentation_time_protocol_c,
	presentation_time_server_protocol_h,
	pointer_constraints_unstable_v1_protocol_c,
	pointer_constraints_unstable_v1_server_protocol_h,
	relative_pointer_unstable_v1_protocol_c,
	relative_pointer_unstable_v1_server_protocol_h,
	weston_screenshooter_protocol_c,
	weston_screenshooter_server_protocol_h,
	text_cursor_position_protocol_c,
	text_cursor_position_server_protocol_h,
	text_input_unstable_v1_protocol_c,
	text_input_unstable_v1_server_protocol_h,
	weston_touch_calibration_protocol_c,
	weston_touch_calibration_server_protocol_h,
	weston_content_protection_protocol_c,
	weston_content_protection_server_protocol_h,
	viewporter_protocol_c,
	viewporter_server_protocol_h,
	xdg_output_unstable_v1_protocol_c,
	xdg_output_unstable_v1_server_protocol_h,
	weston_debug_protocol_c,
	weston_debug_server_protocol_h,
]

if get_option('renderer-gl')
	dep_egl = dependency('egl', required: false)
	if not dep_egl.found()
		error('libweston + gl-renderer requires egl which was not found. Or, you can use \'-Drenderer-gl=false\'.')
	endif
	deps_libweston += dep_egl
endif

lib_weston = shared_library(
	'weston-@0@'.format(libweston_major),
	srcs_libweston,
	include_directories: [ include_directories('..', '../shared'), public_inc ],
	install: true,
	version: '0.0.@0@'.format(libweston_revision),
	link_whole: lib_libshared,
	dependencies: deps_libweston
)

dep_libweston = declare_dependency(
	link_with: lib_weston,
	include_directories: [ include_directories('.'), public_inc ],
	dependencies: deps_libweston
)

# XXX: We should be able to use dep_libweston.partial_dependency() instead
# of this, but a Meson bug makes it not work. It will be fixed with
# https://github.com/mesonbuild/meson/pull/5167
# in hopefully Meson 0.51.
dep_libweston_h = declare_dependency(
	include_directories: [ include_directories('.'), public_inc ],
	dependencies: [
		dep_pixman.partial_dependency(compile_args: true),
		dep_xkbcommon.partial_dependency(compile_args: true),
		dep_wayland_server.partial_dependency(compile_args: true)
	]
)

pkgconfig.generate(
	lib_weston,
	filebase: 'libweston-@0@'.format(libweston_major),
	name: 'libweston API',
	version: version_weston,
	description: 'Header files for libweston compositors development',
	requires_private: [ dep_wayland_server, dep_pixman, dep_xkbcommon ],
	subdirs: dir_include_libweston
)

pkgconfig.generate(
	filebase: 'libweston-@0@-protocols'.format(libweston_major),
	name: 'libWeston Protocols',
	version: version_weston,
	description: 'libWeston protocol files',
	variables: [
		'datarootdir=' + join_paths('${prefix}', get_option('datadir')),
		'pkgdatadir=' + join_paths('${pc_sysrootdir}${datarootdir}', dir_protocol_libweston)
	],
	install_dir: dir_data_pc
)

srcs_session_helper = [
	'launcher-direct.c',
	'launcher-util.c',
	'launcher-weston-launch.c',
]
deps_session_helper = [ dep_libweston_h ]

if get_option('backend-drm')
	deps_session_helper += dep_libdrm
endif

systemd_dep = dependency('', required: false)
if get_option('launcher-logind')
	systemd_dep = dependency('libsystemd', version: '>= 209', required: false)
	if systemd_dep.found()
		config_h.set('HAVE_SYSTEMD_LOGIN_209', '1')
	else
		systemd_dep = dependency('libsystemd-login', version: '>= 198', required: false)
		if not systemd_dep.found()
			error('logind support requires libsystemd or libsystemd-login but neither was found. Or, you can use \'-Dlauncher-logind=false\'')
		endif
	endif

	dbus_dep = dependency('dbus-1', version: '>= 1.6', required: false)
	if not dbus_dep.found()
		error('logind support requires dbus-1 >= 1.6 which was not found. Or, you can use \'-Dlauncher-logind=false\'')
	endif

	config_h.set('HAVE_DBUS', '1')
	config_h.set('HAVE_SYSTEMD_LOGIN', '1')

	srcs_session_helper += [
		'dbus.c',
		'launcher-logind.c',
	]
	deps_session_helper += [
		dbus_dep,
		systemd_dep,
	]
endif

lib_session_helper = static_library(
	'session-helper',
	srcs_session_helper,
	include_directories: include_directories('..', '../shared'),
	dependencies: deps_session_helper,
	install: false
)
dep_session_helper = declare_dependency(link_with: lib_session_helper)


lib_libinput_backend = static_library(
	'libinput-backend',
	[
		'libinput-device.c',
		'libinput-seat.c'
	],
	dependencies: [
		dep_libweston,
		dep_libinput,
		dependency('libudev', version: '>= 136')
	],
	include_directories: include_directories('..'),
	install: false
)
dep_libinput_backend = declare_dependency(
	link_with: lib_libinput_backend,
	include_directories: include_directories('.')
)

dep_vertex_clipping = declare_dependency(
	sources: 'vertex-clipping.c',
	include_directories: include_directories('.')
)

if get_option('weston-launch')
	dep_pam = cc.find_library('pam')

	if not cc.has_function('pam_open_session', dependencies: dep_pam)
		error('pam_open_session not found for weston-launch')
	endif

	executable(
		'weston-launch',
		'weston-launch.c',
		dependencies: [dep_pam, systemd_dep, dep_libdrm],
		include_directories: include_directories('..'),
		install: true
	)

	meson.add_install_script('echo', 'REMINDER: You are installing weston-launch, please make it setuid-root.')
endif

subdir('renderer-gl')
subdir('backend-drm')
subdir('backend-fbdev')
subdir('backend-headless')
subdir('backend-rdp')
subdir('backend-wayland')
subdir('backend-x11')