forked from espressif/esp-adf-libs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
124 lines (97 loc) · 5.18 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
# Set the supported library variable for different chips
set(esp_h264_name "")
IF (CONFIG_IDF_TARGET STREQUAL "esp32")
set(recorder_engine_name "recorder_engine")
ELSEIF (CONFIG_IDF_TARGET STREQUAL "esp32s2")
set(recorder_engine_name "")
ELSEIF (CONFIG_IDF_TARGET STREQUAL "esp32s3")
set(recorder_engine_name "recorder_engine")
set(esp_h264_name "esp_h264")
list(APPEND COMPONENT_ADD_INCLUDEDIRS ./esp_h264/include)
ELSEIF (CONFIG_IDF_TARGET STREQUAL "esp32c3")
set(recorder_engine_name "")
ELSEIF (CONFIG_IDF_TARGET STREQUAL "esp32c6")
set(recorder_engine_name "")
ENDIF ()
# Add the source code and header file
list(APPEND COMPONENT_ADD_INCLUDEDIRS ./esp_audio/include
./esp_codec/include/codec
./esp_codec/include/processing
./media_lib_sal/include
./media_lib_sal/include/port
./recorder_engine/include
./recorder_engine/include
./audio_misc/include
./esp_muxer/include)
if (CONFIG_MEDIA_PROTOCOL_LIB_ENABLE)
list(APPEND COMPONENT_ADD_INCLUDEDIRS ./esp_media_protocols/include)
endif()
list(APPEND COMPONENT_SRCS ./esp_codec/audio_alc.c
./esp_codec/audio_sonic.c
./esp_codec/audio_forge.c
./esp_codec/downmix.c
./esp_codec/equalizer.c
./esp_codec/filter_resample.c
./esp_codec/wav_encoder.c
./media_lib_sal/media_lib_common.c
./media_lib_sal/media_lib_os.c
./media_lib_sal/mem_trace/media_lib_mem_trace.c
./media_lib_sal/mem_trace/media_lib_mem_his.c
./media_lib_sal/port/media_lib_os_freertos.c
./media_lib_sal/media_lib_adapter.c)
if (CONFIG_MEDIA_PROTOCOL_LIB_ENABLE)
list(APPEND COMPONENT_SRCS ./media_lib_sal/media_lib_crypt.c ./media_lib_sal/port/media_lib_crypt_default.c
./media_lib_sal/media_lib_socket.c ./media_lib_sal/port/media_lib_socket_default.c
./media_lib_sal/media_lib_tls.c ./media_lib_sal/port/media_lib_tls_default.c
./media_lib_sal/media_lib_netif.c ./media_lib_sal/port/media_lib_netif_default.c)
endif()
IF (NOT (recorder_engine_name STREQUAL ""))
list(APPEND COMPONENT_ADD_INCLUDEDIRS ./audio_misc/include)
list(APPEND COMPONENT_SRCS ./audio_misc/rec_eng_helper.c)
if (CONFIG_REC_ENG_ENABLE_VAD_ONLY)
set(target_recorder_engine "recorder_engine_vad")
elseif (CONFIG_REC_ENG_ENABLE_VAD_WWE)
set(target_recorder_engine "recorder_engine_vad_wwe")
else()
set(target_recorder_engine "recorder_engine")
endif()
ELSE()
set(target_recorder_engine "")
ENDIF ()
set(COMPONENT_REQUIRES audio_pipeline audio_sal esp-sr nghttp esp-tls esp_netif)
register_component()
message(STATUS "Chip is ${CONFIG_IDF_TARGET}, ${CMAKE_CURRENT_SOURCE_DIR}")
set(TARGET_LIB_PATH "-L ${CMAKE_CURRENT_SOURCE_DIR}/esp_audio/lib/${CONFIG_IDF_TARGET}"
"-L ${CMAKE_CURRENT_SOURCE_DIR}/esp_codec/lib/${CONFIG_IDF_TARGET}"
"-L ${CMAKE_CURRENT_SOURCE_DIR}/recorder_engine/lib/${CONFIG_IDF_TARGET}")
if (CONFIG_MEDIA_PROTOCOL_LIB_ENABLE)
list(APPEND TARGET_LIB_PATH "-L ${CMAKE_CURRENT_SOURCE_DIR}/esp_media_protocols/lib/${CONFIG_IDF_TARGET}")
endif()
target_link_libraries(${COMPONENT_TARGET} "${TARGET_LIB_PATH}")
# GREATER_EQUAL is only available on CMake +3.7.
# To be totally compatible with older versions, let's use GREATER instead
IF (IDF_VERSION_MAJOR GREATER 3)
set(name_of_recorder_engine_lib "lib${target_recorder_engine}.a")
add_prebuilt_library(esp_audio "${CMAKE_CURRENT_SOURCE_DIR}/esp_audio/lib/${CONFIG_IDF_TARGET}/libesp_audio.a"
PRIV_REQUIRES esp-adf-libs)
add_prebuilt_library(esp_codec "${CMAKE_CURRENT_SOURCE_DIR}/esp_codec/lib/${CONFIG_IDF_TARGET}/libesp_codec.a"
PRIV_REQUIRES esp-adf-libs)
add_prebuilt_library(esp_processing "${CMAKE_CURRENT_SOURCE_DIR}/esp_codec/lib/${CONFIG_IDF_TARGET}/libesp_processing.a"
PRIV_REQUIRES esp-adf-libs)
add_prebuilt_library(esp_h264 "${CMAKE_CURRENT_SOURCE_DIR}/${esp_h264_name}/lib/${CONFIG_IDF_TARGET}/lib${esp_h264_name}.a"
PRIV_REQUIRES esp-adf-libs)
IF (NOT (recorder_engine_name STREQUAL ""))
add_prebuilt_library(recorder_engine "${CMAKE_CURRENT_SOURCE_DIR}/recorder_engine/lib/${CONFIG_IDF_TARGET}/${name_of_recorder_engine_lib}"
PRIV_REQUIRES esp-adf-libs)
ENDIF()
add_prebuilt_library(esp_muxer "${CMAKE_CURRENT_SOURCE_DIR}/esp_muxer/lib/${CONFIG_IDF_TARGET}/libesp_muxer.a"
PRIV_REQUIRES esp-adf-libs)
ENDIF (IDF_VERSION_MAJOR GREATER 3)
set(TARGET_LIB_NAME esp_processing esp_audio esp_codec esp_muxer ${esp_h264_name})
IF (NOT (recorder_engine_name STREQUAL ""))
list(APPEND TARGET_LIB_NAME ${target_recorder_engine})
ENDIF()
if (CONFIG_MEDIA_PROTOCOL_LIB_ENABLE)
list(APPEND TARGET_LIB_NAME esp_media_protocols)
endif()
target_link_libraries(${COMPONENT_TARGET} "-Wl,--start-group" ${TARGET_LIB_NAME} "-Wl,--end-group")