blob: 60e21416b03ef56e21a4df7fb4e646c9c5b31421 [file] [log] [blame]
Daniel Stone8011b0f2016-11-24 15:54:51 +00001project('weston',
2 'c',
Simon Ser0fa41032020-01-17 23:18:24 +01003 version: '7.0.93',
Daniel Stone8011b0f2016-11-24 15:54:51 +00004 default_options: [
Daniel Stonee2f9c1b2019-06-11 11:41:41 +01005 'warning_level=3',
Daniel Stone8011b0f2016-11-24 15:54:51 +00006 'c_std=gnu99',
Pekka Paalanen2f9ca272019-07-09 12:06:42 +03007 'b_lundef=true',
Daniel Stone8011b0f2016-11-24 15:54:51 +00008 ],
9 meson_version: '>= 0.47',
10 license: 'MIT/Expat',
11)
12
Marius Vlad9bb1c3a2019-07-29 12:02:47 +030013libweston_major = 8
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'))
Daniel Stone8011b0f2016-11-24 15:54:51 +000033dir_include_libweston = 'libweston-@0@'.format(libweston_major)
Pekka Paalanena78cf772019-03-28 16:35:56 +020034dir_include_libweston_install = join_paths(dir_include_libweston, 'libweston')
Daniel Stone8011b0f2016-11-24 15:54:51 +000035dir_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'))
Quentin Glidicb5c70d72019-07-22 22:11:38 +020042dir_protocol_libweston = join_paths('libweston-@0@'.format(libweston_major), 'protocols')
Daniel Stone8011b0f2016-11-24 15:54:51 +000043
Pekka Paalanena78cf772019-03-28 16:35:56 +020044public_inc = include_directories('include')
Pekka Paalanen4f5e3602019-04-05 17:09:28 +030045common_inc = [ include_directories('.'), public_inc ]
Pekka Paalanena78cf772019-03-28 16:35:56 +020046
Daniel Stone8011b0f2016-11-24 15:54:51 +000047pkgconfig = import('pkgconfig')
48
Daniel Stone8011b0f2016-11-24 15:54:51 +000049git_version_h = vcs_tag(
50 input: 'libweston/git-version.h.meson',
51 output: 'git-version.h',
52 fallback: version_weston
53)
54
55config_h = configuration_data()
56
57cc = meson.get_compiler('c')
58
59global_args = []
60global_args_maybe = [
Eric Engestrom29a68032019-01-10 14:57:05 +000061 '-Wno-unused-parameter',
62 '-Wno-shift-negative-value', # required due to Pixman
63 '-Wno-missing-field-initializers',
Daniel Stone34473d72019-06-11 11:40:13 +010064 '-Wno-pedantic',
Daniel Stone8011b0f2016-11-24 15:54:51 +000065 '-fvisibility=hidden',
Daniel Stone8011b0f2016-11-24 15:54:51 +000066]
67foreach a : global_args_maybe
68 if cc.has_argument(a)
69 global_args += a
70 endif
71endforeach
Daniel Stone8011b0f2016-11-24 15:54:51 +000072add_global_arguments(global_args, language: 'c')
73
74if cc.has_header_symbol('sys/sysmacros.h', 'major')
75 config_h.set('MAJOR_IN_SYSMACROS', 1)
76elif cc.has_header_symbol('sys/mkdev.h', 'major')
77 config_h.set('MAJOR_IN_MKDEV', 1)
78endif
79
80optional_libc_funcs = [
Emmanuel Gil Peyrotdeae98e2019-07-22 15:06:20 +020081 'mkostemp', 'strchrnul', 'initgroups', 'posix_fallocate', 'memfd_create'
Daniel Stone8011b0f2016-11-24 15:54:51 +000082]
83foreach func : optional_libc_funcs
84 if cc.has_function(func)
85 config_h.set('HAVE_' + func.to_upper(), 1)
86 endif
87endforeach
88
89optional_system_headers = [
90 'linux/sync_file.h'
91]
92foreach hdr : optional_system_headers
93 if cc.has_header(hdr)
94 config_h.set('HAVE_' + hdr.underscorify().to_upper(), 1)
95 endif
96endforeach
97
98env_modmap = ''
99
100config_h.set('_GNU_SOURCE', '1')
101config_h.set('_ALL_SOURCE', '1')
Pekka Paalanen6510b2a2020-01-24 15:11:13 +0200102config_h.set('EGL_NO_X11', '1')
103config_h.set('MESA_EGL_NO_X11_HEADERS', '1')
Daniel Stone8011b0f2016-11-24 15:54:51 +0000104
105config_h.set_quoted('PACKAGE_STRING', 'weston @0@'.format(version_weston))
106config_h.set_quoted('PACKAGE_VERSION', version_weston)
107config_h.set_quoted('VERSION', version_weston)
108config_h.set_quoted('PACKAGE_URL', 'https://wayland.freedesktop.org')
109config_h.set_quoted('PACKAGE_BUGREPORT', 'https://gitlab.freedesktop.org/wayland/weston/issues/')
110
111config_h.set_quoted('BINDIR', dir_bin)
112config_h.set_quoted('DATADIR', dir_data)
113config_h.set_quoted('LIBEXECDIR', dir_libexec)
114config_h.set_quoted('MODULEDIR', dir_module_weston)
115config_h.set_quoted('LIBWESTON_MODULEDIR', dir_module_libweston)
116
117backend_default = get_option('backend-default')
118if backend_default == 'auto'
119 foreach b : [ 'headless', 'fbdev', 'x11', 'wayland', 'drm' ]
120 if get_option('backend-' + b)
121 backend_default = b
122 endif
123 endforeach
124endif
125opt_backend_native = backend_default + '-backend.so'
126config_h.set_quoted('WESTON_NATIVE_BACKEND', opt_backend_native)
127message('The default backend is ' + backend_default)
128if not get_option('backend-' + backend_default)
129 error('Backend @0@ was chosen as native but is not being built.'.format(backend_default))
130endif
131
132dep_xkbcommon = dependency('xkbcommon', version: '>= 0.3.0')
133if dep_xkbcommon.version().version_compare('>= 0.5.0')
134 config_h.set('HAVE_XKBCOMMON_COMPOSE', '1')
135endif
136
Sebastian Wickfcc6ff72019-11-01 02:09:28 +0100137dep_wayland_server = dependency('wayland-server', version: '>= 1.17.0')
138dep_wayland_client = dependency('wayland-client', version: '>= 1.17.0')
Daniel Stone8011b0f2016-11-24 15:54:51 +0000139dep_pixman = dependency('pixman-1', version: '>= 0.25.2')
140dep_libinput = dependency('libinput', version: '>= 0.8.0')
Eric Toombs6e229ca2019-01-31 21:53:25 -0500141dep_libevdev = dependency('libevdev')
Daniel Stone8011b0f2016-11-24 15:54:51 +0000142dep_libm = cc.find_library('m')
143dep_libdl = cc.find_library('dl')
Daniel Stone60937722019-11-26 10:48:12 +0000144dep_libdrm = dependency('libdrm', version: '>= 2.4.86')
Daniel Stone8011b0f2016-11-24 15:54:51 +0000145dep_libdrm_headers = dep_libdrm.partial_dependency(compile_args: true)
Daniel Stone8011b0f2016-11-24 15:54:51 +0000146dep_threads = dependency('threads')
147
Pekka Paalanena78cf772019-03-28 16:35:56 +0200148subdir('include')
Daniel Stone8011b0f2016-11-24 15:54:51 +0000149subdir('protocol')
150subdir('shared')
151subdir('libweston')
152subdir('libweston-desktop')
153subdir('xwayland')
154subdir('compositor')
155subdir('desktop-shell')
156subdir('fullscreen-shell')
157subdir('ivi-shell')
158subdir('remoting')
Michael Olbrichd5d5aa92019-04-23 12:34:05 +0200159subdir('pipewire')
Daniel Stone8011b0f2016-11-24 15:54:51 +0000160subdir('clients')
161subdir('wcap')
162subdir('tests')
163subdir('data')
164subdir('man')
165
Harish Krupob81fc512019-04-16 10:41:01 +0530166configure_file(output: 'config.h', configuration: config_h)
167
Marius Vladbbf6ea02019-06-14 12:41:02 +0300168if get_option('doc')
169 subdir('doc/sphinx')
170else
171 message('Documentation will not be built. Use -Ddoc to build it.')
172endif