-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
92 lines (77 loc) · 2.36 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
cmake_minimum_required(VERSION 3.12)
set(PICO_PLATFORM rp2350-arm-s)
set(PICO_BOARD pimoroni_pico_plus2_rp2350)
# Change your executable name to something creative!
set(NAME presto-boilerplate) # <-- Name your project/executable here!
include(pimoroni_pico_import.cmake)
include(pico_sdk_import.cmake)
# Gooey boilerplate
project(${NAME} C CXX ASM)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
# Initialize the SDK
pico_sdk_init()
if (NOT PIMORONI_PRESTO_PATH)
set(PIMORONI_PRESTO_PATH ../../presto/)
endif()
if(NOT IS_ABSOLUTE ${PIMORONI_PRESTO_PATH})
get_filename_component(
PIMORONI_PRESTO_PATH
"${CMAKE_CURRENT_BINARY_DIR}/${PIMORONI_PRESTO_PATH}"
ABSOLUTE)
endif()
message("PIMORONI_PRESTO_PATH is ${PIMORONI_PRESTO_PATH}")
set(PIMORONI_PRESTO_PATH ${PIMORONI_PRESTO_PATH} CACHE PATH "Path to the Presto libraries" FORCE)
include_directories(${PIMORONI_PRESTO_PATH})
list(APPEND CMAKE_MODULE_PATH ${PIMORONI_PRESTO_PATH})
include(drivers/st7701/st7701_presto)
include_directories(${CMAKE_CURRENT_LIST_DIR}/uzlib/src)
# Add your source files
add_executable(${NAME}
src/main.cpp # <-- Add source files here!
src/fileio.cpp
)
# Include required libraries
# This assumes `pimoroni-pico` is stored alongside your project
include(common/pimoroni_i2c)
include(common/pimoroni_bus)
include(drivers/fatfs/fatfs)
include(drivers/sdcard/sdcard)
include(libraries/pico_graphics/pico_graphics)
include(libraries/pico_vector/pico_vector)
# Don't forget to link the libraries you need!
target_link_libraries(${NAME}
st7701_presto
pico_stdlib
pico_multicore
pimoroni_i2c
sdcard
fatfs
hardware_interp
pico_graphics
pico_vector
)
# Configure the SD Card library for Presto
target_compile_definitions(${NAME} PRIVATE
SDCARD_SPI_BUS=spi0
SDCARD_PIN_SPI0_CS=39
SDCARD_PIN_SPI0_SCK=34
SDCARD_PIN_SPI0_MOSI=35
SDCARD_PIN_SPI0_MISO=36
PICO_CLOCK_AJDUST_PERI_CLOCK_WITH_SYS_CLOCK=1
)
# create map/bin/hex file etc.
pico_add_extra_outputs(${NAME})
# Enable USB UART output only
pico_enable_stdio_uart(${NAME} 0)
pico_enable_stdio_usb(${NAME} 1)
# Set up files for the release packages
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/${NAME}.uf2
${CMAKE_CURRENT_LIST_DIR}/README.md
DESTINATION .
)
set(CPACK_PACKAGE_FILE_NAME ${NAME})
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF)
set(CPACK_GENERATOR "ZIP" "TGZ")
include(CPack)