summaryrefslogtreecommitdiff
path: root/meson.build
blob: d35f49caf93a39b5ee11a69f51635b6b22c8d4b0 (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
project('weston',
	'c',
	version: '1.12.90',
	default_options: [
		'warning_level=2',
		'c_std=gnu99',
		'b_lundef=false',
	],
	meson_version: '>= 0.36',
	license: 'MIT/Expat',
)

pkgconfig = import('pkgconfig')

libweston_major = 2
weston_version = meson.project_version()
version_arr = weston_version.split('.')
libweston_version_h = configuration_data()
libweston_version_h.set('WESTON_VERSION_MAJOR', version_arr.get(0))
libweston_version_h.set('WESTON_VERSION_MINOR', version_arr.get(1))
libweston_version_h.set('WESTON_VERSION_MICRO', version_arr.get(2))
libweston_version_h.set('WESTON_VERSION', weston_version)
version_h = configure_file(
	input: 'libweston/version.h.in',
	output: 'version.h',
	configuration: libweston_version_h,
	install_dir: '@0@/libweston'.format(get_option('includedir'))
)
git_version_h = vcs_tag(
	input: 'libweston/git-version.h.meson',
	output: 'git-version.h',
	fallback: weston_version,
	install: false
)

config_h = configuration_data()

cc = meson.get_compiler('c')

add_global_arguments([
	'-Wno-unused-parameter',
	'-Wno-shift-negative-value', # required due to Pixman
	'-Wno-missing-field-initializers',
	'-fvisibility=hidden',
	'-DIN_WESTON',
], language: 'c')

env_modmap = ''

dir_weston_module = '@0@/weston'.format(get_option('libdir'))
dir_libweston_module = '@0@/libweston-@1@'.format(get_option('libdir'), libweston_major)

config_h.set('_GNU_SOURCE', '1')

config_h.set('PACKAGE_STRING', '"weston @0@"'.format(weston_version))
config_h.set('PACKAGE_VERSION', '"@0@"'.format(weston_version))
config_h.set('VERSION', '"@0@"'.format(weston_version))
config_h.set('PACKAGE_URL', '"https://wayland.freedesktop.org"')
config_h.set('PACKAGE_BUGREPORT',
             '"https://bugs.freedesktop.org/enter_bug.cgi?product=Wayland&component=weston"')

config_h.set('BINDIR',
             '"@0@/@1@"'.format(get_option('prefix'), get_option('bindir')))
config_h.set('DATADIR',
             '"@0@/@1@"'.format(get_option('prefix'), get_option('datadir')))
config_h.set('LIBEXECDIR',
             '"@0@/@1@"'.format(get_option('prefix'), get_option('libexecdir')))
config_h.set('MODULEDIR',
             '"@0@/@1@"'.format(get_option('prefix'), dir_weston_module))
config_h.set('LIBWESTON_MODULEDIR',
             '"@0@/@1@"'.format(get_option('prefix'), dir_libweston_module))

opt_backend_native = get_option('backend_default')
if opt_backend_native == ''
	if get_option('backend_drm')
		opt_backend_native = 'drm-backend.so'
	elif get_option('backend_wayland')
		opt_backend_native = 'wayland-backend.so'
	elif get_option('backend_x11')
		opt_backend_native = 'x11-backend.so'
	elif get_option('backend_headless')
		opt_backend_native = 'headless-backend.so'
	endif
endif
config_h.set('WESTON_NATIVE_BACKEND', '"@0@"'.format(opt_backend_native))

if get_option('xkbcommon')
	dep_xkbcommon = dependency('xkbcommon', version: '>= 0.3.0')
	config_h.set('ENABLE_XKBCOMMON', '1')
	if dep_xkbcommon.version().version_compare('>= 0.5.0')
		config_h.set('HAVE_XKBCOMMON_COMPOSE', '1')
	endif
endif

dep_wayland_server = dependency('wayland-server', version: '>= 1.12.0')
dep_wayland_client = dependency('wayland-client', version: '>= 1.12.0')
dep_pixman = dependency('pixman-1', version: '>= 0.25.2')
dep_libinput = dependency('libinput', version: '>= 0.8.0')
dep_libm = cc.find_library('m')
dep_libdl = cc.find_library('dl')

subdir('protocol')
subdir('shared')
subdir('libweston')
subdir('libweston-desktop')
subdir('xwayland')
subdir('compositor')
subdir('desktop-shell')
subdir('fullscreen-shell')
subdir('ivi-shell')
subdir('clients')
subdir('tests')

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