feat: Add x52cli and test to meson

migrate-to-meson-build
nirenjan 2024-06-13 18:20:40 -07:00
parent f04e772590
commit 5c16e90a35
2 changed files with 19 additions and 3 deletions

View File

@ -462,12 +462,12 @@ static void do_help(const struct command_handler *cmd)
if (cmd) {
fprintf(stderr, "Command usage: %s\n", cmd->help);
} else {
printf("\nCommands:\n");
fprintf(stderr, "\nCommands:\n");
for (i = 0; i < X52_CTL_CMD_MAX; i++) {
printf("\t%s\n", handlers[i].help);
fprintf(stderr, "\t%s\n", handlers[i].help);
}
printf("\nWARNING: raw command may damage your device\n\n");
fprintf(stderr, "\nWARNING: raw command may damage your device\n\n");
}
}

View File

@ -225,3 +225,19 @@ executable('x52bugreport', 'bugreport/bugreport.c',
include_directories: 'libx52io',
dependencies: [dep_libusb, dep_hidapi],
link_with: [lib_libx52io])
# x52cli
executable('x52cli', 'cli/x52_cli.c',
include_directories: 'libx52',
link_with: lib_libx52)
if dep_cmocka.found()
test_cli = executable('test-cli', 'cli/x52_cli.c', 'cli/test_x52_cli.c',
build_by_default: false,
c_args: ['-DX52_CLI_TESTING'],
include_directories: 'libx52',
dependencies: [dep_cmocka],
)
test('test-cli', test_cli, protocol: 'tap')
endif