install_dir: libds_bindir,
install : true)
-executable('tdm-backend',
- 'tdm-backend.c',
- dependencies: common_deps,
- install_dir: libds_bindir,
- install : true)
-
executable('tinyds',
'tinyds.c',
dependencies: [
install_dir: libds_bindir,
install : true)
-executable('tinyds-tdm',
- ['tinyds-tdm.c', 'tinyds-helper.c'],
- dependencies: [
- common_deps,
- dependency('pixman-1', required: true),
- dependency('libdrm', required: true),
- dependency('libtbm', required: true),
- ],
- install_dir: libds_bindir,
- install : true)
+if features.get('tdm-backend')
+ executable('tdm-backend',
+ 'tdm-backend.c',
+ dependencies: common_deps,
+ install_dir: libds_bindir,
+ install : true)
+
+ executable('tinyds-tdm',
+ ['tinyds-tdm.c', 'tinyds-helper.c'],
+ dependencies: [
+ common_deps,
+ dependency('pixman-1', required: true),
+ dependency('libdrm', required: true),
+ dependency('libtbm', required: true),
+ ],
+ install_dir: libds_bindir,
+ install : true)
+endif
+exclude_files = []
+if not features.get('tdm-backend')
+ exclude_files += 'backend/tdm.h'
+endif
+
+if not features.get('tbm-allocator')
+ exclude_files += 'allocator/tbm.h'
+endif
+
install_subdir('libds',
- install_dir: get_option('includedir')
+ install_dir: get_option('includedir'),
+ exclude_files: exclude_files,
)
cdata.set('LIBDS_VERSION_MINOR', libds_version_minor)
cdata.set('LIBDS_VERSION_PATCH', libds_version_patch)
+features = {
+ 'tdm-backend': false,
+ 'tbm-allocator': false,
+}
subdir('include')
subdir('src')
configure_file(output: 'config.h', install: false, configuration: cdata)
-pkgconfig = import('pkgconfig')
-pkgconfig.generate(lib_libds,
- version: meson.project_version(),
- filebase: meson.project_name(),
- name: meson.project_name(),
- description: 'Wayland compositor library',
-)
+summary(features, bool_yn: true)
--- /dev/null
+option('backends', type: 'array', choices: ['auto', 'tdm'], value: ['auto'], description: 'Select built-in backends')
--- /dev/null
+libds_files += files('shm.c')
+
+libtbm = dependency(
+ 'libtbm',
+ required: false,
+ not_found_message: 'Required for TBM allocator support.'
+)
+if libtbm.found()
+ libds_files += files('tbm.c')
+ libds_deps += libtbm
+ features += { 'tbm-allocator': true }
+endif
+all_backends = ['tdm']
+backends = get_option('backends')
+if 'auto' in backends and get_option('auto_features').enabled()
+ backends = all_backends
+elif 'auto' in backends and get_option('auto_features').disabled()
+ backends = []
+endif
+
+foreach backend : all_backends
+ if backend in backends or 'auto' in backends
+ subdir(backend)
+ endif
+endforeach
+
subdir('wayland')
-subdir('tdm')
+msg = ['Required for TDM backend support.']
+if 'tdm' in backends
+ msg += 'Install "libtdm" and "libtbm", or disable the tdm backend'
+endif
+
+libtdm = dependency(
+ 'libtdm',
+ required: 'tdm' in backends,
+ not_found_message: '\n'.join(msg)
+)
+
+libtbm = dependency(
+ 'libtbm',
+ required: 'tdm' in backends,
+ not_found_message: '\n'.join(msg)
+)
+
+if not libtdm.found() or not libtbm.found()
+ subdir_done()
+endif
+
libds_files += files(
'backend.c',
'output.c',
)
libds_deps += [
- dependency('libtdm', required: true),
+ libtdm,
+ libtbm
]
+
+features += { 'tdm-backend': true }
'log.c',
'addon.c',
'buffer.c',
- 'allocator/allocator.c',
- 'allocator/shm.c',
- 'allocator/tbm.c',
+ 'allocator.c',
'swapchain.c',
'output.c',
'compositor.c',
wayland_server = dependency('wayland-server', required: true)
pixman = dependency('pixman-1', required: true)
libdrm = dependency('libdrm', required: true)
-libtbm = dependency('libtbm', required: true)
libds_deps = [
math,
]
subdir('backend')
+subdir('allocator')
lib_libds = shared_library('ds', libds_files,
dependencies: libds_deps,
install: true
)
+ds_vars = {}
+foreach name, have : features
+ ds_vars += { 'have_' + name.underscorify(): have.to_string() }
+endforeach
+
dep_libds = declare_dependency(
link_with: lib_libds,
dependencies: libds_deps,
include_directories: [ common_inc, include_directories('.') ],
+ variables: ds_vars,
+)
+
+pkgconfig = import('pkgconfig')
+pkgconfig.generate(lib_libds,
+ version: meson.project_version(),
+ filebase: meson.project_name(),
+ name: meson.project_name(),
+ description: 'Wayland compositor library',
+ variables: ds_vars,
)