forked from espressif/esp-sr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
180 lines (154 loc) · 6.53 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
if(IDF_TARGET STREQUAL "esp32")
set(include_dirs
src/include
esp-tts/esp_tts_chinese/include
include/esp32
)
set(srcs
src/model_path.c
src/esp_mn_speech_commands.c
src/esp_process_sdkconfig.c
)
set(requires
json
spiffs
)
IF (IDF_VERSION_MAJOR GREATER 4)
list(APPEND requires esp_partition)
ENDIF (IDF_VERSION_MAJOR GREATER 4)
idf_component_register(SRCS ${srcs}
INCLUDE_DIRS ${include_dirs}
REQUIRES ${requires}
PRIV_REQUIRES spi_flash)
target_link_libraries(${COMPONENT_TARGET} "-L ${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32")
target_link_libraries(${COMPONENT_TARGET} "-L ${CMAKE_CURRENT_SOURCE_DIR}/esp-tts/esp_tts_chinese/esp32")
add_prebuilt_library(esp_audio_processor "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32/libesp_audio_processor.a" PRIV_REQUIRES ${COMPONENT_NAME})
add_prebuilt_library(wakenet "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32/libwakenet.a" PRIV_REQUIRES ${COMPONENT_NAME})
add_prebuilt_library(multinet "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32/libmultinet.a" PRIV_REQUIRES ${COMPONENT_NAME})
add_prebuilt_library(esp_audio_front_end "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32/libesp_audio_front_end.a" PRIV_REQUIRES ${COMPONENT_NAME})
target_link_libraries(${COMPONENT_TARGET} "-Wl,--start-group"
multinet
dl_lib
c_speech_features
wakeword_model
multinet2_ch
esp_audio_processor
esp_audio_front_end
esp_tts_chinese
voice_set_xiaole
wakenet
"-Wl,--end-group")
elseif(${IDF_TARGET} STREQUAL "esp32s3")
set(include_dirs
src/include
esp-tts/esp_tts_chinese/include
include/esp32s3
)
set(srcs
src/model_path.c
src/esp_mn_speech_commands.c
src/esp_process_sdkconfig.c
)
set(requires
json
spiffs
)
IF (IDF_VERSION_MAJOR GREATER 4)
list(APPEND requires esp_partition)
ENDIF (IDF_VERSION_MAJOR GREATER 4)
idf_component_register(SRCS ${srcs}
INCLUDE_DIRS ${include_dirs}
REQUIRES ${requires}
PRIV_REQUIRES spi_flash)
target_link_libraries(${COMPONENT_TARGET} "-L ${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32s3")
target_link_libraries(${COMPONENT_TARGET} "-L ${CMAKE_CURRENT_SOURCE_DIR}/esp-tts/esp_tts_chinese/esp32s3")
add_prebuilt_library(esp_audio_processor "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32s3/libesp_audio_processor.a" PRIV_REQUIRES ${COMPONENT_NAME})
add_prebuilt_library(wakenet "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32s3/libwakenet.a" PRIV_REQUIRES ${COMPONENT_NAME})
add_prebuilt_library(multinet "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32s3/libmultinet.a" PRIV_REQUIRES ${COMPONENT_NAME})
add_prebuilt_library(esp_audio_front_end "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32s3/libesp_audio_front_end.a" PRIV_REQUIRES ${COMPONENT_NAME})
add_prebuilt_library(hufzip "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32s3/libhufzip.a" PRIV_REQUIRES ${COMPONENT_NAME})
add_prebuilt_library(nsnet "${CMAKE_CURRENT_SOURCE_DIR}/lib/esp32s3/libnsnet.a" PRIV_REQUIRES ${COMPONENT_NAME})
idf_component_get_property(esp_dsp_lib espressif__esp-dsp COMPONENT_LIB)
target_link_libraries(${COMPONENT_TARGET} "-Wl,--start-group"
hufzip
dl_lib
fst
c_speech_features
$<TARGET_FILE:${esp_dsp_lib}>
esp_audio_front_end
esp_audio_processor
multinet
flite_g2p
esp_tts_chinese
voice_set_xiaole
nsnet
wakenet
"-Wl,--end-group")
set(MVMODEL_EXE ${COMPONENT_PATH}/model/movemodel.py)
idf_build_get_property(build_dir BUILD_DIR)
set(image_file ${build_dir}/srmodels/srmodels.bin)
add_custom_command(
OUTPUT ${image_file}
COMMENT "Move and Pack models..."
COMMAND python ${MVMODEL_EXE} -d1 ${SDKCONFIG} -d2 ${COMPONENT_PATH} -d3 ${build_dir}
DEPENDS ${SDKCONFIG}
VERBATIM)
add_custom_target(srmodels_bin ALL DEPENDS ${image_file})
add_dependencies(flash srmodels_bin)
partition_table_get_partition_info(size "--partition-name model" "size")
partition_table_get_partition_info(offset "--partition-name model" "offset")
if("${size}" AND "${offset}")
esptool_py_flash_to_partition(flash "model" "${image_file}")
else()
set(message "Failed to find model in partition table file"
"Please add a line(Name=model, Size>recommended size in log) to the partition file.")
endif()
elseif(${IDF_TARGET} STREQUAL "esp32s2")
set(requires
spiffs
)
IF (IDF_VERSION_MAJOR GREATER 4)
list(APPEND requires esp_partition)
ENDIF (IDF_VERSION_MAJOR GREATER 4)
idf_component_register(SRCS .
INCLUDE_DIRS esp-tts/esp_tts_chinese/include
REQUIRES ${requires}
PRIV_REQUIRES spi_flash)
target_link_libraries(${COMPONENT_TARGET} INTERFACE "-L ${CMAKE_CURRENT_SOURCE_DIR}/esp-tts/esp_tts_chinese/esp32s2")
target_link_libraries(${COMPONENT_TARGET} INTERFACE "-Wl,--start-group"
esp_tts_chinese
voice_set_xiaole
"-Wl,--end-group")
elseif(${IDF_TARGET} STREQUAL "esp32c3")
set(requires
spiffs
)
IF (IDF_VERSION_MAJOR GREATER 4)
list(APPEND requires esp_partition)
ENDIF (IDF_VERSION_MAJOR GREATER 4)
idf_component_register(SRCS .
INCLUDE_DIRS esp-tts/esp_tts_chinese/include
REQUIRES ${requires}
PRIV_REQUIRES spi_flash)
target_link_libraries(${COMPONENT_TARGET} INTERFACE "-L ${CMAKE_CURRENT_SOURCE_DIR}/esp-tts/esp_tts_chinese/esp32c3")
target_link_libraries(${COMPONENT_TARGET} INTERFACE "-Wl,--start-group"
esp_tts_chinese
voice_set_xiaole
"-Wl,--end-group")
elseif(${IDF_TARGET} STREQUAL "esp32c6")
set(requires
spiffs
)
IF (IDF_VERSION_MAJOR GREATER 4)
list(APPEND requires esp_partition)
ENDIF (IDF_VERSION_MAJOR GREATER 4)
idf_component_register(SRCS .
INCLUDE_DIRS esp-tts/esp_tts_chinese/include
REQUIRES ${requires}
PRIV_REQUIRES spi_flash)
target_link_libraries(${COMPONENT_TARGET} INTERFACE "-L ${CMAKE_CURRENT_SOURCE_DIR}/esp-tts/esp_tts_chinese/esp32c6")
target_link_libraries(${COMPONENT_TARGET} INTERFACE "-Wl,--start-group"
esp_tts_chinese
voice_set_xiaole
"-Wl,--end-group")
endif()