Skip to content

Commit

Permalink
Add VERBATIM to CMake custom commands
Browse files Browse the repository at this point in the history
Avoids shell errors when the build dir contains certain characters. The CMake docs also recommend doing this.
  • Loading branch information
Daft-Freak committed Aug 30, 2023
1 parent 248a250 commit f2d1754
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions 32blit-config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ if (NOT DEFINED BLIT_ONCE)
OUTPUT ${ASSET_OUTPUTS}
COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && ${32BLIT_TOOLS_EXECUTABLE} --debug pack --force --config ${CMAKE_CURRENT_SOURCE_DIR}/${FILE} --output ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${ASSET_DEPENDS} ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}
VERBATIM
)

# add the outputs as dependencies of the project (also compile any cpp files)
Expand Down
1 change: 1 addition & 0 deletions 32blit-pico/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ function(blit_metadata TARGET FILE)
OUTPUT ${METADATA_SOURCE}
COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && ${32BLIT_TOOLS_EXECUTABLE} metadata --force --config ${FILE} --pico-bi ${METADATA_SOURCE}
DEPENDS ${FILE}
VERBATIM
)

# add the generated source
Expand Down
2 changes: 2 additions & 0 deletions 32blit-sdl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ function(blit_executable NAME)
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${DLL}"
$<TARGET_FILE_DIR:${NAME}>
VERBATIM
)
endforeach()

Expand Down Expand Up @@ -246,6 +247,7 @@ function(blit_metadata TARGET FILE)
OUTPUT ${ICON}
COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && ${32BLIT_TOOLS_EXECUTABLE} metadata --force --config ${FILE} --icns ${ICON}
DEPENDS ${METADATA_DEPENDS} ${FILE}
VERBATIM
)

target_sources(${TARGET} PRIVATE ${ICON})
Expand Down
1 change: 1 addition & 0 deletions 32blit-stm32/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -187,5 +187,6 @@ function(blit_executable_int_flash NAME SOURCES)
add_custom_command(TARGET ${NAME} POST_BUILD
COMMENT "Building ${NAME}.dfu"
COMMAND ${32BLIT_TOOLS_EXECUTABLE} dfu build --force --output-file ${NAME}.dfu --input-file ${NAME}.bin
VERBATIM
)
endfunction()
3 changes: 3 additions & 0 deletions 32blit-stm32/executable.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ function(blit_executable_common NAME)
COMMENT "Building ${NAME}.bin"
COMMAND ${CMAKE_OBJCOPY} -O binary -S $<TARGET_FILE:${NAME}> ${NAME}.bin
COMMAND ${CMAKE_SIZE} $<TARGET_FILE:${NAME}>
VERBATIM
)
endfunction()

Expand Down Expand Up @@ -53,6 +54,7 @@ function(blit_executable NAME)
add_custom_command(TARGET ${NAME} POST_BUILD
COMMENT "Building ${NAME}.blit"
COMMAND ${32BLIT_TOOLS_EXECUTABLE} relocs --elf-file $<TARGET_FILE:${NAME}> --bin-file ${NAME}.bin --output ${BLIT_FILENAME}
VERBATIM
)

add_custom_target(${NAME}.flash DEPENDS ${NAME} COMMAND ${32BLIT_TOOLS_EXECUTABLE} install --port=${FLASH_PORT} --launch ${CMAKE_CURRENT_BINARY_DIR}/${BLIT_FILENAME})
Expand Down Expand Up @@ -86,6 +88,7 @@ function(blit_metadata TARGET FILE)
add_custom_command(
TARGET ${TARGET} POST_BUILD
COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && ${32BLIT_TOOLS_EXECUTABLE} metadata --config ${FILE} --file ${CMAKE_CURRENT_BINARY_DIR}/${BLIT_FILENAME}
VERBATIM
)

# force relink on change so that the post-build commands are rerun
Expand Down
1 change: 1 addition & 0 deletions firmware-update/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ add_custom_command(
COMMAND ${32BLIT_TOOLS_EXECUTABLE} raw --force --input_file $<TARGET_FILE_DIR:firmware>/firmware.bin --symbol_name firmware_data --output_file firmware.hpp
OUTPUT firmware.hpp
DEPENDS firmware
VERBATIM
)

blit_executable(firmware-update firmware-update.cpp firmware.hpp)
Expand Down

0 comments on commit f2d1754

Please sign in to comment.