CMake: reduce intermediate targets, add script dependencies.

This commit is contained in:
Jared Boone 2016-07-03 11:32:21 -07:00
parent 53434f3789
commit 45ca3cf7e6
3 changed files with 18 additions and 16 deletions

View File

@ -300,8 +300,8 @@ include_directories(. ${INCDIR})
link_directories(${LLIBDIR}) link_directories(${LLIBDIR})
target_link_libraries(${PROJECT_NAME}.elf ${LIBS}) target_link_libraries(${PROJECT_NAME}.elf ${LIBS})
add_custom_target( add_custom_command(
${PROJECT_NAME}.bin OUTPUT ${PROJECT_NAME}.bin
COMMAND ${CMAKE_OBJCOPY} -O binary ${PROJECT_NAME}.elf ${PROJECT_NAME}.bin COMMAND ${CMAKE_OBJCOPY} -O binary ${PROJECT_NAME}.elf ${PROJECT_NAME}.bin
DEPENDS ${PROJECT_NAME}.elf DEPENDS ${PROJECT_NAME}.elf
) )

View File

@ -259,16 +259,16 @@ macro(DeclareTargets chunk_tag name)
link_directories(${LLIBDIR}) link_directories(${LLIBDIR})
target_link_libraries(${PROJECT_NAME}.elf ${LIBS}) target_link_libraries(${PROJECT_NAME}.elf ${LIBS})
add_custom_target( add_custom_command(
${PROJECT_NAME}.bin OUTPUT ${PROJECT_NAME}.bin
COMMAND ${CMAKE_OBJCOPY} -O binary ${PROJECT_NAME}.elf ${PROJECT_NAME}.bin COMMAND ${CMAKE_OBJCOPY} -O binary ${PROJECT_NAME}.elf ${PROJECT_NAME}.bin
DEPENDS ${PROJECT_NAME}.elf DEPENDS ${PROJECT_NAME}.elf
) )
add_custom_target( add_custom_command(
${PROJECT_NAME}.img OUTPUT ${PROJECT_NAME}.img
COMMAND ${MAKE_IMAGE_CHUNK} ${PROJECT_NAME}.bin ${chunk_tag} ${PROJECT_NAME}.img COMMAND ${MAKE_IMAGE_CHUNK} ${PROJECT_NAME}.bin ${chunk_tag} ${PROJECT_NAME}.img
DEPENDS ${PROJECT_NAME}.bin DEPENDS ${PROJECT_NAME}.bin ${MAKE_IMAGE_CHUNK}
) )
set(BASEBAND_IMAGES ${BASEBAND_IMAGES} ${PROJECT_NAME}.img) set(BASEBAND_IMAGES ${BASEBAND_IMAGES} ${PROJECT_NAME}.img)
@ -332,24 +332,26 @@ DeclareTargets(PSPE wideband_spectrum)
### HackRF "factory" firmware ### HackRF "factory" firmware
add_custom_target( add_custom_command(
hackrf.bin OUTPUT hackrf.bin
COMMAND ${STRIP_DFU} ${HACKRF_FIRMWARE_IMAGE} hackrf.bin COMMAND ${STRIP_DFU} ${HACKRF_FIRMWARE_IMAGE} hackrf.bin
DEPENDS ${HACKRF_FIRMWARE_IMAGE} ${STRIP_DFU}
) )
add_custom_target( add_custom_command(
hackrf.img OUTPUT hackrf.img
COMMAND ${MAKE_IMAGE_CHUNK} hackrf.bin HRF1 hackrf.img COMMAND ${MAKE_IMAGE_CHUNK} hackrf.bin HRF1 hackrf.img
DEPENDS hackrf.bin DEPENDS hackrf.bin ${MAKE_IMAGE_CHUNK}
) )
set(BASEBAND_IMAGES ${BASEBAND_IMAGES} hackrf.img) set(BASEBAND_IMAGES ${BASEBAND_IMAGES} hackrf.img)
### Terminator image ### Terminator image
add_custom_target( add_custom_command(
terminator.img OUTPUT terminator.img
COMMAND ${MAKE_IMAGE_CHUNK} terminator.img COMMAND ${MAKE_IMAGE_CHUNK} terminator.img
DEPENDS ${MAKE_IMAGE_CHUNK}
) )
####################################################################### #######################################################################

View File

@ -199,8 +199,8 @@ include_directories(. ${INCDIR})
link_directories(${LLIBDIR}) link_directories(${LLIBDIR})
target_link_libraries(${PROJECT_NAME}.elf ${LIBS}) target_link_libraries(${PROJECT_NAME}.elf ${LIBS})
add_custom_target( add_custom_command(
${PROJECT_NAME}.bin OUTPUT ${PROJECT_NAME}.bin
COMMAND ${CMAKE_OBJCOPY} -O binary ${PROJECT_NAME}.elf ${PROJECT_NAME}.bin COMMAND ${CMAKE_OBJCOPY} -O binary ${PROJECT_NAME}.elf ${PROJECT_NAME}.bin
DEPENDS ${PROJECT_NAME}.elf DEPENDS ${PROJECT_NAME}.elf
) )