meson: Add options to configure whether to build daemon, tools and modules.

This adds three meson options to enable or disable building daemon, tools, and modules.

Building the daemon or tools depends on building the modules, and disabling modules without disabling
the other two will result in meson giving an appropriate error.

These new options will let users skip building and installing unneeded items when they are not needed,
e.g. when only using the C API in another application.
This commit is contained in:
Tom A. Wagner 2022-11-16 11:29:13 +01:00 committed by George Kiagiadakis
parent 8d0542e968
commit 7586d4d858
5 changed files with 119 additions and 68 deletions

View File

@ -64,6 +64,28 @@ Additional options
The default value is **auto**, which means that documentation will be built
if **doxygen**, **sphinx** and **breathe** are found and skipped otherwise.
.. option:: -Dmodules=[true|false]
Build the wireplumber modules.
The default value is **true**.
.. option:: -Ddaemon=[true|false]
Build the session manager daemon.
The default value is **true**.
Requires **modules** option to be **true**.
.. option:: -Dtools=[true|false]
Enable or disable building tools.
The default value is **true**.
Requires **modules** option to be **true**.
.. option:: -Dsystem-lua=[enabled|disabled|auto]
Force using lua from the system instead of the bundled one.

View File

@ -33,6 +33,16 @@ add_project_arguments([
], language: 'c'
)
build_modules = get_option('modules')
build_daemon = get_option('daemon')
if build_daemon and not build_modules
error('\'modules\' option is required to be true when the \'daemon\' option is true')
endif
build_tools = get_option('tools')
if build_tools and not build_modules
error('\'modules\' option is required to be true when the \'tools\' option is enabled')
endif
glib_dep = dependency('glib-2.0', version : glib_req_version)
gobject_dep = dependency('gobject-2.0', version : glib_req_version)
gmodule_dep = dependency('gmodule-2.0', version : glib_req_version)
@ -44,54 +54,58 @@ mathlib = cc.find_library('m')
threads_dep = dependency('threads')
libintl_dep = dependency('intl')
system_lua = get_option('system-lua')
if system_lua
if get_option('system-lua-version') != 'auto'
lua_version_requested = get_option('system-lua-version')
lua_dep = dependency('lua-' + lua_version_requested, required: false)
if not lua_dep.found()
lua_dep = dependency('lua' + lua_version_requested, required: false)
endif
if build_modules
system_lua = get_option('system-lua')
if system_lua
if get_option('system-lua-version') != 'auto'
lua_version_requested = get_option('system-lua-version')
lua_dep = dependency('lua-' + lua_version_requested, required: false)
if not lua_dep.found()
lua_dep = dependency('lua' + lua_version_requested, required: false)
endif
if not lua_dep.found()
error('Specified Lua version "' + lua_version_requested + '" not found')
if not lua_dep.found()
error('Specified Lua version "' + lua_version_requested + '" not found')
endif
else
lua_dep = dependency('lua-5.4', required: false)
if not lua_dep.found()
lua_dep = dependency('lua5.4', required: false)
endif
if not lua_dep.found()
lua_dep = dependency('lua54', required: false)
endif
if not lua_dep.found()
lua_dep = dependency('lua-5.3', required: false)
endif
if not lua_dep.found()
lua_dep = dependency('lua5.3', required: false)
endif
if not lua_dep.found()
lua_dep = dependency('lua53', required: false)
endif
if not lua_dep.found()
lua_dep = dependency('lua', version: ['>=5.3.0'], required: false)
endif
if not lua_dep.found()
error ('Could not find lua. Lua version 5.4 or 5.3 required')
endif
endif
else
lua_dep = dependency('lua-5.4', required: false)
if not lua_dep.found()
lua_dep = dependency('lua5.4', required: false)
endif
if not lua_dep.found()
lua_dep = dependency('lua54', required: false)
endif
if not lua_dep.found()
lua_dep = dependency('lua-5.3', required: false)
endif
if not lua_dep.found()
lua_dep = dependency('lua5.3', required: false)
endif
if not lua_dep.found()
lua_dep = dependency('lua53', required: false)
endif
if not lua_dep.found()
lua_dep = dependency('lua', version: ['>=5.3.0'], required: false)
endif
if not lua_dep.found()
error ('Could not find lua. Lua version 5.4 or 5.3 required')
endif
lua_proj = subproject('lua', default_options: ['default_library=static'])
lua_dep = lua_proj.get_variable('lua_dep')
endif
else
lua_proj = subproject('lua', default_options: ['default_library=static'])
lua_dep = lua_proj.get_variable('lua_dep')
summary({'Lua version': lua_dep.version() + (system_lua ? ' (system)' : ' (built-in)')})
endif
summary({'Lua version': lua_dep.version() + (system_lua ? ' (system)' : ' (built-in)')})
systemd = dependency('systemd', required: get_option('systemd'))
libsystemd_dep = dependency('libsystemd',required: get_option('systemd'))
libelogind_dep = dependency('libelogind', required: get_option('elogind'))
summary({'systemd conf data': systemd.found(),
'libsystemd': libsystemd_dep.found(),
'libelogind': libelogind_dep.found()}, bool_yn: true)
if build_modules
systemd = dependency('systemd', required: get_option('systemd'))
libsystemd_dep = dependency('libsystemd',required: get_option('systemd'))
libelogind_dep = dependency('libelogind', required: get_option('elogind'))
summary({'systemd conf data': systemd.found(),
'libsystemd': libsystemd_dep.found(),
'libelogind': libelogind_dep.found()}, bool_yn: true)
endif
gnome = import('gnome')
pkgconfig = import('pkgconfig')
@ -121,7 +135,9 @@ add_project_arguments(cc.get_supported_arguments(common_flags), language: 'c')
subdir('lib')
subdir('docs')
subdir('modules')
if build_modules
subdir('modules')
endif
subdir('src')
subdir('po')

View File

@ -2,6 +2,12 @@ option('introspection', type : 'feature', value : 'auto',
description : 'Generate gobject-introspection bindings')
option('doc', type : 'feature', value : 'auto',
description: 'Enable documentation.')
option('modules', type : 'boolean', value: 'true',
description : 'Build modules')
option('daemon', type : 'boolean', value: 'true',
description : 'Build session manager daemon')
option('tools', type : 'boolean', value: 'true',
description : 'Build CLI tools')
option('system-lua', type : 'boolean', value : 'false',
description : 'Use lua from the system instead of the bundled one')
option('system-lua-version',

View File

@ -1,26 +1,31 @@
wp_sources = [
'main.c',
]
if build_tools
subdir('tools')
endif
install_subdir('config',
install_dir: wireplumber_data_dir,
strip_directory : true
)
install_subdir('scripts',
install_dir: wireplumber_data_dir,
strip_directory : false
)
if build_daemon
subdir('systemd')
subdir('systemd')
subdir('tools')
install_subdir('config',
install_dir: wireplumber_data_dir,
strip_directory : true
)
install_subdir('scripts',
install_dir: wireplumber_data_dir,
strip_directory : false
)
wireplumber = executable('wireplumber',
wp_sources,
c_args : [
'-D_GNU_SOURCE',
'-DG_LOG_USE_STRUCTURED',
'-DG_LOG_DOMAIN="wireplumber"',
],
install: true,
dependencies : [gobject_dep, gio_dep, wp_dep, pipewire_dep],
)
wp_sources = [
'main.c',
]
wireplumber = executable('wireplumber',
wp_sources,
c_args : [
'-D_GNU_SOURCE',
'-DG_LOG_USE_STRUCTURED',
'-DG_LOG_DOMAIN="wireplumber"',
],
install: true,
dependencies : [gobject_dep, gio_dep, wp_dep, pipewire_dep],
)
endif

View File

@ -60,6 +60,8 @@ if pipewire_confdatadir != ''
endif
subdir('wp')
subdir('wplua')
subdir('modules')
if build_modules
subdir('wplua')
subdir('modules')
endif
subdir('examples')