Skip to content

Commit 79b6f4c

Browse files
committed
cmake: codecs
1 parent aa719ba commit 79b6f4c

1 file changed

Lines changed: 16 additions & 5 deletions

File tree

CMakeLists.txt

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,22 @@ set(A2DP_REQUIRES bt esp_common freertos hal log nvs_flash driver esp_ringbuf ar
88
# codec-helix (AAC decode) + codec-sbc (SBC decode, kept alongside
99
# AAC since registering any managed decoder via add_decoder() replaces the
1010
# built-in SBC decode path entirely - see examples/bt_music_receiver_codec)
11-
# are only wired up starting idf v6.2, which is where the Bluedroid stack
12-
# gained multi-SEP / external-codec Kconfig support (BT_A2DP_CODEC_AAC_ENABLED,
13-
# BT_A2DP_SEP_NUM_MAX).
14-
if(IDF_VERSION_MAJOR GREATER 6 OR (IDF_VERSION_MAJOR EQUAL 6 AND IDF_VERSION_MINOR GREATER_EQUAL 2))
15-
list(APPEND A2DP_REQUIRES codec-helix codec-sbc)
11+
# only work starting idf v6.1, which is where the Bluedroid stack gained
12+
# multi-SEP / external-codec Kconfig support (BT_A2DP_CODEC_AAC_ENABLED,
13+
# BT_A2DP_SEP_NUM_MAX). Each one is added to REQUIRES only if it is actually
14+
# present as a component (e.g. pulled in via idf_component.yml into
15+
# managed_components/, or placed in components/) so the build doesn't fail
16+
# for users who only installed one of the two, or neither.
17+
if(IDF_VERSION_MAJOR GREATER 6 )
18+
idf_build_get_property(a2dp_component_dirs COMPONENT_DIRS)
19+
foreach(a2dp_codec codec-helix codec-sbc codec-faad codec-fdk-aac)
20+
foreach(a2dp_component_dir ${a2dp_component_dirs})
21+
if(EXISTS "${a2dp_component_dir}/${a2dp_codec}")
22+
list(APPEND A2DP_REQUIRES ${a2dp_codec})
23+
break()
24+
endif()
25+
endforeach()
26+
endforeach()
1627
endif()
1728

1829
idf_component_register(

0 commit comments

Comments
 (0)