Skip to content

Commit b262164

Browse files
committed
fix build with net_lwip_webserver example
1 parent c0ecf8b commit b262164

File tree

3 files changed

+80
-77
lines changed

3 files changed

+80
-77
lines changed

examples/device/CMakeLists.txt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,7 @@ family_add_subdirectory(hid_generic_inout)
2222
family_add_subdirectory(hid_multiple_interface)
2323
family_add_subdirectory(midi_test)
2424
family_add_subdirectory(msc_dual_lun)
25-
26-
# FIXME temp skip net_lwip_webserver for imxrt for now
27-
if (NOT ${FAMILY} STREQUAL "imxrt" AND NOT ${FAMILY} STREQUAL "mcx")
28-
family_add_subdirectory(net_lwip_webserver)
29-
endif()
30-
25+
family_add_subdirectory(net_lwip_webserver)
3126
family_add_subdirectory(uac2_headset)
3227
family_add_subdirectory(usbtmc)
3328
family_add_subdirectory(video_capture)
Lines changed: 77 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,89 @@
11
cmake_minimum_required(VERSION 3.17)
22

3-
set(TOP "../../..")
4-
get_filename_component(TOP "${TOP}" REALPATH)
3+
include(${CMAKE_CURRENT_LIST_DIR}/../../../hw/bsp/family_support.cmake)
54

6-
if (EXISTS ${TOP}/lib/lwip/src)
7-
include(${TOP}/hw/bsp/family_support.cmake)
5+
set(LWIP ${TOP}/lib/lwip)
6+
if (NOT EXISTS ${LWIP}/src)
7+
MESSAGE(WARNING "lib/lwip submodule not found, please run 'python tools/get_deps.py lib/lwip' to fetch it")
8+
return()
9+
endif()
810

9-
# gets PROJECT name for the example (e.g. <BOARD>-<DIR_NAME>)
10-
family_get_project_name(PROJECT ${CMAKE_CURRENT_LIST_DIR})
11+
# gets PROJECT name for the example (e.g. <BOARD>-<DIR_NAME>)
12+
family_get_project_name(PROJECT ${CMAKE_CURRENT_LIST_DIR})
1113

12-
project(${PROJECT} C CXX ASM)
14+
project(${PROJECT} C CXX ASM)
1315

14-
# Checks this example is valid for the family and initializes the project
15-
family_initialize_project(${PROJECT} ${CMAKE_CURRENT_LIST_DIR})
16+
# Checks this example is valid for the family and initializes the project
17+
family_initialize_project(${PROJECT} ${CMAKE_CURRENT_LIST_DIR})
1618

17-
add_executable(${PROJECT})
19+
add_executable(${PROJECT})
1820

19-
# Example source
20-
target_sources(${PROJECT} PUBLIC
21-
${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
22-
${CMAKE_CURRENT_SOURCE_DIR}/src/usb_descriptors.c
23-
)
21+
# Example source
22+
target_sources(${PROJECT} PUBLIC
23+
${CMAKE_CURRENT_LIST_DIR}/src/main.c
24+
${CMAKE_CURRENT_LIST_DIR}/src/usb_descriptors.c
25+
)
2426

25-
# Example include
26-
target_include_directories(${PROJECT} PUBLIC
27-
${CMAKE_CURRENT_SOURCE_DIR}/src
28-
${TOP}/lib/lwip/src/include
29-
${TOP}/lib/lwip/src/include/ipv4
30-
${TOP}/lib/lwip/src/include/lwip/apps
31-
${TOP}/lib/networking
32-
)
27+
# Example include
28+
target_include_directories(${PROJECT} PUBLIC
29+
${CMAKE_CURRENT_LIST_DIR}/src
30+
${LWIP}/src/include
31+
${LWIP}/src/include/ipv4
32+
${LWIP}/src/include/lwip/apps
33+
${TOP}/lib/networking
34+
)
3335

34-
target_sources(${PROJECT} PUBLIC
35-
${TOP}/lib/lwip/src/core/altcp.c
36-
${TOP}/lib/lwip/src/core/altcp_alloc.c
37-
${TOP}/lib/lwip/src/core/altcp_tcp.c
38-
${TOP}/lib/lwip/src/core/def.c
39-
${TOP}/lib/lwip/src/core/dns.c
40-
${TOP}/lib/lwip/src/core/inet_chksum.c
41-
${TOP}/lib/lwip/src/core/init.c
42-
${TOP}/lib/lwip/src/core/ip.c
43-
${TOP}/lib/lwip/src/core/mem.c
44-
${TOP}/lib/lwip/src/core/memp.c
45-
${TOP}/lib/lwip/src/core/netif.c
46-
${TOP}/lib/lwip/src/core/pbuf.c
47-
${TOP}/lib/lwip/src/core/raw.c
48-
${TOP}/lib/lwip/src/core/stats.c
49-
${TOP}/lib/lwip/src/core/sys.c
50-
${TOP}/lib/lwip/src/core/tcp.c
51-
${TOP}/lib/lwip/src/core/tcp_in.c
52-
${TOP}/lib/lwip/src/core/tcp_out.c
53-
${TOP}/lib/lwip/src/core/timeouts.c
54-
${TOP}/lib/lwip/src/core/udp.c
55-
${TOP}/lib/lwip/src/core/ipv4/autoip.c
56-
${TOP}/lib/lwip/src/core/ipv4/dhcp.c
57-
${TOP}/lib/lwip/src/core/ipv4/etharp.c
58-
${TOP}/lib/lwip/src/core/ipv4/icmp.c
59-
${TOP}/lib/lwip/src/core/ipv4/igmp.c
60-
${TOP}/lib/lwip/src/core/ipv4/ip4.c
61-
${TOP}/lib/lwip/src/core/ipv4/ip4_addr.c
62-
${TOP}/lib/lwip/src/core/ipv4/ip4_frag.c
63-
${TOP}/lib/lwip/src/netif/ethernet.c
64-
${TOP}/lib/lwip/src/netif/slipif.c
65-
${TOP}/lib/lwip/src/apps/http/httpd.c
66-
${TOP}/lib/lwip/src/apps/http/fs.c
67-
${TOP}/lib/networking/dhserver.c
68-
${TOP}/lib/networking/dnserver.c
69-
${TOP}/lib/networking/rndis_reports.c
70-
)
36+
# lib/networking sources
37+
target_sources(${PROJECT} PUBLIC
38+
${TOP}/lib/networking/dhserver.c
39+
${TOP}/lib/networking/dnserver.c
40+
${TOP}/lib/networking/rndis_reports.c
41+
)
7142

72-
# due to warnings from other net source, we need to prevent error from some of the warnings options
73-
target_compile_options(${PROJECT} PUBLIC
74-
-Wno-error=null-dereference
75-
-Wno-error=conversion
76-
-Wno-error=sign-conversion
77-
-Wno-error=sign-compare
78-
)
43+
# lwip sources
44+
target_sources(${PROJECT} PUBLIC
45+
${LWIP}/src/core/altcp.c
46+
${LWIP}/src/core/altcp_alloc.c
47+
${LWIP}/src/core/altcp_tcp.c
48+
${LWIP}/src/core/def.c
49+
${LWIP}/src/core/dns.c
50+
${LWIP}/src/core/inet_chksum.c
51+
${LWIP}/src/core/init.c
52+
${LWIP}/src/core/ip.c
53+
${LWIP}/src/core/mem.c
54+
${LWIP}/src/core/memp.c
55+
${LWIP}/src/core/netif.c
56+
${LWIP}/src/core/pbuf.c
57+
${LWIP}/src/core/raw.c
58+
${LWIP}/src/core/stats.c
59+
${LWIP}/src/core/sys.c
60+
${LWIP}/src/core/tcp.c
61+
${LWIP}/src/core/tcp_in.c
62+
${LWIP}/src/core/tcp_out.c
63+
${LWIP}/src/core/timeouts.c
64+
${LWIP}/src/core/udp.c
65+
${LWIP}/src/core/ipv4/autoip.c
66+
${LWIP}/src/core/ipv4/dhcp.c
67+
${LWIP}/src/core/ipv4/etharp.c
68+
${LWIP}/src/core/ipv4/icmp.c
69+
${LWIP}/src/core/ipv4/igmp.c
70+
${LWIP}/src/core/ipv4/ip4.c
71+
${LWIP}/src/core/ipv4/ip4_addr.c
72+
${LWIP}/src/core/ipv4/ip4_frag.c
73+
${LWIP}/src/netif/ethernet.c
74+
${LWIP}/src/netif/slipif.c
75+
${LWIP}/src/apps/http/httpd.c
76+
${LWIP}/src/apps/http/fs.c
77+
)
7978

80-
# Configure compilation flags and libraries for the example... see the corresponding function
81-
# in hw/bsp/FAMILY/family.cmake for details.
82-
family_configure_device_example(${PROJECT})
83-
endif()
79+
# due to warnings from other net source, we need to prevent error from some of the warnings options
80+
target_compile_options(${PROJECT} PUBLIC
81+
-Wno-error=null-dereference
82+
-Wno-error=conversion
83+
-Wno-error=sign-conversion
84+
-Wno-error=sign-compare
85+
)
86+
87+
# Configure compilation flags and libraries for the example... see the corresponding function
88+
# in hw/bsp/FAMILY/family.cmake for details.
89+
family_configure_device_example(${PROJECT})

src/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ function(add_tinyusb TARGET)
3434
)
3535
target_include_directories(${TARGET} PUBLIC
3636
${CMAKE_CURRENT_FUNCTION_LIST_DIR}
37+
# TODO for net driver, should be removed/changed
38+
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../lib/networking
3739
)
3840
# enable all possible warnings
3941
target_compile_options(${TARGET} PUBLIC

0 commit comments

Comments
 (0)