Daniel Stone | 8011b0f | 2016-11-24 15:54:51 +0000 | [diff] [blame] | 1 | project('weston', |
| 2 | 'c', |
Simon Ser | 0fa4103 | 2020-01-17 23:18:24 +0100 | [diff] [blame] | 3 | version: '7.0.93', |
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 | ], |
| 9 | meson_version: '>= 0.47', |
| 10 | license: 'MIT/Expat', |
| 11 | ) |
| 12 | |
Marius Vlad | 9bb1c3a | 2019-07-29 12:02:47 +0300 | [diff] [blame] | 13 | libweston_major = 8 |
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 = [ |
Eric Engestrom | 29a6803 | 2019-01-10 14:57:05 +0000 | [diff] [blame] | 61 | '-Wno-unused-parameter', |
| 62 | '-Wno-shift-negative-value', # required due to Pixman |
| 63 | '-Wno-missing-field-initializers', |
Daniel Stone | 34473d7 | 2019-06-11 11:40:13 +0100 | [diff] [blame] | 64 | '-Wno-pedantic', |
Daniel Stone | 8011b0f | 2016-11-24 15:54:51 +0000 | [diff] [blame] | 65 | '-fvisibility=hidden', |
Daniel Stone | 8011b0f | 2016-11-24 15:54:51 +0000 | [diff] [blame] | 66 | ] |
| 67 | foreach a : global_args_maybe |
| 68 | if cc.has_argument(a) |
| 69 | global_args += a |
| 70 | endif |
| 71 | endforeach |
Daniel Stone | 8011b0f | 2016-11-24 15:54:51 +0000 | [diff] [blame] | 72 | add_global_arguments(global_args, language: 'c') |
| 73 | |
| 74 | if cc.has_header_symbol('sys/sysmacros.h', 'major') |
| 75 | config_h.set('MAJOR_IN_SYSMACROS', 1) |
| 76 | elif cc.has_header_symbol('sys/mkdev.h', 'major') |
| 77 | config_h.set('MAJOR_IN_MKDEV', 1) |
| 78 | endif |
| 79 | |
| 80 | optional_libc_funcs = [ |
Emmanuel Gil Peyrot | deae98e | 2019-07-22 15:06:20 +0200 | [diff] [blame] | 81 | 'mkostemp', 'strchrnul', 'initgroups', 'posix_fallocate', 'memfd_create' |
Daniel Stone | 8011b0f | 2016-11-24 15:54:51 +0000 | [diff] [blame] | 82 | ] |
| 83 | foreach func : optional_libc_funcs |
| 84 | if cc.has_function(func) |
| 85 | config_h.set('HAVE_' + func.to_upper(), 1) |
| 86 | endif |
| 87 | endforeach |
| 88 | |
| 89 | optional_system_headers = [ |
| 90 | 'linux/sync_file.h' |
| 91 | ] |
| 92 | foreach hdr : optional_system_headers |
| 93 | if cc.has_header(hdr) |
| 94 | config_h.set('HAVE_' + hdr.underscorify().to_upper(), 1) |
| 95 | endif |
| 96 | endforeach |
| 97 | |
| 98 | env_modmap = '' |
| 99 | |
| 100 | config_h.set('_GNU_SOURCE', '1') |
| 101 | config_h.set('_ALL_SOURCE', '1') |
Pekka Paalanen | 6510b2a | 2020-01-24 15:11:13 +0200 | [diff] [blame^] | 102 | config_h.set('EGL_NO_X11', '1') |
| 103 | config_h.set('MESA_EGL_NO_X11_HEADERS', '1') |
Daniel Stone | 8011b0f | 2016-11-24 15:54:51 +0000 | [diff] [blame] | 104 | |
| 105 | config_h.set_quoted('PACKAGE_STRING', 'weston @0@'.format(version_weston)) |
| 106 | config_h.set_quoted('PACKAGE_VERSION', version_weston) |
| 107 | config_h.set_quoted('VERSION', version_weston) |
| 108 | config_h.set_quoted('PACKAGE_URL', 'https://wayland.freedesktop.org') |
| 109 | config_h.set_quoted('PACKAGE_BUGREPORT', 'https://gitlab.freedesktop.org/wayland/weston/issues/') |
| 110 | |
| 111 | config_h.set_quoted('BINDIR', dir_bin) |
| 112 | config_h.set_quoted('DATADIR', dir_data) |
| 113 | config_h.set_quoted('LIBEXECDIR', dir_libexec) |
| 114 | config_h.set_quoted('MODULEDIR', dir_module_weston) |
| 115 | config_h.set_quoted('LIBWESTON_MODULEDIR', dir_module_libweston) |
| 116 | |
| 117 | backend_default = get_option('backend-default') |
| 118 | if 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 |
| 124 | endif |
| 125 | opt_backend_native = backend_default + '-backend.so' |
| 126 | config_h.set_quoted('WESTON_NATIVE_BACKEND', opt_backend_native) |
| 127 | message('The default backend is ' + backend_default) |
| 128 | if not get_option('backend-' + backend_default) |
| 129 | error('Backend @0@ was chosen as native but is not being built.'.format(backend_default)) |
| 130 | endif |
| 131 | |
| 132 | dep_xkbcommon = dependency('xkbcommon', version: '>= 0.3.0') |
| 133 | if dep_xkbcommon.version().version_compare('>= 0.5.0') |
| 134 | config_h.set('HAVE_XKBCOMMON_COMPOSE', '1') |
| 135 | endif |
| 136 | |
Sebastian Wick | fcc6ff7 | 2019-11-01 02:09:28 +0100 | [diff] [blame] | 137 | dep_wayland_server = dependency('wayland-server', version: '>= 1.17.0') |
| 138 | dep_wayland_client = dependency('wayland-client', version: '>= 1.17.0') |
Daniel Stone | 8011b0f | 2016-11-24 15:54:51 +0000 | [diff] [blame] | 139 | dep_pixman = dependency('pixman-1', version: '>= 0.25.2') |
| 140 | dep_libinput = dependency('libinput', version: '>= 0.8.0') |
Eric Toombs | 6e229ca | 2019-01-31 21:53:25 -0500 | [diff] [blame] | 141 | dep_libevdev = dependency('libevdev') |
Daniel Stone | 8011b0f | 2016-11-24 15:54:51 +0000 | [diff] [blame] | 142 | dep_libm = cc.find_library('m') |
| 143 | dep_libdl = cc.find_library('dl') |
Daniel Stone | 6093772 | 2019-11-26 10:48:12 +0000 | [diff] [blame] | 144 | dep_libdrm = dependency('libdrm', version: '>= 2.4.86') |
Daniel Stone | 8011b0f | 2016-11-24 15:54:51 +0000 | [diff] [blame] | 145 | dep_libdrm_headers = dep_libdrm.partial_dependency(compile_args: true) |
Daniel Stone | 8011b0f | 2016-11-24 15:54:51 +0000 | [diff] [blame] | 146 | dep_threads = dependency('threads') |
| 147 | |
Pekka Paalanen | a78cf77 | 2019-03-28 16:35:56 +0200 | [diff] [blame] | 148 | subdir('include') |
Daniel Stone | 8011b0f | 2016-11-24 15:54:51 +0000 | [diff] [blame] | 149 | subdir('protocol') |
| 150 | subdir('shared') |
| 151 | subdir('libweston') |
| 152 | subdir('libweston-desktop') |
| 153 | subdir('xwayland') |
| 154 | subdir('compositor') |
| 155 | subdir('desktop-shell') |
| 156 | subdir('fullscreen-shell') |
| 157 | subdir('ivi-shell') |
| 158 | subdir('remoting') |
Michael Olbrich | d5d5aa9 | 2019-04-23 12:34:05 +0200 | [diff] [blame] | 159 | subdir('pipewire') |
Daniel Stone | 8011b0f | 2016-11-24 15:54:51 +0000 | [diff] [blame] | 160 | subdir('clients') |
| 161 | subdir('wcap') |
| 162 | subdir('tests') |
| 163 | subdir('data') |
| 164 | subdir('man') |
| 165 | |
Harish Krupo | b81fc51 | 2019-04-16 10:41:01 +0530 | [diff] [blame] | 166 | configure_file(output: 'config.h', configuration: config_h) |
| 167 | |
Marius Vlad | bbf6ea0 | 2019-06-14 12:41:02 +0300 | [diff] [blame] | 168 | if get_option('doc') |
| 169 | subdir('doc/sphinx') |
| 170 | else |
| 171 | message('Documentation will not be built. Use -Ddoc to build it.') |
| 172 | endif |