Skip to content

Commit

Permalink
Detect wlroots features via pkgconfig
Browse files Browse the repository at this point in the history
* This works for both dependencies and subprojects.
* Error out if required backends and renderers are missing.

Signed-off-by: Alfred Wingate <[email protected]>
  • Loading branch information
parona-source committed Mar 18, 2024
1 parent f7bcad1 commit 2b31cfe
Showing 1 changed file with 36 additions and 13 deletions.
49 changes: 36 additions & 13 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,39 @@ elif get_option('use_system_wlroots').auto()
endif
endif

wlroots_features = {
'xwayland': false,
'drm_backend': false,
'gles2_renderer': false,
'libinput_backend': false,
'session': false,
'x11_backend': false,
}

foreach name, _ : wlroots_features
var_name = 'have_' + name.underscorify()
wlroots_features += { name: wlroots.get_variable(pkgconfig: var_name, internal: var_name) == 'true' }
endforeach

required_wlroots_features= [
'drm_backend',
'gles2_renderer',
'session',
'libinput_backend',
]
missing_wlroots_features = []

# Required features based on currently exposed public api
foreach required_feature : required_wlroots_features
if not wlroots_features[required_feature]
missing_wlroots_features += required_feature
endif
endforeach

if missing_wlroots_features.length() > 0
error('wlroots is missing the following required features: @0@'.format(' '.join(missing_wlroots_features)))
endif

# We're not to use system wlroots: So we'll use the subproject
if get_option('use_system_wfconfig').disabled()
use_system_wfconfig = false
Expand Down Expand Up @@ -138,17 +171,7 @@ wayfire_conf_inc = include_directories(['.'])

add_project_arguments(['-Wno-unused-parameter'], language: 'cpp')

have_xwayland = false
have_x11_backend = false
if use_system_wlroots
have_xwayland = cpp.get_define('WLR_HAS_XWAYLAND', prefix: '#include <wlr/config.h>', dependencies: wlroots) == '1'
have_x11_backend = cpp.get_define('WLR_HAS_X11_BACKEND', prefix: '#include <wlr/config.h>', dependencies: wlroots) == '1'
else
have_xwayland = subproject('wlroots').get_variable('conf_data').get('WLR_HAS_XWAYLAND', false) == 1
have_x11_backend = subproject('wlroots').get_variable('conf_data').get('WLR_HAS_X11_BACKEND', false) == 1
endif

if get_option('xwayland').enabled() and not have_xwayland
if get_option('xwayland').enabled() and not wlroots_features['xwayland']
error('Cannot enable Xwayland in wayfire: wlroots has been built without Xwayland support')
endif

Expand Down Expand Up @@ -201,8 +224,8 @@ summary = [
'',
'system wfconfig: @0@'.format(use_system_wfconfig),
' system wlroots: @0@'.format(use_system_wlroots),
' xwayland: @0@'.format(have_xwayland),
' x11-backend: @0@'.format(have_x11_backend),
' xwayland: @0@'.format(wlroots_features['xwayland']),
' x11-backend: @0@'.format(wlroots_features['x11_backend']),
' imageio: @0@'.format(conf_data.get('BUILD_WITH_IMAGEIO')),
' gles32: @0@'.format(conf_data.get('USE_GLES32')),
' print trace: @0@'.format(print_trace),
Expand Down

0 comments on commit 2b31cfe

Please sign in to comment.