-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
101 lines (83 loc) · 2.52 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
93
94
95
96
97
98
99
100
101
# == DO NOT EDIT THE FOLLOWING LINES for the Raspberry Pi Pico VS Code Extension to work ==
if(WIN32)
set(USERHOME $ENV{USERPROFILE})
else()
set(USERHOME $ENV{HOME})
endif()
set(sdkVersion 2.1.0)
set(toolchainVersion 13_3_Rel1)
set(picotoolVersion 2.1.0)
set(picoVscode ${USERHOME}/.pico-sdk/cmake/pico-vscode.cmake)
if (EXISTS ${picoVscode})
include(${picoVscode})
endif()
# ====================================================================================
cmake_minimum_required(VERSION 3.13)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(PICO_BOARD pico_w CACHE STRING "Board type")
# Include Raspberry Pi Pico SDK
include(pico_sdk_import.cmake)
# Pimoroni setup
set(PIMORONI_PICO_PATH "/home/jaeheonshim/pico/pimoroni-pico" CACHE PATH "Path to Pimoroni Pico")
include(pimoroni_pico_import.cmake)
project(inky_dashboard C CXX ASM)
pico_sdk_init()
add_compile_options(
-Oz
-ffunction-sections
-fdata-sections
)
add_link_options(-Wl,--gc-sections)
# Add LVGL library
file(GLOB_RECURSE LVGL_SOURCES
"${CMAKE_CURRENT_LIST_DIR}/lvgl/src/*.c"
)
add_library(lvgl STATIC)
target_sources(lvgl PRIVATE ${LVGL_SOURCES})
target_include_directories(lvgl PUBLIC
${CMAKE_CURRENT_LIST_DIR}/lvgl
${CMAKE_CURRENT_LIST_DIR}/lvgl/src
${CMAKE_CURRENT_LIST_DIR} # Ensure lv_conf.h is found
)
# Add Pimoroni librarie
add_subdirectory(${PIMORONI_PICO_PATH}/common pimoroni_i2c)
add_subdirectory(${PIMORONI_PICO_PATH}/libraries inky_frame_7)
add_executable(inky_dashboard src/inky_dashboard.cpp src/inky_interface.cpp src/calendar.cpp src/net.cpp)
pico_set_program_name(inky_dashboard "inky_dashboard")
pico_set_program_version(inky_dashboard "0.1")
pico_enable_stdio_uart(inky_dashboard 0)
pico_enable_stdio_usb(inky_dashboard 0)
# Add json
add_subdirectory(json)
# Add include directories
target_include_directories(inky_dashboard PRIVATE
${CMAKE_CURRENT_LIST_DIR}/src
${CMAKE_CURRENT_LIST_DIR}/lvgl
${PIMORONI_PICO_PATH}/common
)
# Link libraries
target_link_libraries(inky_dashboard
pico_cyw43_arch_lwip_threadsafe_background
pico_lwip
pico_lwip_http
inky73
inky_frame_7
hardware_pwm
hardware_spi
hardware_i2c
hardware_rtc
pico_graphics
psram_display
pcf85063a
lvgl
nlohmann_json::nlohmann_json
-Wl,--gc-sections
)
# Add font files
file(GLOB FONT_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/fonts/*.c")
if (FONT_FILES)
target_sources(inky_dashboard PRIVATE ${FONT_FILES})
endif()
pico_add_extra_outputs(inky_dashboard)