diff options
author | Simon Ser <contact@emersion.fr> | 2021-02-16 00:01:32 +0100 |
---|---|---|
committer | Tudor Brindus <me@tbrindus.ca> | 2021-02-21 17:16:14 -0500 |
commit | b4950e2a6d35d7db06309f4b8f5222a7fc65a059 (patch) | |
tree | f663c7d4d5546ca1d1e5437d0f7a9ef4facdcd69 /meson.build | |
parent | Fix typo in README.dk.md (diff) | |
download | sway-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.build | 25 |
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 | ) |
68 | if wlroots_proj.found() | ||
69 | wlroots = wlroots_proj.get_variable('wlroots') | ||
70 | else | ||
71 | wlroots = dependency('wlroots', version: wlroots_version) | ||
72 | endif | ||
73 | |||
68 | wlroots_features = { | 74 | wlroots_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 | } |
74 | if wlroots_proj.found() | 80 | foreach 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 | 84 | endforeach |
79 | wlroots_features += { name: has } | ||
80 | endforeach | ||
81 | else | ||
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 | ||
87 | endif | ||
88 | 85 | ||
89 | if get_option('xwayland').enabled() and not wlroots_features['xwayland'] | 86 | if 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') |