File tree 5 files changed +27
-0
lines changed
5 files changed +27
-0
lines changed Original file line number Diff line number Diff line change 8
8
set (NRF_DIR ${CMAKE_CURRENT_LIST_DIR} CACHE PATH "NCS root directory" )
9
9
10
10
include (cmake/extensions.cmake)
11
+ include (cmake/version .cmake)
11
12
include (cmake/multi_image.cmake)
12
13
include (cmake/reports.cmake)
13
14
Original file line number Diff line number Diff line change 6
6
7
7
# Root folder
8
8
/VERSION @ carlescufi @ tejlmand
9
+ /ncs_version.h.in @ carlescufi @ tejlmand
9
10
/CODEOWNERS @ carlescufi
10
11
/LICENSE @ carlescufi
11
12
/README.rst @ carlescufi
Original file line number Diff line number Diff line change
1
+ math (EXPR NCS_VERSION_CODE "(${NCS_VERSION_MAJOR} << 16) + (${NCS_VERSION_MINOR} << 8) + (${NCS_VERSION_PATCH} )" )
2
+
3
+ # to_hex is made available by ${ZEPHYR_BASE}/cmake/hex.cmake
4
+ to_hex(${NCS_VERSION_CODE} NCS_VERSION_NUMBER)
5
+
6
+ configure_file (${NRF_DIR} /ncs_version.h.in ${ZEPHYR_BINARY_DIR} /include /generated /ncs_version.h)
Original file line number Diff line number Diff line change
1
+ #ifndef _NCS_VERSION_H_
2
+ #define _NCS_VERSION_H_
3
+
4
+ #cmakedefine NCS_VERSION_CODE @NCS_VERSION_CODE@
5
+ #define NCS_VERSION (a ,b ,c ) (((a) << 16) + ((b) << 8) + (c))
6
+
7
+ #define NCS_VERSION_NUMBER @NCS_VERSION_NUMBER@
8
+ #define NCS_VERSION_MAJOR @NCS_VERSION_MAJOR@
9
+ #define NCS_VERSION_MINOR @NCS_VERSION_MINOR@
10
+ #define NCS_PATCHLEVEL @NCS_VERSION_PATCH@
11
+ #define NCS_VERSION_STRING "@NCS_VERSION@"
12
+
13
+ #endif /* _NCS_VERSION_H_ */
Original file line number Diff line number Diff line change @@ -10,6 +10,12 @@ get_filename_component(NRF_DIR ${CMAKE_CURRENT_LIST_DIR}/${NRF_RELATIVE_DIR} ABS
10
10
get_filename_component (NCS_DIR ${CMAKE_CURRENT_LIST_DIR} /${NCS_RELATIVE_DIR} ABSOLUTE )
11
11
12
12
file (STRINGS ${NRF_DIR} /VERSION NCS_VERSION LIMIT_COUNT 1 LENGTH_MINIMUM 5)
13
+ string (REGEX MATCH "([^\. ]*)\. ([^\. ]*)\. ([^-]*)[-]?(.*)" OUT_VAR ${NCS_VERSION} )
14
+
15
+ set (NCS_VERSION_MAJOR ${CMAKE_MATCH_1} )
16
+ set (NCS_VERSION_MINOR ${CMAKE_MATCH_2} )
17
+ set (NCS_VERSION_PATCH ${CMAKE_MATCH_3} )
18
+ set (NCS_VERSION_EXTRA ${CMAKE_MATCH_4} )
13
19
14
20
if (NOT NO_BOILERPLATE)
15
21
if (NCS_TOOLCHAIN_VERSION)
You can’t perform that action at this time.
0 commit comments