Skip to content

Commit 456fe4b

Browse files
scripts/cmake: Set SOF_MICRO to 99 on main branch
This ensures SOF_MICRO is set to 99 when on the main branch, aligning with Zephyr's approach for never-released branches. For other branches, it remains 0 to maintain consistency with xtensa-build-zephyr.py. Signed-off-by: Suraj Sonawane <[email protected]>
1 parent 9228f20 commit 456fe4b

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

scripts/cmake/version.cmake

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,21 @@ string(JSON SOF_MICRO ERROR_VARIABLE micro_error
8686
# Don't confuse "error not found" with "version not found"
8787
if(NOT "${micro_error}" STREQUAL "NOTFOUND")
8888
message(STATUS "versions.json: ${micro_error}, defaulting to 0")
89-
# TODO: default this to .99 on the main, never released branch like zephyr does
90-
# Keep this default SOF_MICRO the same as the one in xtensa-build-zephyr.py
91-
set(SOF_MICRO 0)
89+
# Detect if the current branch is "main"
90+
execute_process(
91+
COMMAND git rev-parse --abbrev-ref HEAD
92+
WORKING_DIRECTORY ${SOF_ROOT_SOURCE_DIRECTORY}
93+
OUTPUT_VARIABLE GIT_BRANCH
94+
OUTPUT_STRIP_TRAILING_WHITESPACE
95+
)
96+
97+
# Set SOF_MICRO to 99 only on the "main" branch
98+
if("${GIT_BRANCH}" STREQUAL "main")
99+
set(SOF_MICRO 99)
100+
else()
101+
# Keep this default SOF_MICRO the same as the one in xtensa-build-zephyr.py
102+
set(SOF_MICRO 0)
103+
endif()
92104
endif()
93105

94106
string(SUBSTRING "${GIT_LOG_HASH}" 0 5 SOF_TAG)

0 commit comments

Comments
 (0)