Skip to content

Commit 795d021

Browse files
authored
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.
1 parent 74b6c1c commit 795d021

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

tools/CMakeLists.txt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
function(_pico_init_pioasm)
2-
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PICO_SDK_PATH}/tools)
3-
# todo CMAKE_CURRENT_FUNCTION_LIST_DIR ... what version?
4-
find_package(Pioasm REQUIRED)
2+
# Assemble the version string from components instead of using PICO_SDK_VERSION_STRING, because the version string
3+
# potentially has a PRE_RELEASE_ID suffix, which will trip up the find_package call.
4+
find_package(pico-sdk-tools "${PICO_SDK_VERSION_MAJOR}.${PICO_SDK_VERSION_MINOR}.${PICO_SDK_VERSION_REVISION}" QUIET CONFIG CMAKE_FIND_ROOT_PATH_BOTH)
5+
if (NOT Pioasm_FOUND)
6+
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PICO_SDK_PATH}/tools)
7+
# todo CMAKE_CURRENT_FUNCTION_LIST_DIR ... what version?
8+
find_package(Pioasm REQUIRED)
9+
endif()
510
endfunction()
611

712
# 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)
5358
else()
5459
set(output_path "")
5560
endif()
61+
find_package(pico-sdk-tools "${PICO_SDK_VERSION_MAJOR}.${PICO_SDK_VERSION_MINOR}.${PICO_SDK_VERSION_REVISION}" QUIET CONFIG CMAKE_FIND_ROOT_PATH_BOTH)
5662
if (NOT ELF2UF2_FOUND)
5763
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PICO_SDK_PATH}/tools)
5864
find_package(ELF2UF2)

0 commit comments

Comments
 (0)