aboutsummaryrefslogtreecommitdiff
path: root/render/allocator/meson.build
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2022-05-29 14:09:06 +0200
committerSimon Zeni <simon@bl4ckb0ne.ca>2022-05-30 13:30:08 +0000
commitbb2946f7377b9e71c15457e93f6f9a34712b77de (patch)
tree5d3418525e4f87c1e77826bd96fc93a151384254 /render/allocator/meson.build
parentd483dd2f4caeeab97de97c4e8215f084945de63c (diff)
build: make GBM optional
Now that the DRM backend no longer depends on GBM, we can make it optional. The GLES2 renderer still depends on it because of our EGL device selection. This is useful for compositors with their own renderers, and for compositors using the Vulkan renderer.
Diffstat (limited to 'render/allocator/meson.build')
-rw-r--r--render/allocator/meson.build22
1 files changed, 19 insertions, 3 deletions
diff --git a/render/allocator/meson.build b/render/allocator/meson.build
index db17ccb2..f8e452df 100644
--- a/render/allocator/meson.build
+++ b/render/allocator/meson.build
@@ -1,9 +1,25 @@
+allocators = get_option('allocators')
+if 'auto' in allocators and get_option('auto_features').enabled()
+ allocators = ['gbm']
+elif 'auto' in renderers and get_option('auto_features').disabled()
+ allocators = []
+endif
+
wlr_files += files(
'allocator.c',
- 'gbm.c',
'shm.c',
'drm_dumb.c',
)
-has = cc.has_function('gbm_bo_get_fd_for_plane', dependencies: [gbm])
-add_project_arguments('-DHAS_GBM_BO_GET_FD_FOR_PLANE=@0@'.format(has.to_int()), language: 'c')
+gbm = disabler()
+if 'gbm' in allocators or 'auto' in allocators
+ gbm = dependency('gbm', version: '>=17.1.0', required: 'gbm' in allocators)
+endif
+if gbm.found()
+ wlr_files += files('gbm.c')
+ wlr_deps += gbm
+ features += { 'gbm-allocator': true }
+
+ has = cc.has_function('gbm_bo_get_fd_for_plane', dependencies: [gbm])
+ add_project_arguments('-DHAS_GBM_BO_GET_FD_FOR_PLANE=@0@'.format(has.to_int()), language: 'c')
+endif