cmake: add FIRMWARE_NAME option

Add CMake argument FIRMWARE_NAME that enables setting custom suffix
for output binary.

Example `cmake ... -DFIRMWARE_NAME=custom ...` will save output files as
sof-custom.ri, sof-custom.ldc etc.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
This commit is contained in:
Janusz Jankowski 2020-09-03 16:09:33 +02:00 committed by Liam Girdwood
parent df3c87ce01
commit 8eb6b543d1
1 changed files with 13 additions and 7 deletions

View File

@ -462,13 +462,19 @@ else()
add_custom_target(run_meu DEPENDS run_rimage)
endif()
if(NOT DEFINED FIRMWARE_NAME)
set(fw_output_name "${fw_name}")
else()
set(fw_output_name "${FIRMWARE_NAME}")
endif()
if(MEU_NO_SIGN)
# copy rimage output that can be used to sign firmware
add_custom_target(
bin ALL
COMMAND ${CMAKE_COMMAND} -E copy sof-${fw_name}.ri.uns ${PROJECT_BINARY_DIR}/sof-${fw_name}.ri.uns
COMMAND ${CMAKE_COMMAND} -E copy sof-${fw_name}.ri.met ${PROJECT_BINARY_DIR}/sof-${fw_name}.ri.met
COMMAND ${CMAKE_COMMAND} -E copy sof-${fw_name}.ldc ${PROJECT_BINARY_DIR}/sof-${fw_name}.ldc
COMMAND ${CMAKE_COMMAND} -E copy sof-${fw_name}.ri.uns ${PROJECT_BINARY_DIR}/sof-${fw_output_name}.ri.uns
COMMAND ${CMAKE_COMMAND} -E copy sof-${fw_name}.ri.met ${PROJECT_BINARY_DIR}/sof-${fw_output_name}.ri.met
COMMAND ${CMAKE_COMMAND} -E copy sof-${fw_name}.ldc ${PROJECT_BINARY_DIR}/sof-${fw_output_name}.ldc
DEPENDS run_meu bin_extras
VERBATIM
USES_TERMINAL
@ -476,8 +482,8 @@ if(MEU_NO_SIGN)
else()
add_custom_target(
bin ALL
COMMAND ${CMAKE_COMMAND} -E copy sof-${fw_name}.ri ${PROJECT_BINARY_DIR}/sof-${fw_name}.ri
COMMAND ${CMAKE_COMMAND} -E copy sof-${fw_name}.ldc ${PROJECT_BINARY_DIR}/sof-${fw_name}.ldc
COMMAND ${CMAKE_COMMAND} -E copy sof-${fw_name}.ri ${PROJECT_BINARY_DIR}/sof-${fw_output_name}.ri
COMMAND ${CMAKE_COMMAND} -E copy sof-${fw_name}.ldc ${PROJECT_BINARY_DIR}/sof-${fw_output_name}.ldc
DEPENDS run_meu bin_extras
VERBATIM
USES_TERMINAL
@ -485,7 +491,7 @@ else()
endif()
install(
FILES ${PROJECT_BINARY_DIR}/sof-${fw_name}.ri
${PROJECT_BINARY_DIR}/sof-${fw_name}.ldc
FILES ${PROJECT_BINARY_DIR}/sof-${fw_output_name}.ri
${PROJECT_BINARY_DIR}/sof-${fw_output_name}.ldc
DESTINATION bin
)