From 2c85d9224fca21fe6e370895c089a6642a9505ea Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Fri, 19 May 2023 14:18:08 +0100 Subject: [PATCH] version: Replace bespoke application version with new version system Uses Zephyr's new version infrastruction system for configuring the version of the application and displaying it. Signed-off-by: Jamie McCrae --- app/CMakeLists.txt | 5 +---- app/VERSION | 5 +++++ app/app_version.h.in | 29 ----------------------------- app/src/main.c | 5 ++--- 4 files changed, 8 insertions(+), 36 deletions(-) create mode 100644 app/VERSION delete mode 100644 app/app_version.h.in diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 442c112..a59bf06 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -7,9 +7,6 @@ cmake_minimum_required(VERSION 3.13.1) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(app LANGUAGES C VERSION 1.0.0) - -configure_file(app_version.h.in ${CMAKE_BINARY_DIR}/app/include/app_version.h) -target_include_directories(app PRIVATE ${CMAKE_BINARY_DIR}/app/include src) +project(app LANGUAGES C) target_sources(app PRIVATE src/main.c) diff --git a/app/VERSION b/app/VERSION new file mode 100644 index 0000000..16a1373 --- /dev/null +++ b/app/VERSION @@ -0,0 +1,5 @@ +VERSION_MAJOR = 1 +VERSION_MINOR = 0 +PATCHLEVEL = 0 +VERSION_TWEAK = 0 +EXTRAVERSION = diff --git a/app/app_version.h.in b/app/app_version.h.in deleted file mode 100644 index cfa55f4..0000000 --- a/app/app_version.h.in +++ /dev/null @@ -1,29 +0,0 @@ -/** - * @file app_version.h - * - * Application version information. - * - * Copyright (c) 2021 Nordic Semiconductor ASA - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef APP_VERSION_H_ -#define APP_VERSION_H_ - -/** Application major version. */ -#define APP_VERSION_MAJOR ${PROJECT_VERSION_MAJOR} -/** Application minor version. */ -#define APP_VERSION_MINOR ${PROJECT_VERSION_MINOR} -/** Application patch version. */ -#define APP_VERSION_PATCH ${PROJECT_VERSION_PATCH} - -/** Application version. */ -#define APP_VERSION \ - ((APP_VERSION_MAJOR << 16) + \ - (APP_VERSION_MINOR << 8) + \ - APP_VERSION_PATCH) - -/** Application version (string). */ -#define APP_VERSION_STR "${PROJECT_VERSION}" - -#endif /* APP_VERSION_H_ */ diff --git a/app/src/main.c b/app/src/main.c index bdd08fe..0bf9b67 100644 --- a/app/src/main.c +++ b/app/src/main.c @@ -5,8 +5,7 @@ #include #include - -#include "app_version.h" +#include #include LOG_MODULE_REGISTER(main, CONFIG_APP_LOG_LEVEL); @@ -16,7 +15,7 @@ int main(void) int ret; const struct device *sensor; - printk("Zephyr Example Application %s\n", APP_VERSION_STR); + printk("Zephyr Example Application %s\n", APP_VERSION_STRING); sensor = DEVICE_DT_GET(DT_NODELABEL(examplesensor0)); if (!device_is_ready(sensor)) {