From a7b603270f229368e041febffc5c7744b471f440 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Thu, 19 Aug 2021 20:31:17 +0200 Subject: [PATCH] main: Print version in debug output on startup This will stop needing to ask users that read the README when reporting bugs but don't include this info. --- src/iio-sensor-proxy.c | 6 +++++- src/meson.build | 8 ++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/iio-sensor-proxy.c b/src/iio-sensor-proxy.c index 9e0aa1f..aaef495 100644 --- a/src/iio-sensor-proxy.c +++ b/src/iio-sensor-proxy.c @@ -7,6 +7,8 @@ * */ +#include "config.h" + #include #include #include @@ -960,8 +962,10 @@ int main (int argc, char **argv) return EXIT_FAILURE; } - if (verbose) + if (verbose) { g_setenv ("G_MESSAGES_DEBUG", "all", TRUE); + g_debug ("Starting iio-sensor-proxy version "VERSION); + } data = g_new0 (SensorData, 1); data->previous_orientation = ORIENTATION_UNDEFINED; diff --git a/src/meson.build b/src/meson.build index e0fe1f4..2fb1deb 100644 --- a/src/meson.build +++ b/src/meson.build @@ -1,3 +1,10 @@ +config_h = configuration_data() +config_h.set_quoted('VERSION', meson.project_version()) +config_h_files = configure_file( + output: 'config.h', + configuration: config_h +) + deps = [ gio_dep, gudev_dep, mathlib_dep ] resources = gnome.compile_resources( @@ -27,6 +34,7 @@ sources = [ 'accel-attributes.c', 'utils.c', resources, + config_h_files, ] executable('iio-sensor-proxy',