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 The default value is **auto**, which means that documentation will be built
if **doxygen**, **sphinx** and **breathe** are found and skipped otherwise. 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] .. option:: -Dsystem-lua=[enabled|disabled|auto]
Force using lua from the system instead of the bundled one. Force using lua from the system instead of the bundled one.

View File

@@ -33,6 +33,16 @@ add_project_arguments([
], language: 'c' ], 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) glib_dep = dependency('glib-2.0', version : glib_req_version)
gobject_dep = dependency('gobject-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) gmodule_dep = dependency('gmodule-2.0', version : glib_req_version)
@@ -44,8 +54,9 @@ mathlib = cc.find_library('m')
threads_dep = dependency('threads') threads_dep = dependency('threads')
libintl_dep = dependency('intl') libintl_dep = dependency('intl')
system_lua = get_option('system-lua') if build_modules
if system_lua system_lua = get_option('system-lua')
if system_lua
if get_option('system-lua-version') != 'auto' if get_option('system-lua-version') != 'auto'
lua_version_requested = get_option('system-lua-version') lua_version_requested = get_option('system-lua-version')
lua_dep = dependency('lua-' + lua_version_requested, required: false) lua_dep = dependency('lua-' + lua_version_requested, required: false)
@@ -80,18 +91,21 @@ if system_lua
error ('Could not find lua. Lua version 5.4 or 5.3 required') error ('Could not find lua. Lua version 5.4 or 5.3 required')
endif endif
endif endif
else else
lua_proj = subproject('lua', default_options: ['default_library=static']) lua_proj = subproject('lua', default_options: ['default_library=static'])
lua_dep = lua_proj.get_variable('lua_dep') lua_dep = lua_proj.get_variable('lua_dep')
endif
summary({'Lua version': lua_dep.version() + (system_lua ? ' (system)' : ' (built-in)')})
endif endif
summary({'Lua version': lua_dep.version() + (system_lua ? ' (system)' : ' (built-in)')})
systemd = dependency('systemd', required: get_option('systemd')) if build_modules
libsystemd_dep = dependency('libsystemd',required: get_option('systemd')) systemd = dependency('systemd', required: get_option('systemd'))
libelogind_dep = dependency('libelogind', required: get_option('elogind')) libsystemd_dep = dependency('libsystemd',required: get_option('systemd'))
summary({'systemd conf data': systemd.found(), libelogind_dep = dependency('libelogind', required: get_option('elogind'))
summary({'systemd conf data': systemd.found(),
'libsystemd': libsystemd_dep.found(), 'libsystemd': libsystemd_dep.found(),
'libelogind': libelogind_dep.found()}, bool_yn: true) 'libelogind': libelogind_dep.found()}, bool_yn: true)
endif
gnome = import('gnome') gnome = import('gnome')
pkgconfig = import('pkgconfig') pkgconfig = import('pkgconfig')
@@ -121,7 +135,9 @@ add_project_arguments(cc.get_supported_arguments(common_flags), language: 'c')
subdir('lib') subdir('lib')
subdir('docs') subdir('docs')
subdir('modules') if build_modules
subdir('modules')
endif
subdir('src') subdir('src')
subdir('po') subdir('po')

View File

@@ -2,6 +2,12 @@ option('introspection', type : 'feature', value : 'auto',
description : 'Generate gobject-introspection bindings') description : 'Generate gobject-introspection bindings')
option('doc', type : 'feature', value : 'auto', option('doc', type : 'feature', value : 'auto',
description: 'Enable documentation.') 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', option('system-lua', type : 'boolean', value : 'false',
description : 'Use lua from the system instead of the bundled one') description : 'Use lua from the system instead of the bundled one')
option('system-lua-version', option('system-lua-version',

View File

@@ -1,20 +1,24 @@
wp_sources = [ if build_tools
'main.c', subdir('tools')
] endif
install_subdir('config', if build_daemon
subdir('systemd')
install_subdir('config',
install_dir: wireplumber_data_dir, install_dir: wireplumber_data_dir,
strip_directory : true strip_directory : true
) )
install_subdir('scripts', install_subdir('scripts',
install_dir: wireplumber_data_dir, install_dir: wireplumber_data_dir,
strip_directory : false strip_directory : false
) )
subdir('systemd') wp_sources = [
subdir('tools') 'main.c',
]
wireplumber = executable('wireplumber', wireplumber = executable('wireplumber',
wp_sources, wp_sources,
c_args : [ c_args : [
'-D_GNU_SOURCE', '-D_GNU_SOURCE',
@@ -23,4 +27,5 @@ wireplumber = executable('wireplumber',
], ],
install: true, install: true,
dependencies : [gobject_dep, gio_dep, wp_dep, pipewire_dep], dependencies : [gobject_dep, gio_dep, wp_dep, pipewire_dep],
) )
endif

View File

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