aboutsummaryrefslogtreecommitdiffstats
path: root/meson.build
diff options
context:
space:
mode:
authorLibravatar Simon Ser <contact@emersion.fr>2021-02-16 00:01:32 +0100
committerLibravatar Tudor Brindus <me@tbrindus.ca>2021-02-21 17:16:14 -0500
commitb4950e2a6d35d7db06309f4b8f5222a7fc65a059 (patch)
treef663c7d4d5546ca1d1e5437d0f7a9ef4facdcd69 /meson.build
parentFix typo in README.dk.md (diff)
downloadsway-b4950e2a6d35d7db06309f4b8f5222a7fc65a059.tar.gz
sway-b4950e2a6d35d7db06309f4b8f5222a7fc65a059.tar.zst
sway-b4950e2a6d35d7db06309f4b8f5222a7fc65a059.zip
build: use wlroots dependency variables
Instead of manually parsing header files and having two different code-paths depending on whether a subproject is used, use dependency variables which can come from either the subproject or pkg-config. References: https://github.com/swaywm/wlroots/pull/2734
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build25
1 files changed, 11 insertions, 14 deletions
diff --git a/meson.build b/meson.build
index 38a55678..9177ca33 100644
--- a/meson.build
+++ b/meson.build
@@ -65,26 +65,23 @@ wlroots_proj = subproject(
65 required: false, 65 required: false,
66 version: wlroots_version, 66 version: wlroots_version,
67) 67)
68if wlroots_proj.found()
69 wlroots = wlroots_proj.get_variable('wlroots')
70else
71 wlroots = dependency('wlroots', version: wlroots_version)
72endif
73
68wlroots_features = { 74wlroots_features = {
69 'xwayland': false, 75 'xwayland': false,
70 'systemd': false, 76 'systemd': false,
71 'elogind': false, 77 'elogind': false,
72 'libseat': false, 78 'libseat': false,
73} 79}
74if wlroots_proj.found() 80foreach name, _ : wlroots_features
75 wlroots = wlroots_proj.get_variable('wlroots') 81 var_name = 'have_' + name.underscorify()
76 wlroots_conf = wlroots_proj.get_variable('conf_data') 82 have = wlroots.get_variable(pkgconfig: var_name, internal: var_name) == 'true'
77 foreach name, _ : wlroots_features 83 wlroots_features += { name: have }
78 has = wlroots_conf.get('WLR_HAS_' + name.to_upper()) == 1 84endforeach
79 wlroots_features += { name: has }
80 endforeach
81else
82 wlroots = dependency('wlroots', version: wlroots_version)
83 foreach name, _ : wlroots_features
84 has = cc.get_define('WLR_HAS_' + name.to_upper(), prefix: '#include <wlr/config.h>', dependencies: wlroots) == '1'
85 wlroots_features += { name: has }
86 endforeach
87endif
88 85
89if get_option('xwayland').enabled() and not wlroots_features['xwayland'] 86if get_option('xwayland').enabled() and not wlroots_features['xwayland']
90 error('Cannot enable Xwayland in sway: wlroots has been built without Xwayland support') 87 error('Cannot enable Xwayland in sway: wlroots has been built without Xwayland support')