summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJF <jf@codingfield.com>2020-01-18 14:50:24 +0100
committerJF <jf@codingfield.com>2020-01-18 14:50:24 +0100
commitfb99520c988f452dad7dc07751d2261f09c4b791 (patch)
treef4e453df9f021b11ed62a82721c2dbadcf767b81 /src
parent6ca081739e57f5171f05dc18cca66d12a4911c39 (diff)
Add version (major.minor.patch) in CMake files.
Display the version on the display.
Diffstat (limited to 'src')
-rw-r--r--src/DisplayApp/DisplayApp.cpp6
-rw-r--r--src/Version.h.in16
2 files changed, 22 insertions, 0 deletions
diff --git a/src/DisplayApp/DisplayApp.cpp b/src/DisplayApp/DisplayApp.cpp
index fe7e68dc..f37cee98 100644
--- a/src/DisplayApp/DisplayApp.cpp
+++ b/src/DisplayApp/DisplayApp.cpp
@@ -12,6 +12,7 @@
#include <chrono>
#include <string>
#include <date/date.h>
+#include "../Version.h"
using namespace Pinetime::Applications;
@@ -105,6 +106,11 @@ void DisplayApp::InitHw() {
gfx->DrawString(10, 0, 0x0000, "BLE", &smallFont, false);
gfx->DrawString(20, 180, 0xffff, "", &smallFont, false);
+ char version[20];
+ sprintf(version, "VERSION: %d.%d.%d", Version::Major(), Version::Minor(), Version::Patch());
+ gfx->DrawString(20, 220, 0xffff, version, &smallFont, false);
+
+
currentChar[0] = 0;
currentChar[1] = 0;
currentChar[2] = 0;
diff --git a/src/Version.h.in b/src/Version.h.in
new file mode 100644
index 00000000..c68a03ce
--- /dev/null
+++ b/src/Version.h.in
@@ -0,0 +1,16 @@
+#pragma once
+
+@VERSION_EDIT_WARNING@
+
+namespace Pinetime {
+ class Version {
+ public:
+ static uint32_t Major() {return major;}
+ static uint32_t Minor() {return minor;}
+ static uint32_t Patch() {return patch;}
+ private:
+ static constexpr uint32_t major = @PROJECT_VERSION_MAJOR@;
+ static constexpr uint32_t minor = @PROJECT_VERSION_MINOR@;
+ static constexpr uint32_t patch = @PROJECT_VERSION_PATCH@;
+ };
+} \ No newline at end of file