Skip to content

Commit

Permalink
version: Replace bespoke application version with new version system
Browse files Browse the repository at this point in the history
Uses Zephyr's new version infrastruction system for configuring the
version of the application and displaying it.

Signed-off-by: Jamie McCrae <[email protected]>
  • Loading branch information
nordicjm authored and carlescufi committed May 23, 2023
1 parent be3bfb0 commit 2c85d92
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 36 deletions.
5 changes: 1 addition & 4 deletions app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
5 changes: 5 additions & 0 deletions app/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
VERSION_MAJOR = 1
VERSION_MINOR = 0
PATCHLEVEL = 0
VERSION_TWEAK = 0
EXTRAVERSION =
29 changes: 0 additions & 29 deletions app/app_version.h.in

This file was deleted.

5 changes: 2 additions & 3 deletions app/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@

#include <zephyr/kernel.h>
#include <zephyr/drivers/sensor.h>

#include "app_version.h"
#include <app_version.h>

#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(main, CONFIG_APP_LOG_LEVEL);
Expand All @@ -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)) {
Expand Down

0 comments on commit 2c85d92

Please sign in to comment.