blob: df312b82c181e6fe2ccfed31b60330305c1b1711 [file] [log] [blame]
Daniel Stone8011b0f2016-11-24 15:54:51 +00001project('weston',
2 'c',
Pekka Paalanen9912d822019-03-28 10:50:11 +02003 version: '6.0.90',
Daniel Stone8011b0f2016-11-24 15:54:51 +00004 default_options: [
5 'warning_level=2',
6 'c_std=gnu99',
7 'b_lundef=false',
8 ],
9 meson_version: '>= 0.47',
10 license: 'MIT/Expat',
11)
12
Pekka Paalanencd6bf212019-02-08 15:10:48 +020013libweston_major = 6
Daniel Stone8011b0f2016-11-24 15:54:51 +000014
15# libweston_revision is manufactured to follow the autotools build's
16# library file naming, thanks to libtool
17version_weston = meson.project_version()
18version_weston_arr = version_weston.split('.')
19if libweston_major > version_weston_arr[0].to_int()
20 if libweston_major > version_weston_arr[0].to_int() + 1
21 error('Bad versions in meson.build: libweston_major is too high')
22 endif
23 libweston_revision = 0
24elif libweston_major == version_weston_arr[0].to_int()
25 libweston_revision = version_weston_arr[2].to_int()
26else
27 error('Bad versions in meson.build: libweston_major is too low')
28endif
29
30dir_prefix = get_option('prefix')
31dir_bin = join_paths(dir_prefix, get_option('bindir'))
32dir_data = join_paths(dir_prefix, get_option('datadir'))
33dir_include = join_paths(dir_prefix, get_option('includedir'))
34dir_include_libweston = 'libweston-@0@'.format(libweston_major)
35dir_lib = join_paths(dir_prefix, get_option('libdir'))
36dir_libexec = join_paths(dir_prefix, get_option('libexecdir'))
37dir_module_weston = join_paths(dir_lib, 'weston')
38dir_module_libweston = join_paths(dir_lib, 'libweston-@0@'.format(libweston_major))
39dir_data_pc = join_paths(dir_data, 'pkgconfig')
40dir_lib_pc = join_paths(dir_lib, 'pkgconfig')
41dir_man = join_paths(dir_prefix, get_option('mandir'))
42dir_protocol_libweston = 'weston/protocols' # XXX: this should be 'libweston'
43
44pkgconfig = import('pkgconfig')
45
46libweston_version_h = configuration_data()
47libweston_version_h.set('WESTON_VERSION_MAJOR', version_weston_arr[0])
48libweston_version_h.set('WESTON_VERSION_MINOR', version_weston_arr[1])
49libweston_version_h.set('WESTON_VERSION_MICRO', version_weston_arr[2])
50libweston_version_h.set('WESTON_VERSION', version_weston)
51version_h = configure_file(
52 input: 'libweston/version.h.in',
53 output: 'version.h',
54 configuration: libweston_version_h
55)
56install_headers(version_h, subdir: dir_include_libweston)
57git_version_h = vcs_tag(
58 input: 'libweston/git-version.h.meson',
59 output: 'git-version.h',
60 fallback: version_weston
61)
62
63config_h = configuration_data()
64
65cc = meson.get_compiler('c')
66
67global_args = []
68global_args_maybe = [
Eric Engestrom29a68032019-01-10 14:57:05 +000069 '-Wno-unused-parameter',
70 '-Wno-shift-negative-value', # required due to Pixman
71 '-Wno-missing-field-initializers',
Daniel Stone8011b0f2016-11-24 15:54:51 +000072 '-fvisibility=hidden',
Daniel Stone8011b0f2016-11-24 15:54:51 +000073]
74foreach a : global_args_maybe
75 if cc.has_argument(a)
76 global_args += a
77 endif
78endforeach
Daniel Stone8011b0f2016-11-24 15:54:51 +000079add_global_arguments(global_args, language: 'c')
80
81if cc.has_header_symbol('sys/sysmacros.h', 'major')
82 config_h.set('MAJOR_IN_SYSMACROS', 1)
83elif cc.has_header_symbol('sys/mkdev.h', 'major')
84 config_h.set('MAJOR_IN_MKDEV', 1)
85endif
86
87optional_libc_funcs = [
88 'mkostemp', 'strchrnul', 'initgroups', 'posix_fallocate'
89]
90foreach func : optional_libc_funcs
91 if cc.has_function(func)
92 config_h.set('HAVE_' + func.to_upper(), 1)
93 endif
94endforeach
95
96optional_system_headers = [
97 'linux/sync_file.h'
98]
99foreach hdr : optional_system_headers
100 if cc.has_header(hdr)
101 config_h.set('HAVE_' + hdr.underscorify().to_upper(), 1)
102 endif
103endforeach
104
105env_modmap = ''
106
107config_h.set('_GNU_SOURCE', '1')
108config_h.set('_ALL_SOURCE', '1')
109
110config_h.set_quoted('PACKAGE_STRING', 'weston @0@'.format(version_weston))
111config_h.set_quoted('PACKAGE_VERSION', version_weston)
112config_h.set_quoted('VERSION', version_weston)
113config_h.set_quoted('PACKAGE_URL', 'https://wayland.freedesktop.org')
114config_h.set_quoted('PACKAGE_BUGREPORT', 'https://gitlab.freedesktop.org/wayland/weston/issues/')
115
116config_h.set_quoted('BINDIR', dir_bin)
117config_h.set_quoted('DATADIR', dir_data)
118config_h.set_quoted('LIBEXECDIR', dir_libexec)
119config_h.set_quoted('MODULEDIR', dir_module_weston)
120config_h.set_quoted('LIBWESTON_MODULEDIR', dir_module_libweston)
121
122backend_default = get_option('backend-default')
123if backend_default == 'auto'
124 foreach b : [ 'headless', 'fbdev', 'x11', 'wayland', 'drm' ]
125 if get_option('backend-' + b)
126 backend_default = b
127 endif
128 endforeach
129endif
130opt_backend_native = backend_default + '-backend.so'
131config_h.set_quoted('WESTON_NATIVE_BACKEND', opt_backend_native)
132message('The default backend is ' + backend_default)
133if not get_option('backend-' + backend_default)
134 error('Backend @0@ was chosen as native but is not being built.'.format(backend_default))
135endif
136
137dep_xkbcommon = dependency('xkbcommon', version: '>= 0.3.0')
138if dep_xkbcommon.version().version_compare('>= 0.5.0')
139 config_h.set('HAVE_XKBCOMMON_COMPOSE', '1')
140endif
141
142dep_wayland_server = dependency('wayland-server', version: '>= 1.12.0')
143dep_wayland_client = dependency('wayland-client', version: '>= 1.12.0')
144dep_pixman = dependency('pixman-1', version: '>= 0.25.2')
145dep_libinput = dependency('libinput', version: '>= 0.8.0')
Eric Toombs6e229ca2019-01-31 21:53:25 -0500146dep_libevdev = dependency('libevdev')
Daniel Stone8011b0f2016-11-24 15:54:51 +0000147dep_libm = cc.find_library('m')
148dep_libdl = cc.find_library('dl')
149dep_libdrm = dependency('libdrm', version: '>= 2.4.68')
150dep_libdrm_headers = dep_libdrm.partial_dependency(compile_args: true)
Daniel Stone8011b0f2016-11-24 15:54:51 +0000151dep_threads = dependency('threads')
152
153subdir('protocol')
154subdir('shared')
155subdir('libweston')
156subdir('libweston-desktop')
157subdir('xwayland')
158subdir('compositor')
159subdir('desktop-shell')
160subdir('fullscreen-shell')
161subdir('ivi-shell')
162subdir('remoting')
163subdir('clients')
164subdir('wcap')
165subdir('tests')
166subdir('data')
167subdir('man')
168
Harish Krupob81fc512019-04-16 10:41:01 +0530169configure_file(output: 'config.h', configuration: config_h)
170
Daniel Stone8011b0f2016-11-24 15:54:51 +0000171
172# TODO: process doc/doxygen/*.doxygen.in