mirror of
https://github.com/swaywm/sway.git
synced 2024-11-25 09:21:28 +00:00
Use Meson feature options
This commit is contained in:
parent
5a0c4234b8
commit
08a5b304e4
18
meson.build
18
meson.build
|
@ -2,6 +2,7 @@ project(
|
|||
'sway',
|
||||
'c',
|
||||
license: 'MIT',
|
||||
meson_version: '>=0.48.0',
|
||||
default_options: [
|
||||
'c_std=c11',
|
||||
'warning_level=2',
|
||||
|
@ -53,21 +54,26 @@ libpam = cc.find_library('pam', required: false)
|
|||
crypt = cc.find_library('crypt', required: false)
|
||||
systemd = dependency('libsystemd', required: false)
|
||||
elogind = dependency('libelogind', required: false)
|
||||
xcb = dependency('xcb', required: get_option('xwayland'))
|
||||
math = cc.find_library('m')
|
||||
rt = cc.find_library('rt')
|
||||
git = find_program('git', required: false)
|
||||
|
||||
have_xwayland = xcb.found()
|
||||
|
||||
tray_deps_found = systemd.found() or elogind.found()
|
||||
if get_option('tray').enabled() and not tray_deps_found
|
||||
error('Building with -Dtray=enabled, but libsystemd and libelogind have not been not found')
|
||||
endif
|
||||
have_tray = (not get_option('tray').disabled()) and tray_deps_found
|
||||
|
||||
conf_data = configuration_data()
|
||||
|
||||
conf_data.set10('HAVE_XWAYLAND', get_option('enable-xwayland'))
|
||||
if get_option('enable-xwayland')
|
||||
xcb = dependency('xcb')
|
||||
endif
|
||||
|
||||
conf_data.set10('HAVE_XWAYLAND', have_xwayland)
|
||||
conf_data.set10('HAVE_GDK_PIXBUF', gdk_pixbuf.found())
|
||||
conf_data.set10('HAVE_SYSTEMD', systemd.found())
|
||||
conf_data.set10('HAVE_ELOGIND', elogind.found())
|
||||
conf_data.set10('HAVE_TRAY', get_option('enable-tray') and (systemd.found() or elogind.found()))
|
||||
conf_data.set10('HAVE_TRAY', have_tray)
|
||||
|
||||
if not systemd.found() and not elogind.found()
|
||||
warning('The sway binary must be setuid when compiled without (e)logind')
|
||||
|
|
|
@ -5,5 +5,5 @@ option('default-wallpaper', type: 'boolean', value: true, description: 'Install
|
|||
option('zsh-completions', type: 'boolean', value: true, description: 'Install zsh shell completions.')
|
||||
option('bash-completions', type: 'boolean', value: true, description: 'Install bash shell completions.')
|
||||
option('fish-completions', type: 'boolean', value: true, description: 'Install fish shell completions.')
|
||||
option('enable-xwayland', type: 'boolean', value: true, description: 'Enable support for X11 applications')
|
||||
option('enable-tray', type: 'boolean', value: false, description: 'Enable support for swaybar tray')
|
||||
option('xwayland', type: 'feature', value: 'auto', description: 'Enable support for X11 applications')
|
||||
option('tray', type: 'feature', value: 'auto', description: 'Enable support for swaybar tray')
|
||||
|
|
|
@ -194,7 +194,7 @@ sway_deps = [
|
|||
xkbcommon,
|
||||
]
|
||||
|
||||
if get_option('enable-xwayland')
|
||||
if have_xwayland
|
||||
sway_sources += 'desktop/xwayland.c'
|
||||
sway_deps += xcb
|
||||
endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
tray_files = get_option('enable-tray') ? [
|
||||
tray_files = have_tray ? [
|
||||
'tray/host.c',
|
||||
'tray/icon.c',
|
||||
'tray/item.c',
|
||||
|
@ -19,7 +19,7 @@ swaybar_deps = [
|
|||
wayland_cursor,
|
||||
wlroots,
|
||||
]
|
||||
if get_option('enable-tray')
|
||||
if have_tray
|
||||
if systemd.found()
|
||||
swaybar_deps += systemd
|
||||
elif elogind.found()
|
||||
|
|
Loading…
Reference in a new issue