summaryrefslogtreecommitdiff
path: root/meson.build
blob: 5632f4e6ef6bb79d8289ef9adf59df69118e73cc (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
project(
	'wayland', 'c', 'cpp',
	version: '1.18.0',
	license: 'MIT',
	meson_version: '>= 0.47.0',
	default_options: [
		'warning_level=2',
		'buildtype=debugoptimized'
	]
)

config_h = configuration_data()
config_h.set_quoted('PACKAGE', meson.project_name())
config_h.set_quoted('PACKAGE_VERSION', meson.project_version())

compiler_flags = [
	'-Wno-unused-parameter',
	'-Wstrict-prototypes',
	'-Wmissing-prototypes',
	'-fvisibility=hidden',
]

cc = meson.get_compiler('c')
add_project_arguments(
	cc.get_supported_arguments(compiler_flags),
	language: 'c'
)

foreach h: [ 'sys/prctl.h' ]
	config_h.set('HAVE_' + h.underscorify().to_upper(), cc.has_header(h))
endforeach

have_funcs = [
	'accept4',
	'mkostemp',
	'posix_fallocate',
	'prctl',
	'memfd_create',
	'strndup',
]
foreach f: have_funcs
	config_h.set('HAVE_' + f.underscorify().to_upper(), cc.has_function(f))
endforeach

if get_option('libraries')
	ffi_dep = dependency('libffi')

	decls = [
		{ 'header': 'sys/signalfd.h', 'symbol': 'SFD_CLOEXEC' },
		{ 'header': 'sys/timerfd.h', 'symbol': 'TFD_CLOEXEC' },
		{ 'header': 'time.h', 'symbol': 'CLOCK_MONOTONIC' },
	]

	foreach d: decls
		if not cc.has_header_symbol(d['header'], d['symbol'])
			error('@0@ is needed to compile Wayland libraries'.format(d['symbol']))
		endif
	endforeach
endif

scanner_deps = [ dependency('expat') ]

if get_option('dtd_validation')
	scanner_deps += dependency('libxml-2.0')
	config_h.set('HAVE_LIBXML', 1)
endif

configure_file(
	output: 'config.h',
	configuration: config_h,
)

pkgconfig = import('pkgconfig')

wayland_protocol_xml = files('protocol/wayland.xml')

root_inc = include_directories('.')
protocol_inc = include_directories('protocol')
src_inc = include_directories('src')

subdir('src')

if get_option('libraries')
	subdir('cursor')
	subdir('egl')
	subdir('tests')
endif

if get_option('documentation')
	subdir('doc')
endif

install_data([
	'wayland-scanner.mk',
	'protocol/wayland.xml',
	'protocol/wayland.dtd',
])

install_data(
	[ 'wayland-scanner.m4' ],
	install_dir: join_paths(get_option('prefix'), get_option('datadir'), 'aclocal'),
)