a vim plugin that displays stuff on an led matrix
1# This file is copied from the Pico SDK
2# It allows the CMake project to find the Pico SDK
3
4# This is a copy of <PICO_SDK_PATH>/external/pico_sdk_import.cmake
5
6# This can be dropped into an external project to help locate the Pico SDK
7# It should be included prior to project()
8
9if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH))
10 set(PICO_SDK_PATH $ENV{PICO_SDK_PATH})
11 message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')")
12endif ()
13
14if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT} AND (NOT PICO_SDK_FETCH_FROM_GIT))
15 set(PICO_SDK_FETCH_FROM_GIT $ENV{PICO_SDK_FETCH_FROM_GIT})
16 message("Using PICO_SDK_FETCH_FROM_GIT from environment ('${PICO_SDK_FETCH_FROM_GIT}')")
17endif ()
18
19if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_PATH))
20 set(PICO_SDK_FETCH_FROM_GIT_PATH $ENV{PICO_SDK_FETCH_FROM_GIT_PATH})
21 message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')")
22endif ()
23
24set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the Raspberry Pi Pico SDK")
25set(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")
26set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK")
27
28if (NOT PICO_SDK_PATH)
29 if (PICO_SDK_FETCH_FROM_GIT)
30 include(FetchContent)
31 set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR})
32 if (PICO_SDK_FETCH_FROM_GIT_PATH)
33 get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}")
34 endif ()
35 FetchContent_Declare(
36 pico_sdk
37 GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
38 GIT_TAG master
39 )
40 if (NOT pico_sdk)
41 message("Downloading Raspberry Pi Pico SDK")
42 FetchContent_Populate(pico_sdk)
43 set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR})
44 endif ()
45 set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE})
46 else ()
47 message(FATAL_ERROR
48 "SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git."
49 )
50 endif ()
51endif ()
52
53get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
54if (NOT EXISTS ${PICO_SDK_PATH})
55 message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found")
56endif ()
57
58set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake)
59if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE})
60 message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the Raspberry Pi Pico SDK")
61endif ()
62
63set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the Raspberry Pi Pico SDK" FORCE)
64
65include(${PICO_SDK_INIT_CMAKE_FILE})