1project('weston', 2 'c', 3 version: '9.0.0', 4 default_options: [ 5 'warning_level=3', 6 'c_std=gnu99', 7 'b_lundef=true', 8 ], 9 meson_version: '>= 0.47', 10 license: 'MIT/Expat', 11) 12 13libweston_major = 9 14 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_libweston = 'libweston-@0@'.format(libweston_major) 34dir_include_libweston_install = join_paths(dir_include_libweston, 'libweston') 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 = join_paths('libweston-@0@'.format(libweston_major), 'protocols') 43 44public_inc = include_directories('include') 45common_inc = [ include_directories('.'), public_inc ] 46 47pkgconfig = import('pkgconfig') 48 49git_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 = [ 61 '-Wmissing-prototypes', 62 '-Wno-unused-parameter', 63 '-Wno-shift-negative-value', # required due to Pixman 64 '-Wno-missing-field-initializers', 65 '-Wno-pedantic', 66 '-fvisibility=hidden', 67] 68foreach a : global_args_maybe 69 if cc.has_argument(a) 70 global_args += a 71 endif 72endforeach 73add_global_arguments(global_args, language: 'c') 74 75if cc.has_header_symbol('sys/sysmacros.h', 'major') 76 config_h.set('MAJOR_IN_SYSMACROS', 1) 77elif cc.has_header_symbol('sys/mkdev.h', 'major') 78 config_h.set('MAJOR_IN_MKDEV', 1) 79endif 80 81optional_libc_funcs = [ 82 'mkostemp', 'strchrnul', 'initgroups', 'posix_fallocate', 'memfd_create' 83] 84foreach func : optional_libc_funcs 85 if cc.has_function(func) 86 config_h.set('HAVE_' + func.to_upper(), 1) 87 endif 88endforeach 89 90optional_system_headers = [ 91 'linux/sync_file.h' 92] 93foreach hdr : optional_system_headers 94 if cc.has_header(hdr) 95 config_h.set('HAVE_' + hdr.underscorify().to_upper(), 1) 96 endif 97endforeach 98 99env_modmap = '' 100 101config_h.set('_GNU_SOURCE', '1') 102config_h.set('_ALL_SOURCE', '1') 103config_h.set('EGL_NO_X11', '1') 104config_h.set('MESA_EGL_NO_X11_HEADERS', '1') 105 106config_h.set_quoted('PACKAGE_STRING', 'weston @0@'.format(version_weston)) 107config_h.set_quoted('PACKAGE_VERSION', version_weston) 108config_h.set_quoted('VERSION', version_weston) 109config_h.set_quoted('PACKAGE_URL', 'https://wayland.freedesktop.org') 110config_h.set_quoted('PACKAGE_BUGREPORT', 'https://gitlab.freedesktop.org/wayland/weston/issues/') 111 112config_h.set_quoted('BINDIR', dir_bin) 113config_h.set_quoted('DATADIR', dir_data) 114config_h.set_quoted('LIBEXECDIR', dir_libexec) 115config_h.set_quoted('MODULEDIR', dir_module_weston) 116config_h.set_quoted('LIBWESTON_MODULEDIR', dir_module_libweston) 117 118config_h.set10('TEST_GL_RENDERER', get_option('test-gl-renderer')) 119 120backend_default = get_option('backend-default') 121if backend_default == 'auto' 122 foreach b : [ 'headless', 'fbdev', 'x11', 'wayland', 'drm' ] 123 if get_option('backend-' + b) 124 backend_default = b 125 endif 126 endforeach 127endif 128opt_backend_native = backend_default + '-backend.so' 129config_h.set_quoted('WESTON_NATIVE_BACKEND', opt_backend_native) 130message('The default backend is ' + backend_default) 131if not get_option('backend-' + backend_default) 132 error('Backend @0@ was chosen as native but is not being built.'.format(backend_default)) 133endif 134 135dep_xkbcommon = dependency('xkbcommon', version: '>= 0.3.0') 136if dep_xkbcommon.version().version_compare('>= 0.5.0') 137 config_h.set('HAVE_XKBCOMMON_COMPOSE', '1') 138endif 139 140dep_wayland_server = dependency('wayland-server', version: '>= 1.17.0') 141dep_wayland_client = dependency('wayland-client', version: '>= 1.17.0') 142dep_pixman = dependency('pixman-1', version: '>= 0.25.2') 143dep_libinput = dependency('libinput', version: '>= 0.8.0') 144dep_libevdev = dependency('libevdev') 145dep_libm = cc.find_library('m') 146dep_libdl = cc.find_library('dl') 147dep_libdrm = dependency('libdrm', version: '>= 2.4.86') 148dep_libdrm_headers = dep_libdrm.partial_dependency(compile_args: true) 149dep_threads = dependency('threads') 150 151subdir('include') 152subdir('protocol') 153subdir('shared') 154subdir('libweston') 155subdir('libweston-desktop') 156subdir('xwayland') 157subdir('compositor') 158subdir('desktop-shell') 159subdir('fullscreen-shell') 160subdir('ivi-shell') 161subdir('kiosk-shell') 162subdir('remoting') 163subdir('pipewire') 164subdir('clients') 165subdir('wcap') 166subdir('tests') 167subdir('data') 168subdir('man') 169 170configure_file(output: 'config.h', configuration: config_h) 171 172if get_option('doc') 173 subdir('doc/sphinx') 174else 175 message('Documentation will not be built. Use -Ddoc to build it.') 176endif 177