Pass PIOASM_EXTRA_SOURCE_FILES to Pioasm sub-cmake and add OUTPUT_FORMAT option (fixes #827) (#828)

This commit is contained in:
Ferdinand Bachmann 2022-05-16 21:20:41 +02:00 committed by GitHub
parent 792813926d
commit 43a5593e8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View File

@ -4,9 +4,18 @@ function(_pico_init_pioasm)
find_package(Pioasm REQUIRED) find_package(Pioasm REQUIRED)
endfunction() endfunction()
# PICO_DEFAULT_PIOASM_OUTPUT_FORMAT, default output format used by pioasm when using pico_generate_pio_header, default=c-sdk, group=build
function(pico_generate_pio_header TARGET PIO) function(pico_generate_pio_header TARGET PIO)
_pico_init_pioasm() _pico_init_pioasm()
cmake_parse_arguments(pico_generate_pio_header "" "OUTPUT_DIR" "" ${ARGN} ) cmake_parse_arguments(pico_generate_pio_header "" "OUTPUT_FORMAT;OUTPUT_DIR" "" ${ARGN} )
if (pico_generate_pio_header_OUTPUT_FORMAT)
set(OUTPUT_FORMAT "${pico_generate_pio_header_OUTPUT_FORMAT}")
elseif(DEFINED PICO_DEFAULT_PIOASM_OUTPUT_FORMAT)
set(OUTPUT_FORMAT "${PICO_DEFAULT_PIOASM_OUTPUT_FORMAT}")
else()
set(OUTPUT_FORMAT "c-sdk")
endif()
if (pico_generate_pio_header_OUTPUT_DIR) if (pico_generate_pio_header_OUTPUT_DIR)
get_filename_component(HEADER_DIR ${pico_generate_pio_header_OUTPUT_DIR} ABSOLUTE) get_filename_component(HEADER_DIR ${pico_generate_pio_header_OUTPUT_DIR} ABSOLUTE)
@ -23,7 +32,7 @@ function(pico_generate_pio_header TARGET PIO)
add_custom_command(OUTPUT ${HEADER} add_custom_command(OUTPUT ${HEADER}
DEPENDS ${PIO} DEPENDS ${PIO}
COMMAND Pioasm -o c-sdk ${PIO} ${HEADER} COMMAND Pioasm -o ${OUTPUT_FORMAT} ${PIO} ${HEADER}
) )
add_dependencies(${TARGET} ${HEADER_GEN_TARGET}) add_dependencies(${TARGET} ${HEADER_GEN_TARGET})
get_target_property(target_type ${TARGET} TYPE) get_target_property(target_type ${TARGET} TYPE)

View File

@ -29,6 +29,7 @@ if (NOT Pioasm_FOUND)
BINARY_DIR ${PIOASM_BINARY_DIR} BINARY_DIR ${PIOASM_BINARY_DIR}
BUILD_ALWAYS 1 # force dependency checking BUILD_ALWAYS 1 # force dependency checking
INSTALL_COMMAND "" INSTALL_COMMAND ""
CMAKE_CACHE_ARGS "-DPIOASM_EXTRA_SOURCE_FILES:STRING=${PIOASM_EXTRA_SOURCE_FILES}"
) )
endif() endif()