labfy-rgb/meson.build
2026-11-09 19:01:00 +01:00

24 lines
2.2 KiB
Meson

project('labfy-rgb', 'c', version: '0.3.0', default_options: ['c_std=c17', 'warning_level=3', 'werror=true'])
inc = include_directories('src')
# Tests use assert for checks and fixture operations, including in release builds.
test_args = ['-UNDEBUG']
core = static_library('labfy-rgb-core', ['src/hid_device.c', 'src/lamp_array.c', 'src/rgb_controller.c', 'src/rgb_state.c'], include_directories: inc)
cli = executable('labfy-rgb', 'src/main.c', link_with: core, include_directories: inc, install: true)
t = executable('test-core', 'tests/test_core.c', link_with: core, include_directories: inc, c_args: test_args)
test('core-no-hardware', t, args: [meson.current_source_dir() / 'tests/data/ite5570-5570.desc'])
test('cli-no-hardware', find_program('tests/cli.sh'), args: [cli])
controller_test = executable('test-controller', 'tests/test_controller.c', link_with: core, include_directories: inc, c_args: test_args)
test('controller-memory-only', controller_test)
state_test = executable('test-state', 'tests/test_state.c', link_with: core, include_directories: inc, c_args: test_args)
test('state-tempdir-only', state_test)
transport_test = executable('test-transport', 'tests/test_transport.c', link_with: core, include_directories: inc, c_args: test_args,
link_args: ['-Wl,--wrap=open', '-Wl,--wrap=open64', '-Wl,--wrap=close', '-Wl,--wrap=ioctl', '-Wl,--wrap=flock'])
test('transport-syscall-doubles-only', transport_test)
cli_under_test = static_library('cli-under-test', 'src/main.c', include_directories: inc, c_args: ['-Dmain=rgb_cli_main'])
cli_integration = executable('test-cli-integration', 'tests/test_cli_integration.c', link_with: [cli_under_test, core], include_directories: inc, c_args: test_args,
link_args: ['-Wl,--wrap=hid_discover', '-Wl,--wrap=hid_descriptor', '-Wl,--wrap=hid_open_control',
'-Wl,--wrap=hid_open_verified', '-Wl,--wrap=hid_get', '-Wl,--wrap=hid_set', '-Wl,--wrap=hid_wait',
'-Wl,--wrap=rgb_state_open', '-Wl,--wrap=rgb_state_save'])
test('cli-memory-transport-only', cli_integration)
concurrency_test = executable('test-concurrency', 'tests/test_concurrency.c', link_with: core, include_directories: inc, c_args: test_args)
test('concurrency-tempfile-only', concurrency_test)