Add options

migrate-to-meson-build
nirenjan 2024-06-13 20:44:47 -07:00
parent 0c0a6c1228
commit 2804236be0
4 changed files with 32 additions and 4 deletions

View File

@ -101,7 +101,13 @@ version_info_h = configure_file(
####################################################################### #######################################################################
# pinelog # pinelog
sub_pinelog = subproject('pinelog', required: true) pinelog_options = {}
if dep_systemd.found() and not get_option('disable-systemd')
pinelog_options = {'show-date': false}
endif
sub_pinelog = subproject('pinelog', required: true,
default_options: pinelog_options)
dep_pinelog = sub_pinelog.get_variable('libpinelog_dep') dep_pinelog = sub_pinelog.get_variable('libpinelog_dep')
# inih # inih
@ -314,7 +320,7 @@ if dep_udev.found()
udev_file = configure_file( udev_file = configure_file(
input: 'udev/60-saitek-x52-x52pro.rules.in', input: 'udev/60-saitek-x52-x52pro.rules.in',
output: '60-saitek-x52-x52pro.rules', output: '60-saitek-x52-x52pro.rules',
configuration: {'input_group': 'plugdev'} configuration: {'input_group': get_option('input-group')}
) )
install_data(udev_file, install_dir: udev_rules_dir) install_data(udev_file, install_dir: udev_rules_dir)
meson.add_install_script('udev/install-hook.sh') meson.add_install_script('udev/install-hook.sh')

View File

@ -0,0 +1,7 @@
option('disable-systemd',
type: 'boolean', value: false,
description: 'Disable systemd integration (show timestamps in logs)')
option('input-group',
type: 'string', value: 'plugdev',
description: 'Group for input devices')

View File

@ -1,6 +1,13 @@
project('pinelog', 'C') project('pinelog', 'C',
default_options: {'show-date': true, 'show-level': true, 'show-backtrace': true})
libpinelog = static_library('pinelog', 'pinelog.c') pinelog_cflags = [
'-DPINELOG_SHOW_DATE=@0@'.format(get_option('show-date').to_int()),
'-DPINELOG_SHOW_LEVEL=@0@'.format(get_option('show-level').to_int()),
'-DPINELOG_SHOW_BACKTRACE=@0@'.format(get_option('show-backtrace').to_int()),
]
libpinelog = static_library('pinelog', 'pinelog.c', c_args: pinelog_cflags)
libpinelog_inc = include_directories('.') libpinelog_inc = include_directories('.')
libpinelog_dep = declare_dependency( libpinelog_dep = declare_dependency(

View File

@ -0,0 +1,8 @@
option('show-date', type: 'boolean',
description: 'Show timestamp in log message')
option('show-level', type: 'boolean',
description: 'Show level string in log message')
option('show-backtrace', type: 'boolean',
description: 'Show backtrace information in log message')