• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1project(
2	'wayland', 'c', 'cpp',
3	version: '1.19.0',
4	license: 'MIT',
5	meson_version: '>= 0.52.1',
6	default_options: [
7		'warning_level=2',
8		'buildtype=debugoptimized'
9	]
10)
11
12config_h = configuration_data()
13config_h.set_quoted('PACKAGE', meson.project_name())
14config_h.set_quoted('PACKAGE_VERSION', meson.project_version())
15
16compiler_flags = [
17	'-Wno-unused-parameter',
18	'-Wstrict-prototypes',
19	'-Wmissing-prototypes',
20	'-fvisibility=hidden',
21]
22
23cc = meson.get_compiler('c')
24add_project_arguments(
25	cc.get_supported_arguments(compiler_flags),
26	language: 'c'
27)
28
29foreach h: [ 'sys/prctl.h' ]
30	config_h.set('HAVE_' + h.underscorify().to_upper(), cc.has_header(h))
31endforeach
32
33have_funcs = [
34	'accept4',
35	'mkostemp',
36	'posix_fallocate',
37	'prctl',
38	'memfd_create',
39	'strndup',
40]
41foreach f: have_funcs
42	config_h.set('HAVE_' + f.underscorify().to_upper(), cc.has_function(f))
43endforeach
44
45if get_option('libraries')
46	ffi_dep = dependency('libffi')
47
48	decls = [
49		{ 'header': 'sys/signalfd.h', 'symbol': 'SFD_CLOEXEC' },
50		{ 'header': 'sys/timerfd.h', 'symbol': 'TFD_CLOEXEC' },
51		{ 'header': 'time.h', 'symbol': 'CLOCK_MONOTONIC' },
52	]
53
54	foreach d: decls
55		if not cc.has_header_symbol(d['header'], d['symbol'])
56			error('@0@ is needed to compile Wayland libraries'.format(d['symbol']))
57		endif
58	endforeach
59
60	rt_dep = []
61	if not cc.has_function('clock_gettime', prefix: '#include <time.h>')
62		rt_dep = cc.find_library('rt')
63		if not cc.has_function('clock_gettime', prefix: '#include <time.h>', dependencies: rt_dep)
64			error('clock_gettime not found')
65		endif
66	endif
67endif
68
69scanner_deps = [ dependency('expat') ]
70
71if get_option('dtd_validation')
72	scanner_deps += dependency('libxml-2.0')
73	config_h.set('HAVE_LIBXML', 1)
74endif
75
76configure_file(
77	output: 'config.h',
78	configuration: config_h,
79)
80
81pkgconfig = import('pkgconfig')
82
83wayland_protocol_xml = files('protocol/wayland.xml')
84
85root_inc = include_directories('.')
86protocol_inc = include_directories('protocol')
87src_inc = include_directories('src')
88
89subdir('src')
90
91if get_option('libraries')
92	subdir('cursor')
93	subdir('egl')
94	subdir('tests')
95	if get_option('documentation')
96		subdir('doc')
97	endif
98endif
99
100if get_option('scanner')
101	install_data([
102		'wayland-scanner.mk',
103		'protocol/wayland.xml',
104		'protocol/wayland.dtd',
105	])
106
107	install_data(
108		[ 'wayland-scanner.m4' ],
109		install_dir: join_paths(get_option('prefix'), get_option('datadir'), 'aclocal'),
110	)
111endif
112