Skip to content

Commit 2c85d92

Browse files
nordicjmcarlescufi
authored andcommitted
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 <jamie.mccrae@nordicsemi.no>
1 parent be3bfb0 commit 2c85d92

File tree

4 files changed

+8
-36
lines changed

4 files changed

+8
-36
lines changed

app/CMakeLists.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
cmake_minimum_required(VERSION 3.13.1)
88
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
99

10-
project(app LANGUAGES C VERSION 1.0.0)
11-
12-
configure_file(app_version.h.in ${CMAKE_BINARY_DIR}/app/include/app_version.h)
13-
target_include_directories(app PRIVATE ${CMAKE_BINARY_DIR}/app/include src)
10+
project(app LANGUAGES C)
1411

1512
target_sources(app PRIVATE src/main.c)

app/VERSION

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
VERSION_MAJOR = 1
2+
VERSION_MINOR = 0
3+
PATCHLEVEL = 0
4+
VERSION_TWEAK = 0
5+
EXTRAVERSION =

app/app_version.h.in

Lines changed: 0 additions & 29 deletions
This file was deleted.

app/src/main.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55

66
#include <zephyr/kernel.h>
77
#include <zephyr/drivers/sensor.h>
8-
9-
#include "app_version.h"
8+
#include <app_version.h>
109

1110
#include <zephyr/logging/log.h>
1211
LOG_MODULE_REGISTER(main, CONFIG_APP_LOG_LEVEL);
@@ -16,7 +15,7 @@ int main(void)
1615
int ret;
1716
const struct device *sensor;
1817

19-
printk("Zephyr Example Application %s\n", APP_VERSION_STR);
18+
printk("Zephyr Example Application %s\n", APP_VERSION_STRING);
2019

2120
sensor = DEVICE_DT_GET(DT_NODELABEL(examplesensor0));
2221
if (!device_is_ready(sensor)) {

0 commit comments

Comments
 (0)