diff options
author | Daniel Stone <daniels@collabora.com> | 2016-11-24 15:54:51 +0000 |
---|---|---|
committer | Pekka Paalanen <pq@iki.fi> | 2018-12-09 14:50:54 +0200 |
commit | 8011b0fa0303741ef41f45ce0bf45484d9c5f115 (patch) | |
tree | fe272514159d517ff62d7456e38e7425ab670094 /meson.build | |
parent | ed75c89fd570a587010b1dbbb2c0a466821ddd06 (diff) |
Add Meson build system
Meson is a build system, currently implemented in Python, with multiple
output backends, including Ninja and Make. The build file syntax is
clean and easy to read unlike autotools. In practise, configuring and
building with Meson and Ninja has been observed to be much faster than
with autotools. Also cross-building support is excellent.
More information at http://mesonbuild.com
Since moving to Meson requires some changes from users in any case, we
took this opportunity to revamp build options. Most of the build options
still exist, some have changed names or more, and a few have been
dropped. The option to choose the Cairo flavour is not implemented since
for the longest time the Cairo image backend has been the only
recommended one.
This Meson build should be fully functional and it installs everything
an all-enabled autotools build does. Installed pkg-config files have
some minor differences that should be insignificant. Building of some
developer documentation that was never installed with autotools is
missing.
It is expected that the autotools build system will be removed soon
after the next Weston release.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Co-authored-by: Pekka Paalanen <pq@iki.fi>
Signed-off-by: Pekka Paalanen <pq@iki.fi>
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 174 |
1 files changed, 174 insertions, 0 deletions
diff --git a/meson.build b/meson.build new file mode 100644 index 00000000..a5dcb766 --- /dev/null +++ b/meson.build @@ -0,0 +1,174 @@ +project('weston', + 'c', + version: '5.0.90', + default_options: [ + 'warning_level=2', + 'c_std=gnu99', + 'b_lundef=false', + ], + meson_version: '>= 0.47', + license: 'MIT/Expat', +) + +libweston_major = 5 + +# libweston_revision is manufactured to follow the autotools build's +# library file naming, thanks to libtool +version_weston = meson.project_version() +version_weston_arr = version_weston.split('.') +if libweston_major > version_weston_arr[0].to_int() + if libweston_major > version_weston_arr[0].to_int() + 1 + error('Bad versions in meson.build: libweston_major is too high') + endif + libweston_revision = 0 +elif libweston_major == version_weston_arr[0].to_int() + libweston_revision = version_weston_arr[2].to_int() +else + error('Bad versions in meson.build: libweston_major is too low') +endif + +dir_prefix = get_option('prefix') +dir_bin = join_paths(dir_prefix, get_option('bindir')) +dir_data = join_paths(dir_prefix, get_option('datadir')) +dir_include = join_paths(dir_prefix, get_option('includedir')) +dir_include_libweston = 'libweston-@0@'.format(libweston_major) +dir_lib = join_paths(dir_prefix, get_option('libdir')) +dir_libexec = join_paths(dir_prefix, get_option('libexecdir')) +dir_module_weston = join_paths(dir_lib, 'weston') +dir_module_libweston = join_paths(dir_lib, 'libweston-@0@'.format(libweston_major)) +dir_data_pc = join_paths(dir_data, 'pkgconfig') +dir_lib_pc = join_paths(dir_lib, 'pkgconfig') +dir_man = join_paths(dir_prefix, get_option('mandir')) +dir_protocol_libweston = 'weston/protocols' # XXX: this should be 'libweston' + +pkgconfig = import('pkgconfig') + +libweston_version_h = configuration_data() +libweston_version_h.set('WESTON_VERSION_MAJOR', version_weston_arr[0]) +libweston_version_h.set('WESTON_VERSION_MINOR', version_weston_arr[1]) +libweston_version_h.set('WESTON_VERSION_MICRO', version_weston_arr[2]) +libweston_version_h.set('WESTON_VERSION', version_weston) +version_h = configure_file( + input: 'libweston/version.h.in', + output: 'version.h', + configuration: libweston_version_h +) +install_headers(version_h, subdir: dir_include_libweston) +git_version_h = vcs_tag( + input: 'libweston/git-version.h.meson', + output: 'git-version.h', + fallback: version_weston +) + +config_h = configuration_data() + +cc = meson.get_compiler('c') + +global_args = [] +global_args_maybe = [ + '-Wno-unused-parameter', + '-Wno-shift-negative-value', # required due to Pixman + '-Wno-missing-field-initializers', + '-fvisibility=hidden', + '-DIN_WESTON', +] +foreach a : global_args_maybe + if cc.has_argument(a) + global_args += a + endif +endforeach +add_global_arguments(global_args, language: 'c') + +if cc.has_header_symbol('sys/sysmacros.h', 'major') + config_h.set('MAJOR_IN_SYSMACROS', 1) +elif cc.has_header_symbol('sys/mkdev.h', 'major') + config_h.set('MAJOR_IN_MKDEV', 1) +endif + +optional_libc_funcs = [ + 'mkostemp', 'strchrnul', 'initgroups', 'posix_fallocate' +] +foreach func : optional_libc_funcs + if cc.has_function(func) + config_h.set('HAVE_' + func.to_upper(), 1) + endif +endforeach + +optional_system_headers = [ + 'linux/sync_file.h' +] +foreach hdr : optional_system_headers + if cc.has_header(hdr) + config_h.set('HAVE_' + hdr.underscorify().to_upper(), 1) + endif +endforeach + +env_modmap = '' + +config_h.set('_GNU_SOURCE', '1') +config_h.set('_ALL_SOURCE', '1') + +config_h.set_quoted('PACKAGE_STRING', 'weston @0@'.format(version_weston)) +config_h.set_quoted('PACKAGE_VERSION', version_weston) +config_h.set_quoted('VERSION', version_weston) +config_h.set_quoted('PACKAGE_URL', 'https://wayland.freedesktop.org') +config_h.set_quoted('PACKAGE_BUGREPORT', 'https://gitlab.freedesktop.org/wayland/weston/issues/') + +config_h.set_quoted('BINDIR', dir_bin) +config_h.set_quoted('DATADIR', dir_data) +config_h.set_quoted('LIBEXECDIR', dir_libexec) +config_h.set_quoted('MODULEDIR', dir_module_weston) +config_h.set_quoted('LIBWESTON_MODULEDIR', dir_module_libweston) + +backend_default = get_option('backend-default') +if backend_default == 'auto' + foreach b : [ 'headless', 'fbdev', 'x11', 'wayland', 'drm' ] + if get_option('backend-' + b) + backend_default = b + endif + endforeach +endif +opt_backend_native = backend_default + '-backend.so' +config_h.set_quoted('WESTON_NATIVE_BACKEND', opt_backend_native) +message('The default backend is ' + backend_default) +if not get_option('backend-' + backend_default) + error('Backend @0@ was chosen as native but is not being built.'.format(backend_default)) +endif + +dep_xkbcommon = dependency('xkbcommon', version: '>= 0.3.0') +if dep_xkbcommon.version().version_compare('>= 0.5.0') + config_h.set('HAVE_XKBCOMMON_COMPOSE', '1') +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') +dep_libdrm = dependency('libdrm', version: '>= 2.4.68') +dep_libdrm_headers = dep_libdrm.partial_dependency(compile_args: true) +dep_egl = dependency('egl', required: false) +dep_wl_egl = dependency('wayland-egl') +dep_glesv2 = dependency('glesv2', required: false) +dep_threads = dependency('threads') + +subdir('protocol') +subdir('shared') +subdir('libweston') +subdir('libweston-desktop') +subdir('xwayland') +subdir('compositor') +subdir('desktop-shell') +subdir('fullscreen-shell') +subdir('ivi-shell') +subdir('remoting') +subdir('clients') +subdir('wcap') +subdir('tests') +subdir('data') +subdir('man') + +configure_file(output: 'config.h', install: false, configuration: config_h) + +# TODO: process doc/doxygen/*.doxygen.in |