|
|
@@ -1,10 +1,18 @@
|
|
|
+idf_build_get_property(target IDF_TARGET)
|
|
|
+if(NOT ${target} STREQUAL "linux")
|
|
|
+ # ESP platform targets share the same port folder
|
|
|
+ set(target esp32)
|
|
|
+endif()
|
|
|
+
|
|
|
set(include_dirs
|
|
|
include
|
|
|
include/apps
|
|
|
include/apps/sntp
|
|
|
lwip/src/include
|
|
|
- port/esp32/include
|
|
|
- port/esp32/include/arch
|
|
|
+ port/include
|
|
|
+ port/freertos/include/
|
|
|
+ port/${target}/include
|
|
|
+ port/${target}/include/arch
|
|
|
)
|
|
|
|
|
|
set(srcs
|
|
|
@@ -85,11 +93,11 @@ set(srcs
|
|
|
"lwip/src/netif/ppp/upap.c"
|
|
|
"lwip/src/netif/ppp/utils.c"
|
|
|
"lwip/src/netif/ppp/vj.c"
|
|
|
- "port/esp32/hooks/tcp_isn_default.c"
|
|
|
- "port/esp32/hooks/lwip_default_hooks.c"
|
|
|
- "port/esp32/debug/lwip_debug.c"
|
|
|
- "port/esp32/freertos/sys_arch.c"
|
|
|
- "port/esp32/sockets_ext.c")
|
|
|
+ "port/hooks/tcp_isn_default.c"
|
|
|
+ "port/hooks/lwip_default_hooks.c"
|
|
|
+ "port/debug/lwip_debug.c"
|
|
|
+ "port/sockets_ext.c"
|
|
|
+ "port/freertos/sys_arch.c")
|
|
|
|
|
|
if(CONFIG_LWIP_PPP_SUPPORT)
|
|
|
list(APPEND srcs
|
|
|
@@ -125,10 +133,15 @@ if(CONFIG_LWIP_PPP_SUPPORT)
|
|
|
"lwip/src/netif/ppp/polarssl/sha1.c")
|
|
|
endif()
|
|
|
|
|
|
-if(CONFIG_VFS_SUPPORT_IO)
|
|
|
- list(APPEND srcs "port/esp32/vfs_lwip.c")
|
|
|
-else()
|
|
|
- list(APPEND srcs "port/esp32/no_vfs_syscalls.c")
|
|
|
+if(NOT ${target} STREQUAL "linux")
|
|
|
+ # Support for vfs and linker fragments only for target builds
|
|
|
+ set(priv_requires vfs)
|
|
|
+ set(linker_fragments linker.lf)
|
|
|
+ if(CONFIG_VFS_SUPPORT_IO)
|
|
|
+ list(APPEND srcs "port/${target}/vfs_lwip.c")
|
|
|
+ else()
|
|
|
+ list(APPEND srcs "port/${target}/no_vfs_syscalls.c")
|
|
|
+ endif()
|
|
|
endif()
|
|
|
|
|
|
if(CONFIG_LWIP_ICMP)
|
|
|
@@ -147,9 +160,9 @@ if(CONFIG_LWIP_DHCP_RESTORE_LAST_IP)
|
|
|
endif()
|
|
|
|
|
|
idf_component_register(SRCS "${srcs}"
|
|
|
- INCLUDE_DIRS "${include_dirs}"
|
|
|
- LDFRAGMENTS linker.lf
|
|
|
- PRIV_REQUIRES vfs)
|
|
|
+ INCLUDE_DIRS ${include_dirs}
|
|
|
+ LDFRAGMENTS ${linker_fragments}
|
|
|
+ PRIV_REQUIRES ${priv_requires})
|
|
|
|
|
|
# lots of LWIP source files evaluate macros that check address of stack variables
|
|
|
target_compile_options(${COMPONENT_LIB} PRIVATE -Wno-address)
|
|
|
@@ -188,3 +201,9 @@ if(CONFIG_LWIP_DHCP_RESTORE_LAST_IP)
|
|
|
endif()
|
|
|
|
|
|
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
|
|
|
+
|
|
|
+if(${target} STREQUAL "linux")
|
|
|
+ set(THREADS_PREFER_PTHREAD_FLAG ON)
|
|
|
+ find_package(Threads REQUIRED)
|
|
|
+ target_link_libraries(${COMPONENT_LIB} PRIVATE Threads::Threads)
|
|
|
+endif()
|