Allow external pico-sdk-tools package (#1221)

This will enable builds to use pre-compiled copies of pioasm and elf2uf2, instead of requiring a native compiler.
This commit is contained in:
Nikhil Dabas 2023-02-06 05:35:54 +05:30 committed by GitHub
parent 74b6c1ccc3
commit 795d021ca6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,12 @@
function(_pico_init_pioasm) function(_pico_init_pioasm)
# Assemble the version string from components instead of using PICO_SDK_VERSION_STRING, because the version string
# potentially has a PRE_RELEASE_ID suffix, which will trip up the find_package call.
find_package(pico-sdk-tools "${PICO_SDK_VERSION_MAJOR}.${PICO_SDK_VERSION_MINOR}.${PICO_SDK_VERSION_REVISION}" QUIET CONFIG CMAKE_FIND_ROOT_PATH_BOTH)
if (NOT Pioasm_FOUND)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PICO_SDK_PATH}/tools) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PICO_SDK_PATH}/tools)
# todo CMAKE_CURRENT_FUNCTION_LIST_DIR ... what version? # todo CMAKE_CURRENT_FUNCTION_LIST_DIR ... what version?
find_package(Pioasm REQUIRED) find_package(Pioasm REQUIRED)
endif()
endfunction() endfunction()
# PICO_CMAKE_CONFIG: PICO_DEFAULT_PIOASM_OUTPUT_FORMAT, default output format used by pioasm when using pico_generate_pio_header, default=c-sdk, group=build # PICO_CMAKE_CONFIG: PICO_DEFAULT_PIOASM_OUTPUT_FORMAT, default output format used by pioasm when using pico_generate_pio_header, default=c-sdk, group=build
@ -53,6 +58,7 @@ function(pico_add_uf2_output TARGET)
else() else()
set(output_path "") set(output_path "")
endif() endif()
find_package(pico-sdk-tools "${PICO_SDK_VERSION_MAJOR}.${PICO_SDK_VERSION_MINOR}.${PICO_SDK_VERSION_REVISION}" QUIET CONFIG CMAKE_FIND_ROOT_PATH_BOTH)
if (NOT ELF2UF2_FOUND) if (NOT ELF2UF2_FOUND)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PICO_SDK_PATH}/tools) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PICO_SDK_PATH}/tools)
find_package(ELF2UF2) find_package(ELF2UF2)