blob: 4acdf97206c0985e3c41879723dd3301742d0f41 [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: [
Daniel Stonee2f9c1b2019-06-11 11:41:41 +01005 'warning_level=3',
Daniel Stone8011b0f2016-11-24 15:54:51 +00006 'c_std=gnu99',
7 'b_lundef=false',
8 ],
9 meson_version: '>= 0.47',
10 license: 'MIT/Expat',
11)
12
Pekka Paalanena78cf772019-03-28 16:35:56 +020013libweston_major = 7
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'))
Pekka Paalanen4ab901e2019-03-28 14:45:40 +020042dir_protocol_libweston = 'libweston/protocols'
Daniel Stone8011b0f2016-11-24 15:54:51 +000043
Pekka Paalanena78cf772019-03-28 16:35:56 +020044public_inc = include_directories('include')
45
Daniel Stone8011b0f2016-11-24 15:54:51 +000046pkgconfig = import('pkgconfig')
47
Daniel Stone8011b0f2016-11-24 15:54:51 +000048git_version_h = vcs_tag(
49 input: 'libweston/git-version.h.meson',
50 output: 'git-version.h',
51 fallback: version_weston
52)
53
54config_h = configuration_data()
55
56cc = meson.get_compiler('c')
57
58global_args = []
59global_args_maybe = [
Eric Engestrom29a68032019-01-10 14:57:05 +000060 '-Wno-unused-parameter',
61 '-Wno-shift-negative-value', # required due to Pixman
62 '-Wno-missing-field-initializers',
Daniel Stone34473d72019-06-11 11:40:13 +010063 '-Wno-pedantic',
Daniel Stone8011b0f2016-11-24 15:54:51 +000064 '-fvisibility=hidden',
Daniel Stone8011b0f2016-11-24 15:54:51 +000065]
66foreach a : global_args_maybe
67 if cc.has_argument(a)
68 global_args += a
69 endif
70endforeach
Daniel Stone8011b0f2016-11-24 15:54:51 +000071add_global_arguments(global_args, language: 'c')
72
73if cc.has_header_symbol('sys/sysmacros.h', 'major')
74 config_h.set('MAJOR_IN_SYSMACROS', 1)
75elif cc.has_header_symbol('sys/mkdev.h', 'major')
76 config_h.set('MAJOR_IN_MKDEV', 1)
77endif
78
79optional_libc_funcs = [
80 'mkostemp', 'strchrnul', 'initgroups', 'posix_fallocate'
81]
82foreach func : optional_libc_funcs
83 if cc.has_function(func)
84 config_h.set('HAVE_' + func.to_upper(), 1)
85 endif
86endforeach
87
88optional_system_headers = [
89 'linux/sync_file.h'
90]
91foreach hdr : optional_system_headers
92 if cc.has_header(hdr)
93 config_h.set('HAVE_' + hdr.underscorify().to_upper(), 1)
94 endif
95endforeach
96
97env_modmap = ''
98
99config_h.set('_GNU_SOURCE', '1')
100config_h.set('_ALL_SOURCE', '1')
101
102config_h.set_quoted('PACKAGE_STRING', 'weston @0@'.format(version_weston))
103config_h.set_quoted('PACKAGE_VERSION', version_weston)
104config_h.set_quoted('VERSION', version_weston)
105config_h.set_quoted('PACKAGE_URL', 'https://wayland.freedesktop.org')
106config_h.set_quoted('PACKAGE_BUGREPORT', 'https://gitlab.freedesktop.org/wayland/weston/issues/')
107
108config_h.set_quoted('BINDIR', dir_bin)
109config_h.set_quoted('DATADIR', dir_data)
110config_h.set_quoted('LIBEXECDIR', dir_libexec)
111config_h.set_quoted('MODULEDIR', dir_module_weston)
112config_h.set_quoted('LIBWESTON_MODULEDIR', dir_module_libweston)
113
114backend_default = get_option('backend-default')
115if backend_default == 'auto'
116 foreach b : [ 'headless', 'fbdev', 'x11', 'wayland', 'drm' ]
117 if get_option('backend-' + b)
118 backend_default = b
119 endif
120 endforeach
121endif
122opt_backend_native = backend_default + '-backend.so'
123config_h.set_quoted('WESTON_NATIVE_BACKEND', opt_backend_native)
124message('The default backend is ' + backend_default)
125if not get_option('backend-' + backend_default)
126 error('Backend @0@ was chosen as native but is not being built.'.format(backend_default))
127endif
128
129dep_xkbcommon = dependency('xkbcommon', version: '>= 0.3.0')
130if dep_xkbcommon.version().version_compare('>= 0.5.0')
131 config_h.set('HAVE_XKBCOMMON_COMPOSE', '1')
132endif
133
134dep_wayland_server = dependency('wayland-server', version: '>= 1.12.0')
135dep_wayland_client = dependency('wayland-client', version: '>= 1.12.0')
136dep_pixman = dependency('pixman-1', version: '>= 0.25.2')
137dep_libinput = dependency('libinput', version: '>= 0.8.0')
Eric Toombs6e229ca2019-01-31 21:53:25 -0500138dep_libevdev = dependency('libevdev')
Daniel Stone8011b0f2016-11-24 15:54:51 +0000139dep_libm = cc.find_library('m')
140dep_libdl = cc.find_library('dl')
141dep_libdrm = dependency('libdrm', version: '>= 2.4.68')
142dep_libdrm_headers = dep_libdrm.partial_dependency(compile_args: true)
Daniel Stone8011b0f2016-11-24 15:54:51 +0000143dep_threads = dependency('threads')
144
Pekka Paalanena78cf772019-03-28 16:35:56 +0200145subdir('include')
Daniel Stone8011b0f2016-11-24 15:54:51 +0000146subdir('protocol')
147subdir('shared')
148subdir('libweston')
149subdir('libweston-desktop')
150subdir('xwayland')
151subdir('compositor')
152subdir('desktop-shell')
153subdir('fullscreen-shell')
154subdir('ivi-shell')
155subdir('remoting')
156subdir('clients')
157subdir('wcap')
158subdir('tests')
159subdir('data')
160subdir('man')
161
Harish Krupob81fc512019-04-16 10:41:01 +0530162configure_file(output: 'config.h', configuration: config_h)
163
Marius Vladbbf6ea02019-06-14 12:41:02 +0300164if get_option('doc')
165 subdir('doc/sphinx')
166else
167 message('Documentation will not be built. Use -Ddoc to build it.')
168endif