annotate pico_sdk_import.cmake @ 2:0d653f60dec8

Actually get data moving out. Previous shape info caused a hard fault.
author Daniel O'Connor <darius@dons.net.au>
date Mon, 29 Mar 2021 17:39:00 +1030
parents a55e39064a71
children 2db42eaba3c8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
1 # This is a copy of <PICO_SDK_PATH>/external/pico_sdk_import.cmake
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
2
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
3 # This can be dropped into an external project to help locate this SDK
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
4 # It should be include()ed prior to project()
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
5
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
6 if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH))
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
7 set(PICO_SDK_PATH $ENV{PICO_SDK_PATH})
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
8 message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')")
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
9 endif ()
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
10
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
11 if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT} AND (NOT PICO_SDK_FETCH_FROM_GIT))
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
12 set(PICO_SDK_FETCH_FROM_GIT $ENV{PICO_SDK_FETCH_FROM_GIT})
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
13 message("Using PICO_SDK_FETCH_FROM_GIT from environment ('${PICO_SDK_FETCH_FROM_GIT}')")
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
14 endif ()
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
15
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
16 if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_PATH))
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
17 set(PICO_SDK_FETCH_FROM_GIT_PATH $ENV{PICO_SDK_FETCH_FROM_GIT_PATH})
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
18 message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')")
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
19 endif ()
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
20
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
21 set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the Raspberry Pi Pico SDK")
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
22 set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of SDK from git if not otherwise locatable")
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
23 set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK")
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
24
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
25 if (NOT PICO_SDK_PATH)
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
26 if (PICO_SDK_FETCH_FROM_GIT)
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
27 include(FetchContent)
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
28 set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR})
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
29 if (PICO_SDK_FETCH_FROM_GIT_PATH)
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
30 get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}")
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
31 endif ()
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
32 FetchContent_Declare(
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
33 pico_sdk
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
34 GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
35 GIT_TAG master
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
36 )
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
37 if (NOT pico_sdk)
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
38 message("Downloading Raspberry Pi Pico SDK")
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
39 FetchContent_Populate(pico_sdk)
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
40 set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR})
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
41 endif ()
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
42 set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE})
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
43 else ()
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
44 message(FATAL_ERROR
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
45 "SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git."
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
46 )
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
47 endif ()
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
48 endif ()
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
49
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
50 get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
51 if (NOT EXISTS ${PICO_SDK_PATH})
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
52 message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found")
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
53 endif ()
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
54
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
55 set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake)
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
56 if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE})
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
57 message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the Raspberry Pi Pico SDK")
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
58 endif ()
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
59
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
60 set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the Raspberry Pi Pico SDK" FORCE)
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
61
a55e39064a71 First commit of code that compiles.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
62 include(${PICO_SDK_INIT_CMAKE_FILE})