-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
64 lines (47 loc) · 1.83 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
# Essential CMake
cmake_minimum_required(VERSION 3.13)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(PROJECT_NAME "PicoLedExample")
# initalize pico_sdk from installed location
# (note this can come from environment, CMake cache etc)
# Pull in Pico SDK (must be before project)
include(pico_sdk_import.cmake)
project(${PROJECT_NAME} C CXX ASM)
set(PICO_CXX_ENABLE_EXCEPTIONS 1)
set(PICO_CXX_ENABLE_RTTI 1)
set(WIFI_SSID $ENV{WIFI_SSID})
set(WIFI_PASSWORD $ENV{WIFI_PASSWORD})
# Initialise the Pico SDK
pico_sdk_init()
# Include the PicoLed Library; this is a clone of the PicoLed repo, with some changes. See README.md
# include("picoled/PicoLed.cmake")
add_subdirectory(./pico_neopixels build)
# Add executable.
add_executable(${PROJECT_NAME}
src/debug_indicator.cpp
src/led_effects.cpp
src/main.cpp
src/mqtt.cpp
)
pico_set_program_name(${PROJECT_NAME} "PicoLedExample")
pico_set_program_version(${PROJECT_NAME} "0.1")
pico_enable_stdio_uart(${PROJECT_NAME} 1)
pico_enable_stdio_usb(${PROJECT_NAME} 1)
# Include Header files from src
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/src
${CMAKE_CURRENT_LIST_DIR}/pico_neopixels/include)
target_compile_definitions(${PROJECT_NAME} PRIVATE
WIFI_SSID=\"${WIFI_SSID}\"
WIFI_PASSWORD=\"${WIFI_PASSWORD}\"
)
# Add the standard library to the build
# note that addition of the pico_lwip_mqtt available in the 1.5.0 C++ PicoSDK
target_link_libraries(${PROJECT_NAME}
pico_stdlib
# PicoLed
pico_multicore
pico_neopixel
pico_cyw43_arch_lwip_threadsafe_background
pico_lwip_mqtt )
pico_add_extra_outputs(${PROJECT_NAME})