Daniel Stone | 8011b0f | 2016-11-24 15:54:51 +0000 | [diff] [blame] | 1 | project('weston', |
| 2 | 'c', |
Simon Ser | 4a03924 | 2022-02-01 22:59:57 +0100 | [diff] [blame] | 3 | version: '10.0.0', |
Daniel Stone | 8011b0f | 2016-11-24 15:54:51 +0000 | [diff] [blame] | 4 | default_options: [ |
Daniel Stone | e2f9c1b | 2019-06-11 11:41:41 +0100 | [diff] [blame] | 5 | 'warning_level=3', |
Daniel Stone | 8011b0f | 2016-11-24 15:54:51 +0000 | [diff] [blame] | 6 | 'c_std=gnu99', |
Pekka Paalanen | 2f9ca27 | 2019-07-09 12:06:42 +0300 | [diff] [blame] | 7 | 'b_lundef=true', |
Daniel Stone | 8011b0f | 2016-11-24 15:54:51 +0000 | [diff] [blame] | 8 | ], |
Pekka Paalanen | c0565b6 | 2021-02-08 14:19:56 +0200 | [diff] [blame] | 9 | meson_version: '>= 0.52.1', |
Daniel Stone | 8011b0f | 2016-11-24 15:54:51 +0000 | [diff] [blame] | 10 | license: 'MIT/Expat', |
| 11 | ) |
| 12 | |
Pekka Paalanen | a0f4a16 | 2020-10-27 13:27:05 +0200 | [diff] [blame] | 13 | libweston_major = 10 |
Daniel Stone | 8011b0f | 2016-11-24 15:54:51 +0000 | [diff] [blame] | 14 | |
| 15 | # libweston_revision is manufactured to follow the autotools build's |
| 16 | # library file naming, thanks to libtool |
| 17 | version_weston = meson.project_version() |
| 18 | version_weston_arr = version_weston.split('.') |
| 19 | if 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 |
| 24 | elif libweston_major == version_weston_arr[0].to_int() |
| 25 | libweston_revision = version_weston_arr[2].to_int() |
| 26 | else |
| 27 | error('Bad versions in meson.build: libweston_major is too low') |
| 28 | endif |
| 29 | |
| 30 | dir_prefix = get_option('prefix') |
| 31 | dir_bin = join_paths(dir_prefix, get_option('bindir')) |
| 32 | dir_data = join_paths(dir_prefix, get_option('datadir')) |
Daniel Stone | 8011b0f | 2016-11-24 15:54:51 +0000 | [diff] [blame] | 33 | dir_include_libweston = 'libweston-@0@'.format(libweston_major) |
Pekka Paalanen | a78cf77 | 2019-03-28 16:35:56 +0200 | [diff] [blame] | 34 | dir_include_libweston_install = join_paths(dir_include_libweston, 'libweston') |
Daniel Stone | 8011b0f | 2016-11-24 15:54:51 +0000 | [diff] [blame] | 35 | dir_lib = join_paths(dir_prefix, get_option('libdir')) |
| 36 | dir_libexec = join_paths(dir_prefix, get_option('libexecdir')) |
| 37 | dir_module_weston = join_paths(dir_lib, 'weston') |
| 38 | dir_module_libweston = join_paths(dir_lib, 'libweston-@0@'.format(libweston_major)) |
| 39 | dir_data_pc = join_paths(dir_data, 'pkgconfig') |
| 40 | dir_lib_pc = join_paths(dir_lib, 'pkgconfig') |
| 41 | dir_man = join_paths(dir_prefix, get_option('mandir')) |
Quentin Glidic | b5c70d7 | 2019-07-22 22:11:38 +0200 | [diff] [blame] | 42 | dir_protocol_libweston = join_paths('libweston-@0@'.format(libweston_major), 'protocols') |
Daniel Stone | 8011b0f | 2016-11-24 15:54:51 +0000 | [diff] [blame] | 43 | |
Pekka Paalanen | a78cf77 | 2019-03-28 16:35:56 +0200 | [diff] [blame] | 44 | public_inc = include_directories('include') |
Pekka Paalanen | 4f5e360 | 2019-04-05 17:09:28 +0300 | [diff] [blame] | 45 | common_inc = [ include_directories('.'), public_inc ] |
Pekka Paalanen | a78cf77 | 2019-03-28 16:35:56 +0200 | [diff] [blame] | 46 | |
Daniel Stone | 8011b0f | 2016-11-24 15:54:51 +0000 | [diff] [blame] | 47 | pkgconfig = import('pkgconfig') |
| 48 | |
Daniel Stone | 8011b0f | 2016-11-24 15:54:51 +0000 | [diff] [blame] | 49 | git_version_h = vcs_tag( |
| 50 | input: 'libweston/git-version.h.meson', |
| 51 | output: 'git-version.h', |
| 52 | fallback: version_weston |
| 53 | ) |
| 54 | |
| 55 | config_h = configuration_data() |
| 56 | |
| 57 | cc = meson.get_compiler('c') |
| 58 | |
| 59 | global_args = [] |
| 60 | global_args_maybe = [ |
Guillaume Champagne | 556afd1 | 2020-01-26 18:24:44 -0500 | [diff] [blame] | 61 | '-Wmissing-prototypes', |
Eric Engestrom | 29a6803 | 2019-01-10 14:57:05 +0000 | [diff] [blame] | 62 | '-Wno-unused-parameter', |
| 63 | '-Wno-shift-negative-value', # required due to Pixman |
| 64 | '-Wno-missing-field-initializers', |
Daniel Stone | 34473d7 | 2019-06-11 11:40:13 +0100 | [diff] [blame] | 65 | '-Wno-pedantic', |
Pekka Paalanen | cde58fd | 2021-03-03 14:01:40 +0200 | [diff] [blame] | 66 | '-Wundef', |
Daniel Stone | 8011b0f | 2016-11-24 15:54:51 +0000 | [diff] [blame] | 67 | '-fvisibility=hidden', |
Daniel Stone | 8011b0f | 2016-11-24 15:54:51 +0000 | [diff] [blame] | 68 | ] |
| 69 | foreach a : global_args_maybe |
| 70 | if cc.has_argument(a) |
| 71 | global_args += a |
| 72 | endif |
| 73 | endforeach |
Daniel Stone | 8011b0f | 2016-11-24 15:54:51 +0000 | [diff] [blame] | 74 | add_global_arguments(global_args, language: 'c') |
| 75 | |
| 76 | if cc.has_header_symbol('sys/sysmacros.h', 'major') |
| 77 | config_h.set('MAJOR_IN_SYSMACROS', 1) |
| 78 | elif cc.has_header_symbol('sys/mkdev.h', 'major') |
| 79 | config_h.set('MAJOR_IN_MKDEV', 1) |
| 80 | endif |
| 81 | |
| 82 | optional_libc_funcs = [ |
Emmanuel Gil Peyrot | deae98e | 2019-07-22 15:06:20 +0200 | [diff] [blame] | 83 | 'mkostemp', 'strchrnul', 'initgroups', 'posix_fallocate', 'memfd_create' |
Daniel Stone | 8011b0f | 2016-11-24 15:54:51 +0000 | [diff] [blame] | 84 | ] |
| 85 | foreach func : optional_libc_funcs |
| 86 | if cc.has_function(func) |
| 87 | config_h.set('HAVE_' + func.to_upper(), 1) |
| 88 | endif |
| 89 | endforeach |
| 90 | |
| 91 | optional_system_headers = [ |
| 92 | 'linux/sync_file.h' |
| 93 | ] |
| 94 | foreach hdr : optional_system_headers |
| 95 | if cc.has_header(hdr) |
| 96 | config_h.set('HAVE_' + hdr.underscorify().to_upper(), 1) |
| 97 | endif |
| 98 | endforeach |
| 99 | |
| 100 | env_modmap = '' |
| 101 | |
| 102 | config_h.set('_GNU_SOURCE', '1') |
| 103 | config_h.set('_ALL_SOURCE', '1') |
Pekka Paalanen | 6510b2a | 2020-01-24 15:11:13 +0200 | [diff] [blame] | 104 | config_h.set('EGL_NO_X11', '1') |
| 105 | config_h.set('MESA_EGL_NO_X11_HEADERS', '1') |
Heiko Thiery | 526765d | 2020-10-23 22:39:35 +0200 | [diff] [blame] | 106 | config_h.set('EGL_NO_PLATFORM_SPECIFIC_TYPES', '1') |
Daniel Stone | 8011b0f | 2016-11-24 15:54:51 +0000 | [diff] [blame] | 107 | |
| 108 | config_h.set_quoted('PACKAGE_STRING', 'weston @0@'.format(version_weston)) |
| 109 | config_h.set_quoted('PACKAGE_VERSION', version_weston) |
| 110 | config_h.set_quoted('VERSION', version_weston) |
| 111 | config_h.set_quoted('PACKAGE_URL', 'https://wayland.freedesktop.org') |
| 112 | config_h.set_quoted('PACKAGE_BUGREPORT', 'https://gitlab.freedesktop.org/wayland/weston/issues/') |
| 113 | |
| 114 | config_h.set_quoted('BINDIR', dir_bin) |
| 115 | config_h.set_quoted('DATADIR', dir_data) |
| 116 | config_h.set_quoted('LIBEXECDIR', dir_libexec) |
| 117 | config_h.set_quoted('MODULEDIR', dir_module_weston) |
| 118 | config_h.set_quoted('LIBWESTON_MODULEDIR', dir_module_libweston) |
| 119 | |
Pekka Paalanen | 1618697 | 2020-02-04 16:59:59 +0200 | [diff] [blame] | 120 | config_h.set10('TEST_GL_RENDERER', get_option('test-gl-renderer')) |
| 121 | |
Daniel Stone | 8011b0f | 2016-11-24 15:54:51 +0000 | [diff] [blame] | 122 | backend_default = get_option('backend-default') |
| 123 | if 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 |
| 129 | endif |
| 130 | opt_backend_native = backend_default + '-backend.so' |
| 131 | config_h.set_quoted('WESTON_NATIVE_BACKEND', opt_backend_native) |
| 132 | message('The default backend is ' + backend_default) |
| 133 | if not get_option('backend-' + backend_default) |
| 134 | error('Backend @0@ was chosen as native but is not being built.'.format(backend_default)) |
| 135 | endif |
| 136 | |
| 137 | dep_xkbcommon = dependency('xkbcommon', version: '>= 0.3.0') |
| 138 | if dep_xkbcommon.version().version_compare('>= 0.5.0') |
| 139 | config_h.set('HAVE_XKBCOMMON_COMPOSE', '1') |
| 140 | endif |
| 141 | |
Simon Ser | 413d210 | 2021-02-16 13:34:46 +0100 | [diff] [blame] | 142 | if get_option('deprecated-wl-shell') |
Simon Ser | 2839e61 | 2022-01-20 13:27:01 +0100 | [diff] [blame] | 143 | warning('Support for the deprecated wl_shell interface is enabled.') |
| 144 | warning('This feature will be removed in a future version.') |
Simon Ser | 413d210 | 2021-02-16 13:34:46 +0100 | [diff] [blame] | 145 | config_h.set('HAVE_DEPRECATED_WL_SHELL', '1') |
| 146 | endif |
| 147 | |
Pekka Paalanen | 30104bd | 2021-02-08 16:29:51 +0200 | [diff] [blame] | 148 | dep_wayland_server = dependency('wayland-server', version: '>= 1.18.0') |
| 149 | dep_wayland_client = dependency('wayland-client', version: '>= 1.18.0') |
Daniel Stone | 8011b0f | 2016-11-24 15:54:51 +0000 | [diff] [blame] | 150 | dep_pixman = dependency('pixman-1', version: '>= 0.25.2') |
| 151 | dep_libinput = dependency('libinput', version: '>= 0.8.0') |
Eric Toombs | 6e229ca | 2019-01-31 21:53:25 -0500 | [diff] [blame] | 152 | dep_libevdev = dependency('libevdev') |
Daniel Stone | 8011b0f | 2016-11-24 15:54:51 +0000 | [diff] [blame] | 153 | dep_libm = cc.find_library('m') |
limin.tian | 531dd23 | 2025-01-07 12:09:27 +0000 | [diff] [blame] | 154 | dep_liblog = cc.find_library('liblog') |
Daniel Stone | 8011b0f | 2016-11-24 15:54:51 +0000 | [diff] [blame] | 155 | dep_libdl = cc.find_library('dl') |
Pekka Paalanen | 9b94a7d | 2020-09-16 17:11:40 +0300 | [diff] [blame] | 156 | dep_libdrm = dependency('libdrm', version: '>= 2.4.95') |
Daniel Stone | 8011b0f | 2016-11-24 15:54:51 +0000 | [diff] [blame] | 157 | dep_libdrm_headers = dep_libdrm.partial_dependency(compile_args: true) |
Daniel Stone | 8011b0f | 2016-11-24 15:54:51 +0000 | [diff] [blame] | 158 | dep_threads = dependency('threads') |
| 159 | |
Marius Vlad | 6f6fd26 | 2021-07-12 12:58:34 +0300 | [diff] [blame] | 160 | dep_libdrm_version = dep_libdrm.version() |
| 161 | if dep_libdrm_version.version_compare('>=2.4.107') |
| 162 | message('Found libdrm with human format modifier support.') |
| 163 | config_h.set('HAVE_HUMAN_FORMAT_MODIFIER', '1') |
| 164 | endif |
| 165 | |
Pekka Paalanen | d913363 | 2020-11-25 13:22:26 +0200 | [diff] [blame] | 166 | prog_python = import('python').find_installation('python3') |
| 167 | files_xxd_py = files('tools/xxd.py') |
| 168 | cmd_xxd = [ prog_python, files_xxd_py, '@INPUT@', '@OUTPUT@' ] |
| 169 | |
Pekka Paalanen | a78cf77 | 2019-03-28 16:35:56 +0200 | [diff] [blame] | 170 | subdir('include') |
Daniel Stone | 8011b0f | 2016-11-24 15:54:51 +0000 | [diff] [blame] | 171 | subdir('protocol') |
| 172 | subdir('shared') |
| 173 | subdir('libweston') |
| 174 | subdir('libweston-desktop') |
| 175 | subdir('xwayland') |
| 176 | subdir('compositor') |
| 177 | subdir('desktop-shell') |
| 178 | subdir('fullscreen-shell') |
| 179 | subdir('ivi-shell') |
Alexandros Frantzis | 87c1679 | 2020-04-21 18:23:37 +0300 | [diff] [blame] | 180 | subdir('kiosk-shell') |
Daniel Stone | 8011b0f | 2016-11-24 15:54:51 +0000 | [diff] [blame] | 181 | subdir('remoting') |
Michael Olbrich | d5d5aa9 | 2019-04-23 12:34:05 +0200 | [diff] [blame] | 182 | subdir('pipewire') |
Daniel Stone | 8011b0f | 2016-11-24 15:54:51 +0000 | [diff] [blame] | 183 | subdir('clients') |
| 184 | subdir('wcap') |
| 185 | subdir('tests') |
| 186 | subdir('data') |
| 187 | subdir('man') |
leng.fang | dbaf6fa | 2024-06-20 19:31:04 +0800 | [diff] [blame] | 188 | subdir('simpleshell') |
Daniel Stone | 8011b0f | 2016-11-24 15:54:51 +0000 | [diff] [blame] | 189 | |
Harish Krupo | b81fc51 | 2019-04-16 10:41:01 +0530 | [diff] [blame] | 190 | configure_file(output: 'config.h', configuration: config_h) |
| 191 | |
Marius Vlad | bbf6ea0 | 2019-06-14 12:41:02 +0300 | [diff] [blame] | 192 | if get_option('doc') |
| 193 | subdir('doc/sphinx') |
| 194 | else |
| 195 | message('Documentation will not be built. Use -Ddoc to build it.') |
| 196 | endif |