Skip to content

Commit

Permalink
Append build information to the names of the target executables
Browse files Browse the repository at this point in the history
  • Loading branch information
shishir-dey committed Oct 21, 2024
1 parent 5f0c3f6 commit 0cc06ea
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 6 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ else()
src/syscalls.c
)

include(${CMAKE_SOURCE_DIR}/config/project_info.cmake)

set(TARGET_EXECUTABLE
${PROJECT_NAME}.out
${PROJECT_NAME}_${ENVIRONMENT}_${CLIENT}_${FEATURE}_${FW_VERSION}.out
)

add_executable(${TARGET_EXECUTABLE}
Expand Down Expand Up @@ -107,7 +109,7 @@ else()
-lc
-lm
# -lnosys
-Wl,-Map=${PROJECT_NAME}.map,--cref
-Wl,-Map=${PROJECT_NAME}_${ENVIRONMENT}_${CLIENT}_${FEATURE}_${FW_VERSION}.map,--cref
-Wl,--gc-sections
)

Expand All @@ -120,7 +122,7 @@ else()
# Create hex file
add_custom_command(TARGET ${TARGET_EXECUTABLE}
POST_BUILD
COMMAND arm-none-eabi-objcopy -O ihex ${TARGET_EXECUTABLE} ${PROJECT_NAME}.hex
COMMAND arm-none-eabi-objcopy -O binary ${TARGET_EXECUTABLE} ${PROJECT_NAME}.bin
COMMAND arm-none-eabi-objcopy -O ihex ${TARGET_EXECUTABLE} ${PROJECT_NAME}_${ENVIRONMENT}_${CLIENT}_${FEATURE}_${FW_VERSION}.hex
COMMAND arm-none-eabi-objcopy -O binary ${TARGET_EXECUTABLE} ${PROJECT_NAME}_${ENVIRONMENT}_${CLIENT}_${FEATURE}_${FW_VERSION}.bin
)
endif()
4 changes: 4 additions & 0 deletions config/project_info.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
set(ENVIRONMENT "dev")
set(CLIENT "client_name")
set(FEATURE "custom_feature")
set(FW_VERSION "0.0.1")

0 comments on commit 0cc06ea

Please sign in to comment.