Austin Schuh | 208337d | 2022-01-01 14:29:11 -0800 | [diff] [blame^] | 1 | # PICO_CMAKE_CONFIG: PICO_PLATFORM, platform to build for e.g. rp2040/host, default=rp2040 or environment value, group=build |
| 2 | if (DEFINED ENV{PICO_PLATFORM} AND (NOT PICO_PLATFORM)) |
| 3 | set(PICO_PLATFORM $ENV{PICO_PLATFORM}) |
| 4 | message("Using PICO_PLATFORM from environment ('${PICO_PLATFORM}')") |
| 5 | else() |
| 6 | if (NOT PICO_PLATFORM) |
| 7 | set(PICO_PLATFORM "rp2040") |
| 8 | pico_message("Defaulting PICO_PLATFORM to ${PICO_PLATFORM} since not specified.") |
| 9 | else() |
| 10 | message("PICO platform is ${PICO_PLATFORM}.") |
| 11 | endif() |
| 12 | endif () |
| 13 | |
| 14 | set(PICO_PLATFORM ${PICO_PLATFORM} CACHE STRING "PICO Build platform (e.g. rp2040, host)") |
| 15 | |
| 16 | # PICO_CMAKE_CONFIG: PICO_CMAKE_RELOAD_PLATFORM_FILE, custom CMake file to use to set up the platform environment, default=none, group=build |
| 17 | set(PICO_CMAKE_PRELOAD_PLATFORM_FILE "" CACHE INTERNAL "") |
| 18 | set(PICO_CMAKE_PRELOAD_PLATFORM_DIR "${CMAKE_CURRENT_LIST_DIR}/preload/platforms" CACHE INTERNAL "") |
| 19 | |
| 20 | if (NOT PICO_CMAKE_PRELOAD_PLATFORM_FILE) |
| 21 | set(PICO_CMAKE_PRELOAD_PLATFORM_FILE ${PICO_CMAKE_PRELOAD_PLATFORM_DIR}/${PICO_PLATFORM}.cmake CACHE INTERNAL "") |
| 22 | endif () |
| 23 | |
| 24 | if (NOT EXISTS "${PICO_CMAKE_PRELOAD_PLATFORM_FILE}") |
| 25 | message(FATAL_ERROR "${PICO_CMAKE_PRELOAD_PLATFORM_FILE} does not exist. \ |
| 26 | Either specify a valid PICO_PLATFORM (or PICO_CMAKE_PRELOAD_PLATFORM_FILE).") |
| 27 | endif () |
| 28 | |
| 29 | include(${PICO_CMAKE_PRELOAD_PLATFORM_FILE}) |