add version information

This commit is contained in:
Adrian Siekierka 2025-02-16 15:32:42 +01:00
parent f127a72f11
commit 145aa5ac65
2 changed files with 15 additions and 1 deletions

View File

@ -2,6 +2,10 @@ project('psxavenc', 'c', default_options: ['c_std=c11'])
add_project_arguments('-D_POSIX_C_SOURCE=201112L', language : 'c')
conf_data = configuration_data()
conf_data.set('VERSION', '"' + run_command('git', 'describe', '--tags', '--match=v*', check: true).stdout().strip() + '"')
configure_file(output: 'config.h', configuration: conf_data)
libm_dep = meson.get_compiler('c').find_library('m')
ffmpeg = [

View File

@ -23,6 +23,7 @@ freely, subject to the following restrictions:
*/
#include "common.h"
#include "config.h"
const char *format_names[NUM_FORMATS] = {
"xa", "xacd",
@ -42,6 +43,7 @@ void print_help(void) {
" psxavenc -t <spui|vagi> [-f freq] [-c 1-24] [-L] [-i size] [-a size] <in> <out.vag>\n"
"\nTool options:\n"
" -h Show this help message and exit\n"
" -V Show version information and exit\n"
" -q Suppress all non-error messages\n"
"\n"
"Output options:\n"
@ -100,16 +102,24 @@ void print_help(void) {
);
}
void print_version(void) {
printf("psxavenc " VERSION "\n");
}
int parse_args(settings_t* settings, int argc, char** argv) {
int c, i;
char *next;
while ((c = getopt(argc, argv, "?hqt:F:C:f:b:c:LR:i:a:s:IS:r:x:")) != -1) {
while ((c = getopt(argc, argv, "?hVqt:F:C:f:b:c:LR:i:a:s:IS:r:x:")) != -1) {
switch (c) {
case '?':
case 'h': {
print_help();
return -1;
} break;
case 'V': {
print_version();
return -1;
} break;
case 'q': {
settings->quiet = true;
settings->show_progress = false;