make build script a bit better

This commit is contained in:
Triss 2021-06-08 02:56:10 +02:00
parent 08b0d35293
commit c1ac0f89da
1 changed files with 7 additions and 6 deletions

View File

@ -1,3 +1,9 @@
option(USE_SYSTEMWIDE_PICOSDK "Use the systemwide Pico SDK instead of relying on the one from a deeply nested Git submodule (OFF by default)" OFF)
option(PICO_NO_FLASH "Disable writing the compiled program to flash, and only load it to RAM. Useful for testing, but not much else (OFF by default)." OFF)
option(PICO_COPY_TO_RAM "Run all code in RAM, while the program is also stored on flash. On bootup, everything will be copied to RAM (OFF by default)." OFF)
set(FAMILY "rp2040" CACHE STRING "Board/MCU family, decides which drivers to use. Set to RP2040 by default.")
set(BOARD "raspberry_pi_pico" CACHE STRING "Board used, determines the pinout. Defaults to the Raspberry Pi Pico.")
# use directory name for project id # use directory name for project id
get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME) get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME)
set(PROJECT ${BOARD}-${PROJECT}) set(PROJECT ${BOARD}-${PROJECT})
@ -6,11 +12,6 @@ set(PROJECT ${BOARD}-${PROJECT})
set(TOP "./tinyusb") set(TOP "./tinyusb")
get_filename_component(TOP "${TOP}" REALPATH) get_filename_component(TOP "${TOP}" REALPATH)
option(USE_SYSTEMWIDE_PICOSDK "Use the systemwide Pico SDK instead of relying on the one from a deeply nested Git submodule (OFF by default)" OFF)
# OPTION: PICO_NO_FLASH: load only into RAM (useful for testing)
# OPTION: PICO_COPY_TO_RAM: place the code/rodata into RAM at startup (while still stored in flash)
# TODO: add option for FAMILY and BOARD
# Check for -DFAMILY= # Check for -DFAMILY=
if(FAMILY STREQUAL "rp2040") if(FAMILY STREQUAL "rp2040")
cmake_minimum_required(VERSION 3.12) cmake_minimum_required(VERSION 3.12)
@ -67,5 +68,5 @@ if(FAMILY STREQUAL "rp2040")
pico_add_extra_outputs(${PROJECT}) pico_add_extra_outputs(${PROJECT})
else() else()
message(FATAL_ERROR "Invalid FAMILY specified") message(FATAL_ERROR "Invalid FAMILY '${FAMILY}' specified")
endif() endif()