Repository navigation
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
106 lines (95 loc) · 4.84 KB
/
Copy pathCMakeLists.txt
File metadata and controls
106 lines (95 loc) · 4.84 KB
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
102
103
104
105
106
cmake_minimum_required(VERSION 3.16)
# All external components are pinned and prepared by scripts/bootstrap.sh.
# Disable implicit registry downloads and their in-tree managed_components dir.
set(ENV{IDF_COMPONENT_MANAGER} "0")
# Keep all project-owned ESP-IDF components under src/. The directory contains
# one subdirectory per component, including the application component.
list(APPEND EXTRA_COMPONENT_DIRS "${CMAKE_CURRENT_LIST_DIR}/src")
# Reuse the board-specific ST7305 adapter and its pinned U8g2 source from an
# external checkout. No third-party source is stored in this repository.
if(DEFINED ENV{RLCD_WAVESHARE_COMPONENTS_DIR})
file(TO_CMAKE_PATH "$ENV{RLCD_WAVESHARE_COMPONENTS_DIR}" WAVESHARE_U8G2_COMPONENTS)
else()
set(WAVESHARE_U8G2_COMPONENTS
"${CMAKE_CURRENT_LIST_DIR}/../../third_party/sources/waveshareteam/ESP32-S3-RLCD-4.2/02_Example/ESP-IDF/11_U8G2_Test/components")
endif()
foreach(component_name u8g2 u8g2_st7305)
if(NOT EXISTS "${WAVESHARE_U8G2_COMPONENTS}/${component_name}/CMakeLists.txt")
message(FATAL_ERROR
"Missing Waveshare component '${component_name}'. Expected it under: "
"${WAVESHARE_U8G2_COMPONENTS}")
endif()
list(APPEND EXTRA_COMPONENT_DIRS
"${WAVESHARE_U8G2_COMPONENTS}/${component_name}")
endforeach()
if(DEFINED ENV{RLCD_QRCODE_COMPONENT_DIR})
file(TO_CMAKE_PATH "$ENV{RLCD_QRCODE_COMPONENT_DIR}" QRCODE_COMPONENT_DIR)
else()
set(QRCODE_COMPONENT_DIR
"${CMAKE_CURRENT_LIST_DIR}/../../third_party/sources/espressif/idf-extra-components/qrcode")
endif()
if(NOT EXISTS "${QRCODE_COMPONENT_DIR}/CMakeLists.txt")
message(FATAL_ERROR
"Missing Espressif QR Code component. Expected it under: "
"${QRCODE_COMPONENT_DIR}")
endif()
list(APPEND EXTRA_COMPONENT_DIRS "${QRCODE_COMPONENT_DIR}")
foreach(speech_dependency_var
RLCD_ESP_SR_DIR RLCD_ESP_DSP_DIR RLCD_DL_FFT_DIR RLCD_CJSON_DIR
RLCD_ESP_AUDIO_CODEC_DIR)
if(NOT DEFINED ENV{${speech_dependency_var}})
message(FATAL_ERROR
"Missing ${speech_dependency_var}; source scripts/common.sh or "
"build through ./scripts/build.sh")
endif()
file(TO_CMAKE_PATH "$ENV{${speech_dependency_var}}"
speech_dependency_path)
if(NOT EXISTS "${speech_dependency_path}/CMakeLists.txt")
message(FATAL_ERROR
"Incomplete speech dependency: ${speech_dependency_path}. "
"Run ./scripts/bootstrap.sh first.")
endif()
list(APPEND EXTRA_COMPONENT_DIRS "${speech_dependency_path}")
endforeach()
# ESP WebSocket Client 1.8.0 follows server-provided redirects internally.
# Build a generated copy with only that redirect branch disabled, while
# keeping the pinned external checkout untouched.
if(NOT DEFINED ENV{RLCD_ESP_WEBSOCKET_CLIENT_DIR})
message(FATAL_ERROR
"Missing RLCD_ESP_WEBSOCKET_CLIENT_DIR; source scripts/common.sh or "
"build through ./scripts/build.sh")
endif()
file(TO_CMAKE_PATH "$ENV{RLCD_ESP_WEBSOCKET_CLIENT_DIR}"
RLCD_WEBSOCKET_SOURCE_DIR)
set(RLCD_WEBSOCKET_OUTPUT_DIR
"${CMAKE_BINARY_DIR}/generated-components/esp_websocket_client")
include("${CMAKE_CURRENT_LIST_DIR}/cmake/prepare_esp_websocket_client.cmake")
list(APPEND EXTRA_COMPONENT_DIRS "${RLCD_WEBSOCKET_OUTPUT_DIR}")
set(RLCD_PROJECT_VERSION "" CACHE STRING
"SemVer embedded in the firmware image; empty selects the repository default")
if(NOT "${RLCD_PROJECT_VERSION}" STREQUAL "")
set(PROJECT_VER "${RLCD_PROJECT_VERSION}")
elseif(DEFINED ENV{RLCD_PROJECT_VERSION} AND
NOT "$ENV{RLCD_PROJECT_VERSION}" STREQUAL "")
set(PROJECT_VER "$ENV{RLCD_PROJECT_VERSION}")
else()
set(PROJECT_VER "0.34.0")
endif()
set(COMPONENTS app)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(rlcd_firmware)
# The pinned Waveshare adapter contains one private helper which is currently
# unused. Keep the upstream checkout clean while silencing only that warning.
idf_component_get_property(st7305_component_lib u8g2_st7305 COMPONENT_LIB)
target_compile_options(${st7305_component_lib} PRIVATE -Wno-unused-function)
# The upstream QR wrapper logs its input at INFO level. The input contains the
# temporary access-point password, so compile those logs out instead of relying
# on a runtime log-level setting.
idf_component_get_property(qrcode_component_lib qrcode COMPONENT_LIB)
target_compile_definitions(${qrcode_component_lib} PRIVATE LOG_LOCAL_LEVEL=ESP_LOG_NONE)
# The pinned WebSocket transport logs the complete HTTP Upgrade request at
# ERROR level on a write failure, including Authorization. Compile transport
# logs out; retain structured errors from esp-tls, the HTTP/WebSocket clients
# and our own fixed, credential-free conversation diagnostics.
idf_component_get_property(tcp_transport_component_lib tcp_transport COMPONENT_LIB)
target_compile_definitions(${tcp_transport_component_lib} PRIVATE LOG_LOCAL_LEVEL=ESP_LOG_NONE)