Add version (major.minor.patch) in CMake files.
Display the version on the display.
This commit is contained in:
parent
6ca081739e
commit
fb99520c98
|
@ -1,5 +1,5 @@
|
||||||
cmake_minimum_required(VERSION 3.15)
|
cmake_minimum_required(VERSION 3.15)
|
||||||
project(pinetime C CXX ASM)
|
project(pinetime VERSION 0.0.2 LANGUAGES C CXX ASM)
|
||||||
|
|
||||||
set(NRF_TARGET "nrf52")
|
set(NRF_TARGET "nrf52")
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@ endif()
|
||||||
|
|
||||||
message("BUILD CONFIGURATION")
|
message("BUILD CONFIGURATION")
|
||||||
message("-------------------")
|
message("-------------------")
|
||||||
|
message(" * Version : " ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
|
||||||
message(" * Toolchain : " ${ARM_NONE_EABI_TOOLCHAIN_PATH})
|
message(" * Toolchain : " ${ARM_NONE_EABI_TOOLCHAIN_PATH})
|
||||||
message(" * NRF52 SDK : " ${NRF5_SDK_PATH})
|
message(" * NRF52 SDK : " ${NRF5_SDK_PATH})
|
||||||
set(PROGRAMMER "???")
|
set(PROGRAMMER "???")
|
||||||
|
@ -45,6 +46,8 @@ elseif(USE_GDB_CLIENT)
|
||||||
message(" * GDB Target : " ${GDB_CLIENT_TARGET_REMOTE})
|
message(" * GDB Target : " ${GDB_CLIENT_TARGET_REMOTE})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set(VERSION_EDIT_WARNING "// Do not edit this file, it is automatically generated by CMAKE!")
|
||||||
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/Version.h.in ${CMAKE_CURRENT_SOURCE_DIR}/src/Version.h)
|
||||||
|
|
||||||
include("cmake-nRF5x/CMake_nRF5x.cmake")
|
include("cmake-nRF5x/CMake_nRF5x.cmake")
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <date/date.h>
|
#include <date/date.h>
|
||||||
|
#include "../Version.h"
|
||||||
|
|
||||||
using namespace Pinetime::Applications;
|
using namespace Pinetime::Applications;
|
||||||
|
|
||||||
|
@ -105,6 +106,11 @@ void DisplayApp::InitHw() {
|
||||||
gfx->DrawString(10, 0, 0x0000, "BLE", &smallFont, false);
|
gfx->DrawString(10, 0, 0x0000, "BLE", &smallFont, false);
|
||||||
gfx->DrawString(20, 180, 0xffff, "", &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[0] = 0;
|
||||||
currentChar[1] = 0;
|
currentChar[1] = 0;
|
||||||
currentChar[2] = 0;
|
currentChar[2] = 0;
|
||||||
|
|
16
src/Version.h.in
Normal file
16
src/Version.h.in
Normal file
|
@ -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@;
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue