-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
51 lines (45 loc) · 2.33 KB
/
CMakeLists.txt
File metadata and controls
51 lines (45 loc) · 2.33 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
idf_component_register(
SRCS "vendor/ableton-link/extensions/abl_link/src/abl_link.cpp"
"src/if_index_compat.c"
INCLUDE_DIRS "vendor/ableton-link/extensions/abl_link/include"
REQUIRES asio
PRIV_REQUIRES sock_utils esp_timer esp_netif
)
# C++11 is required for Ableton Link - use specific feature like the official example
# Using PRIVATE since only our wrapper needs C++11, not consumers
target_compile_features(${COMPONENT_LIB} PRIVATE cxx_generalized_initializers)
# Ableton Link include directories (internal, abl_link.cpp needs Link.hpp)
target_include_directories(${COMPONENT_LIB} PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/vendor/ableton-link/include"
)
# ESP_PLATFORM is automatically defined by ESP-IDF, which Link uses to detect ESP32
# Define required ESP32 platform configuration for Ableton Link
# LINK_ESP_TASK_CORE_ID: Which core to run Link tasks on (configurable via Kconfig)
# -1 means tskNO_AFFINITY, 0/1 for specific cores
# When FREERTOS_UNICORE is enabled, the Kconfig option is hidden, so we default to tskNO_AFFINITY
if(DEFINED CONFIG_LINK_ESP_TASK_CORE_ID)
if(CONFIG_LINK_ESP_TASK_CORE_ID EQUAL -1)
set(LINK_ESP_TASK_CORE_ID tskNO_AFFINITY)
else()
set(LINK_ESP_TASK_CORE_ID ${CONFIG_LINK_ESP_TASK_CORE_ID})
endif()
else()
set(LINK_ESP_TASK_CORE_ID tskNO_AFFINITY)
endif()
target_compile_definitions(${COMPONENT_LIB} PRIVATE LINK_ESP_TASK_CORE_ID=${LINK_ESP_TASK_CORE_ID})
# Suppress return-type warnings for Link code (ASIO_NO_EXCEPTIONS causes unreachable code paths)
# Link doesn't fully support no-exceptions mode
# Add -fexceptions explicitly like the official ESP32 example
target_compile_options(${COMPONENT_LIB} PRIVATE
-Wno-return-type
-fexceptions
# Link uses multi-character constants ('__ht', 'tmln', etc.) as protocol message tags.
# This is implementation-defined, but Link guards against byte-order surprises with
# static_assert checks. ESP-IDF v6.0 promotes -Wmultichar to -Werror.
-Wno-multichar
)
# ESP-IDF component manager can sometimes mess up the link order when multiple components
# are involved. To fix link errors caused by that, we use --start-group/--end-group around
# standard libraries to make sure all symbols are resolved correctly.
target_link_libraries(${COMPONENT_LIB} INTERFACE
"-Wl,--start-group" "-lstdc++" "-lc" "-Wl,--end-group")