summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2020-11-01 21:59:27 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2020-11-01 21:59:27 +0200
commit662d195dfec6e924aef5a9b4d852a03a5671b0b6 (patch)
tree53212f0b745571bc28666e01f8a97fb5a36c05ce
parentScale bar now rescales image (diff)
downloadqimv-662d195dfec6e924aef5a9b4d852a03a5671b0b6.tar.xz
Set version through meson
-rw-r--r--meson.build2
-rw-r--r--src/main.cpp9
-rw-r--r--src/version.h.in4
3 files changed, 10 insertions, 5 deletions
diff --git a/meson.build b/meson.build
index 3907431..86acf5b 100644
--- a/meson.build
+++ b/meson.build
@@ -16,6 +16,8 @@ summary({
'linker': cxx.get_linker_id(),
}, section: 'Compiler')
+vcs_tag(input: 'src/version.h.in', output: 'version.h')
+
mod_qt5 = import('qt5')
dep_qt5 = dependency('qt5', modules: [ 'Core', 'Widgets' ], include_type: 'system')
diff --git a/src/main.cpp b/src/main.cpp
index 441a2c5..b9823e3 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,19 +1,18 @@
#include "mainwindow.h"
+#include "version.h"
#include <QApplication>
#include <QCommandLineParser>
-#define PROJECT_NAME "qimv"
-
int main(int argc, char **argv) {
QApplication app(argc, argv);
- app.setApplicationName("qimv");
- app.setApplicationVersion("0.1.0");
+ app.setApplicationName(QIMV_NAME);
+ app.setApplicationVersion(QIMV_VERSION);
QCommandLineParser parser;
parser.setApplicationDescription("Quick image viewer");
parser.addHelpOption();
parser.addVersionOption();
- parser.addPositionalArgument("image", "Image to show.");
+ parser.addPositionalArgument("path(s)", "Image(s) to show.");
parser.process(app);
diff --git a/src/version.h.in b/src/version.h.in
new file mode 100644
index 0000000..97bb080
--- /dev/null
+++ b/src/version.h.in
@@ -0,0 +1,4 @@
+#pragma once
+
+#define QIMV_NAME "qimv"
+#define QIMV_VERSION "@VCS_TAG@"