Skip to content

Commit

Permalink
scripts/cmake: Set SOF_MICRO to 99 on main branch
Browse files Browse the repository at this point in the history
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 <surajsonawane0215@gmail.com>
  • Loading branch information
SurajSonawane2415 committed Mar 5, 2025
1 parent 9228f20 commit 456fe4b
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions scripts/cmake/version.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,21 @@ string(JSON SOF_MICRO ERROR_VARIABLE micro_error
# Don't confuse "error not found" with "version not found"
if(NOT "${micro_error}" STREQUAL "NOTFOUND")
message(STATUS "versions.json: ${micro_error}, defaulting to 0")
# TODO: default this to .99 on the main, never released branch like zephyr does
# Keep this default SOF_MICRO the same as the one in xtensa-build-zephyr.py
set(SOF_MICRO 0)
# Detect if the current branch is "main"
execute_process(
COMMAND git rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY ${SOF_ROOT_SOURCE_DIRECTORY}
OUTPUT_VARIABLE GIT_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)

# Set SOF_MICRO to 99 only on the "main" branch
if("${GIT_BRANCH}" STREQUAL "main")
set(SOF_MICRO 99)
else()
# Keep this default SOF_MICRO the same as the one in xtensa-build-zephyr.py
set(SOF_MICRO 0)
endif()
endif()

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

0 comments on commit 456fe4b

Please sign in to comment.