Skip to content

Commit 0a5ae3a

Browse files
committed
fix(mosq): Make sock_utils work for linux target
1 parent bf61816 commit 0a5ae3a

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

ci/test_broker/run.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ set -e
55
BROKER_PATH=components/mosquitto/examples/broker
66
SCRIPT_DIR=$(dirname $0)
77
cp ${SCRIPT_DIR}/sdkconfig.broker ${BROKER_PATH}/sdkconfig.broker
8+
idf.py --preview -B build -C ${BROKER_PATH} set-target linux
89
idf.py -B build -DSDKCONFIG=sdkconfig.broker -C ${BROKER_PATH} build
910

1011
./build/broker.elf &

components/mosquitto/idf_component.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,3 @@ dependencies:
55
idf: '>=5.1'
66
espressif/sock_utils:
77
version: '^0.2'
8-
rules:
9-
- if: target not in ["linux"]

components/sock_utils/CMakeLists.txt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,15 @@ idf_component_register(SRCS "src/getnameinfo.c"
66
INCLUDE_DIRS "include"
77
PRIV_REQUIRES lwip esp_netif)
88

9+
idf_build_get_property(idf_target IDF_TARGET)
10+
11+
if(NOT ${idf_target} STREQUAL "linux")
912
# To support declarations from standard headers in lwip component
1013
# - socket pair from lwip/sockets.h
1114
# - gai_strerror from lwip/netdb.h
1215
# also need to make lwip depend on the sock_utils lib
13-
idf_component_get_property(lwip lwip COMPONENT_LIB)
14-
target_compile_definitions(${lwip} PUBLIC LWIP_SOCKET_HAS_SOCKETPAIR=1)
15-
target_compile_definitions(${lwip} PUBLIC LWIP_NETDB_HAS_GAI_STRERROR=1)
16-
target_link_libraries(${lwip} PUBLIC ${COMPONENT_LIB})
16+
idf_component_get_property(lwip lwip COMPONENT_LIB)
17+
target_compile_definitions(${lwip} PUBLIC LWIP_SOCKET_HAS_SOCKETPAIR=1)
18+
target_compile_definitions(${lwip} PUBLIC LWIP_NETDB_HAS_GAI_STRERROR=1)
19+
target_link_libraries(${lwip} PUBLIC ${COMPONENT_LIB})
20+
endif()

0 commit comments

Comments
 (0)