-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
87 lines (73 loc) · 2.89 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
cmake_minimum_required(VERSION 3.24)
# Set the board type for pin and LED decisions
#set(PICO_BOARD pico)
set(PICO_BOARD pico_w) # <---------- Required for this implementation!!!
#set(PICO_BOARD waveshare_rp2040_zero)
#set(PICO_BOARD seeed_xiao_rp2040)
# TFT display type - enable one of the following
#add_compile_definitions(DISPLAY_ILI934X)
add_compile_definitions(DISPLAY_ILI948X)
# Number of quadrants to use, needed for memory usage
add_compile_definitions(DISPLAY_QUADRANTS=4)
# Set the following if using Waveshare Pico-ResTouch-LCD for GPIO assignments
add_compile_definitions(DISPLAY_PICO_RESTOUCH)
# initialize the SDK based on PICO_SDK_PATH
# note: this must happen before project()
include(pico_sdk_import.cmake)
#include(pico_libs_import.cmake)
project(gpsmon_tft C CXX ASM)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
# initialize the Raspberry Pi Pico SDK
pico_sdk_init()
add_compile_options(-Wall
-Wno-format # int != int32_t as far as the compiler is concerned because gcc has int32_t as long int
-Wno-unused-function # we have some for the docs that aren't called
-Wno-maybe-uninitialized
)
# Power status
add_library(power_status_adc INTERFACE)
target_sources(power_status_adc INTERFACE
${CMAKE_CURRENT_LIST_DIR}/src/power_status.cpp
)
target_include_directories(power_status_adc INTERFACE
${CMAKE_CURRENT_LIST_DIR}/src
)
target_link_libraries(power_status_adc INTERFACE
hardware_adc
hardware_gpio
)
add_executable(gpsmon_tft)
pico_enable_stdio_usb(${PROJECT_NAME} 1)
pico_enable_stdio_uart(${PROJECT_NAME} 0)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/generated)
# generate the header file into the source tree as it is included in the RP2040 datasheet
pico_generate_pio_header(gpsmon_tft
${CMAKE_CURRENT_LIST_DIR}/src/ws2812.pio
OUTPUT_DIR
${CMAKE_CURRENT_LIST_DIR}/generated)
add_subdirectory(src)
target_include_directories(gpsmon_tft PRIVATE
${CMAKE_CURRENT_LIST_DIR}
${CMAKE_CURRENT_LIST_DIR}/src) # Needed for lwipopts.h
if (PICO_BOARD STREQUAL pico_w)
target_link_libraries(gpsmon_tft
pico_stdlib
pico_stdio
hardware_gpio
hardware_pio
hardware_spi
pico_cyw43_arch_none
pico_cyw43_arch_lwip_threadsafe_background
power_status_adc)
else()
target_link_libraries(gpsmon_tft
pico_stdlib
pico_stdio
hardware_gpio
hardware_pio
hardware_spi
power_status_adc)
endif()
# create map/bin/hex/uf2 file in addition to ELF.
pico_add_extra_outputs(gpsmon_tft)