diff --git a/meson.build b/meson.build index 3445fe9..096c013 100644 --- a/meson.build +++ b/meson.build @@ -101,7 +101,13 @@ version_info_h = configure_file( ####################################################################### # 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') # inih @@ -314,7 +320,7 @@ if dep_udev.found() udev_file = configure_file( input: 'udev/60-saitek-x52-x52pro.rules.in', 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) meson.add_install_script('udev/install-hook.sh') diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..0db05c8 --- /dev/null +++ b/meson_options.txt @@ -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') diff --git a/subprojects/pinelog/meson.build b/subprojects/pinelog/meson.build index 07a135f..e1c451a 100644 --- a/subprojects/pinelog/meson.build +++ b/subprojects/pinelog/meson.build @@ -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_dep = declare_dependency( diff --git a/subprojects/pinelog/meson_options.txt b/subprojects/pinelog/meson_options.txt new file mode 100644 index 0000000..20273c6 --- /dev/null +++ b/subprojects/pinelog/meson_options.txt @@ -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')