mirror of https://github.com/nirenjan/libx52.git
67 lines
2.1 KiB
Meson
67 lines
2.1 KiB
Meson
project('pinelog', 'C',
|
|
default_options: ['show-date=true', 'show-level=true', 'show-backtrace=true'])
|
|
|
|
pinelog_path_arg = '-DPINELOG_STRIP_FILE_PATH=@0@'.format(get_option('strip-file-path').to_int())
|
|
|
|
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()),
|
|
pinelog_path_arg,
|
|
]
|
|
|
|
libpinelog = static_library('pinelog', 'pinelog.c', c_args: pinelog_cflags)
|
|
|
|
libpinelog_inc = include_directories('.')
|
|
libpinelog_dep = declare_dependency(
|
|
include_directories: libpinelog_inc,
|
|
link_with: libpinelog,
|
|
compile_args: [pinelog_path_arg],
|
|
)
|
|
|
|
prog_class = ['bench', 'test']
|
|
date_class = ['nots', 'ts']
|
|
level_class = ['nolvl', 'lvl']
|
|
backtrace_class = ['notr', 'tr']
|
|
|
|
test_files = []
|
|
test_name_template = '-@0@-@1@-@2@'
|
|
foreach date_arg: [0, 1]
|
|
date_def = '-DPINELOG_SHOW_DATE=' + date_arg.to_string()
|
|
date_name = date_arg == 1 ? 'ts' : 'nots'
|
|
|
|
foreach level_arg: [0, 1]
|
|
level_def = '-DPINELOG_SHOW_LEVEL=' + level_arg.to_string()
|
|
level_name = level_arg == 1 ? 'lvl' : 'nolvl'
|
|
|
|
foreach backtrace_arg: [0, 1]
|
|
backtrace_def = '-DPINELOG_SHOW_BACKTRACE=' + backtrace_arg.to_string()
|
|
backtrace_name = backtrace_arg == 1 ? 'tr' : 'notr'
|
|
|
|
c_args = [
|
|
'-DPINELOG_FATAL_STR="F"',
|
|
'-DPINELOG_ERROR_STR="E"',
|
|
'-DPINELOG_WARNING_STR="W"',
|
|
'-DPINELOG_INFO_STR="I"',
|
|
'-DPINELOG_DEBUG_STR="D"',
|
|
'-DPINELOG_TRACE_STR="T"',
|
|
'-DPINELOG_DEFAULT_LEVEL=PINELOG_LVL_TRACE',
|
|
'-DPINELOG_DEFAULT_STREAM=stderr',
|
|
'-DPINELOG_TEST',
|
|
date_def, level_def, backtrace_def,
|
|
pinelog_path_arg,
|
|
]
|
|
test_name = test_name_template.format(
|
|
date_name, level_name, backtrace_name)
|
|
|
|
test_exe = executable('test' + test_name, 'test_pinelog.c', 'pinelog.c',
|
|
c_args: c_args)
|
|
test('test' + test_name, test_exe, protocol: 'tap')
|
|
|
|
bench_exe = executable('bench' + test_name, 'bench_pinelog.c', 'pinelog.c',
|
|
c_args: c_args)
|
|
benchmark('bench' + test_name, bench_exe, protocol: 'tap')
|
|
endforeach
|
|
endforeach
|
|
endforeach
|