1# This file is indended to be included in end-user CMakeLists.txt 2# include(/path/to/Filelists.cmake) 3# It assumes the variable LWIP_DIR is defined pointing to the 4# root path of lwIP sources. 5# 6# This file is NOT designed (on purpose) to be used as cmake 7# subdir via add_subdirectory() 8# The intention is to provide greater flexibility to users to 9# create their own targets using the *_SRCS variables. 10 11set(LWIP_VERSION_MAJOR "2") 12set(LWIP_VERSION_MINOR "1") 13set(LWIP_VERSION_REVISION "3") 14# LWIP_VERSION_RC is set to LWIP_RC_RELEASE for official releases 15# LWIP_VERSION_RC is set to LWIP_RC_DEVELOPMENT for Git versions 16# Numbers 1..31 are reserved for release candidates 17set(LWIP_VERSION_RC "LWIP_RC_RELEASE") 18 19if ("${LWIP_VERSION_RC}" STREQUAL "LWIP_RC_RELEASE") 20 set(LWIP_VERSION_STRING 21 "${LWIP_VERSION_MAJOR}.${LWIP_VERSION_MINOR}.${LWIP_VERSION_REVISION}" 22 ) 23elseif ("${LWIP_VERSION_RC}" STREQUAL "LWIP_RC_DEVELOPMENT") 24 set(LWIP_VERSION_STRING 25 "${LWIP_VERSION_MAJOR}.${LWIP_VERSION_MINOR}.${LWIP_VERSION_REVISION}.dev" 26 ) 27else ("${LWIP_VERSION_RC}" STREQUAL "LWIP_RC_RELEASE") 28 set(LWIP_VERSION_STRING 29 "${LWIP_VERSION_MAJOR}.${LWIP_VERSION_MINOR}.${LWIP_VERSION_REVISION}.rc${LWIP_VERSION_RC}" 30 ) 31endif ("${LWIP_VERSION_RC}" STREQUAL "LWIP_RC_RELEASE") 32 33# The minimum set of files needed for lwIP. 34set(lwipcore_SRCS 35 ${LWIP_DIR}/src/core/init.c 36 ${LWIP_DIR}/src/core/def.c 37 ${LWIP_DIR}/src/core/dns.c 38 ${LWIP_DIR}/src/core/inet_chksum.c 39 ${LWIP_DIR}/src/core/ip.c 40 ${LWIP_DIR}/src/core/mem.c 41 ${LWIP_DIR}/src/core/memp.c 42 ${LWIP_DIR}/src/core/netif.c 43 ${LWIP_DIR}/src/core/pbuf.c 44 ${LWIP_DIR}/src/core/raw.c 45 ${LWIP_DIR}/src/core/stats.c 46 ${LWIP_DIR}/src/core/sys.c 47 ${LWIP_DIR}/src/core/altcp.c 48 ${LWIP_DIR}/src/core/altcp_alloc.c 49 ${LWIP_DIR}/src/core/altcp_tcp.c 50 ${LWIP_DIR}/src/core/tcp.c 51 ${LWIP_DIR}/src/core/tcp_in.c 52 ${LWIP_DIR}/src/core/tcp_out.c 53 ${LWIP_DIR}/src/core/timeouts.c 54 ${LWIP_DIR}/src/core/udp.c 55) 56set(lwipcore4_SRCS 57 ${LWIP_DIR}/src/core/ipv4/autoip.c 58 ${LWIP_DIR}/src/core/ipv4/dhcp.c 59 ${LWIP_DIR}/src/core/ipv4/etharp.c 60 ${LWIP_DIR}/src/core/ipv4/icmp.c 61 ${LWIP_DIR}/src/core/ipv4/igmp.c 62 ${LWIP_DIR}/src/core/ipv4/ip4_frag.c 63 ${LWIP_DIR}/src/core/ipv4/ip4.c 64 ${LWIP_DIR}/src/core/ipv4/ip4_addr.c 65) 66set(lwipcore6_SRCS 67 ${LWIP_DIR}/src/core/ipv6/dhcp6.c 68 ${LWIP_DIR}/src/core/ipv6/ethip6.c 69 ${LWIP_DIR}/src/core/ipv6/icmp6.c 70 ${LWIP_DIR}/src/core/ipv6/inet6.c 71 ${LWIP_DIR}/src/core/ipv6/ip6.c 72 ${LWIP_DIR}/src/core/ipv6/ip6_addr.c 73 ${LWIP_DIR}/src/core/ipv6/ip6_frag.c 74 ${LWIP_DIR}/src/core/ipv6/mld6.c 75 ${LWIP_DIR}/src/core/ipv6/nd6.c 76) 77 78# APIFILES: The files which implement the sequential and socket APIs. 79set(lwipapi_SRCS 80 ${LWIP_DIR}/src/api/api_lib.c 81 ${LWIP_DIR}/src/api/api_msg.c 82 ${LWIP_DIR}/src/api/err.c 83 ${LWIP_DIR}/src/api/if_api.c 84 ${LWIP_DIR}/src/api/netbuf.c 85 ${LWIP_DIR}/src/api/netdb.c 86 ${LWIP_DIR}/src/api/netifapi.c 87 ${LWIP_DIR}/src/api/sockets.c 88 ${LWIP_DIR}/src/api/tcpip.c 89) 90 91# Files implementing various generic network interface functions 92set(lwipnetif_SRCS 93 ${LWIP_DIR}/src/netif/ethernet.c 94 ${LWIP_DIR}/src/netif/bridgeif.c 95 ${LWIP_DIR}/src/netif/bridgeif_fdb.c 96 ${LWIP_DIR}/src/netif/slipif.c 97) 98 99# 6LoWPAN 100set(lwipsixlowpan_SRCS 101 ${LWIP_DIR}/src/netif/lowpan6_common.c 102 ${LWIP_DIR}/src/netif/lowpan6.c 103 ${LWIP_DIR}/src/netif/lowpan6_ble.c 104 ${LWIP_DIR}/src/netif/zepif.c 105) 106 107# PPP 108set(lwipppp_SRCS 109 ${LWIP_DIR}/src/netif/ppp/auth.c 110 ${LWIP_DIR}/src/netif/ppp/ccp.c 111 ${LWIP_DIR}/src/netif/ppp/chap-md5.c 112 ${LWIP_DIR}/src/netif/ppp/chap_ms.c 113 ${LWIP_DIR}/src/netif/ppp/chap-new.c 114 ${LWIP_DIR}/src/netif/ppp/demand.c 115 ${LWIP_DIR}/src/netif/ppp/eap.c 116 ${LWIP_DIR}/src/netif/ppp/ecp.c 117 ${LWIP_DIR}/src/netif/ppp/eui64.c 118 ${LWIP_DIR}/src/netif/ppp/fsm.c 119 ${LWIP_DIR}/src/netif/ppp/ipcp.c 120 ${LWIP_DIR}/src/netif/ppp/ipv6cp.c 121 ${LWIP_DIR}/src/netif/ppp/lcp.c 122 ${LWIP_DIR}/src/netif/ppp/magic.c 123 ${LWIP_DIR}/src/netif/ppp/mppe.c 124 ${LWIP_DIR}/src/netif/ppp/multilink.c 125 ${LWIP_DIR}/src/netif/ppp/ppp.c 126 ${LWIP_DIR}/src/netif/ppp/pppapi.c 127 ${LWIP_DIR}/src/netif/ppp/pppcrypt.c 128 ${LWIP_DIR}/src/netif/ppp/pppoe.c 129 ${LWIP_DIR}/src/netif/ppp/pppol2tp.c 130 ${LWIP_DIR}/src/netif/ppp/pppos.c 131 ${LWIP_DIR}/src/netif/ppp/upap.c 132 ${LWIP_DIR}/src/netif/ppp/utils.c 133 ${LWIP_DIR}/src/netif/ppp/vj.c 134 ${LWIP_DIR}/src/netif/ppp/polarssl/arc4.c 135 ${LWIP_DIR}/src/netif/ppp/polarssl/des.c 136 ${LWIP_DIR}/src/netif/ppp/polarssl/md4.c 137 ${LWIP_DIR}/src/netif/ppp/polarssl/md5.c 138 ${LWIP_DIR}/src/netif/ppp/polarssl/sha1.c 139) 140 141# SNMPv3 agent 142set(lwipsnmp_SRCS 143 ${LWIP_DIR}/src/apps/snmp/snmp_asn1.c 144 ${LWIP_DIR}/src/apps/snmp/snmp_core.c 145 ${LWIP_DIR}/src/apps/snmp/snmp_mib2.c 146 ${LWIP_DIR}/src/apps/snmp/snmp_mib2_icmp.c 147 ${LWIP_DIR}/src/apps/snmp/snmp_mib2_interfaces.c 148 ${LWIP_DIR}/src/apps/snmp/snmp_mib2_ip.c 149 ${LWIP_DIR}/src/apps/snmp/snmp_mib2_snmp.c 150 ${LWIP_DIR}/src/apps/snmp/snmp_mib2_system.c 151 ${LWIP_DIR}/src/apps/snmp/snmp_mib2_tcp.c 152 ${LWIP_DIR}/src/apps/snmp/snmp_mib2_udp.c 153 ${LWIP_DIR}/src/apps/snmp/snmp_snmpv2_framework.c 154 ${LWIP_DIR}/src/apps/snmp/snmp_snmpv2_usm.c 155 ${LWIP_DIR}/src/apps/snmp/snmp_msg.c 156 ${LWIP_DIR}/src/apps/snmp/snmpv3.c 157 ${LWIP_DIR}/src/apps/snmp/snmp_netconn.c 158 ${LWIP_DIR}/src/apps/snmp/snmp_pbuf_stream.c 159 ${LWIP_DIR}/src/apps/snmp/snmp_raw.c 160 ${LWIP_DIR}/src/apps/snmp/snmp_scalar.c 161 ${LWIP_DIR}/src/apps/snmp/snmp_table.c 162 ${LWIP_DIR}/src/apps/snmp/snmp_threadsync.c 163 ${LWIP_DIR}/src/apps/snmp/snmp_traps.c 164) 165 166# HTTP server + client 167set(lwiphttp_SRCS 168 ${LWIP_DIR}/src/apps/http/altcp_proxyconnect.c 169 ${LWIP_DIR}/src/apps/http/fs.c 170 ${LWIP_DIR}/src/apps/http/http_client.c 171 ${LWIP_DIR}/src/apps/http/httpd.c 172) 173 174# MAKEFSDATA HTTP server host utility 175set(lwipmakefsdata_SRCS 176 ${LWIP_DIR}/src/apps/http/makefsdata/makefsdata.c 177) 178 179# IPERF server 180set(lwipiperf_SRCS 181 ${LWIP_DIR}/src/apps/lwiperf/lwiperf.c 182) 183 184# SMTP client 185set(lwipsmtp_SRCS 186 ${LWIP_DIR}/src/apps/smtp/smtp.c 187) 188 189# SNTP client 190set(lwipsntp_SRCS 191 ${LWIP_DIR}/src/apps/sntp/sntp.c 192) 193 194# MDNS responder 195set(lwipmdns_SRCS 196 ${LWIP_DIR}/src/apps/mdns/mdns.c 197) 198 199# NetBIOS name server 200set(lwipnetbios_SRCS 201 ${LWIP_DIR}/src/apps/netbiosns/netbiosns.c 202) 203 204# TFTP server files 205set(lwiptftp_SRCS 206 ${LWIP_DIR}/src/apps/tftp/tftp_server.c 207) 208 209# MQTT client files 210set(lwipmqtt_SRCS 211 ${LWIP_DIR}/src/apps/mqtt/mqtt.c 212) 213 214# ARM MBEDTLS related files of lwIP rep 215set(lwipmbedtls_SRCS 216 ${LWIP_DIR}/src/apps/altcp_tls/altcp_tls_mbedtls.c 217 ${LWIP_DIR}/src/apps/altcp_tls/altcp_tls_mbedtls_mem.c 218 ${LWIP_DIR}/src/apps/snmp/snmpv3_mbedtls.c 219) 220 221# All LWIP files without apps 222set(lwipnoapps_SRCS 223 ${lwipcore_SRCS} 224 ${lwipcore4_SRCS} 225 ${lwipcore6_SRCS} 226 ${lwipapi_SRCS} 227 ${lwipnetif_SRCS} 228 ${lwipsixlowpan_SRCS} 229 ${lwipppp_SRCS} 230) 231 232# LWIPAPPFILES: All LWIP APPs 233set(lwipallapps_SRCS 234 ${lwipsnmp_SRCS} 235 ${lwiphttp_SRCS} 236 ${lwipiperf_SRCS} 237 ${lwipsmtp_SRCS} 238 ${lwipsntp_SRCS} 239 ${lwipmdns_SRCS} 240 ${lwipnetbios_SRCS} 241 ${lwiptftp_SRCS} 242 ${lwipmqtt_SRCS} 243 ${lwipmbedtls_SRCS} 244) 245 246# Generate lwip/init.h (version info) 247configure_file(${LWIP_DIR}/src/include/lwip/init.h.cmake.in ${LWIP_DIR}/src/include/lwip/init.h) 248 249# Documentation 250set(DOXYGEN_DIR ${LWIP_DIR}/doc/doxygen) 251set(DOXYGEN_OUTPUT_DIR output) 252set(DOXYGEN_IN ${LWIP_DIR}/doc/doxygen/lwip.Doxyfile.cmake.in) 253set(DOXYGEN_OUT ${LWIP_DIR}/doc/doxygen/lwip.Doxyfile) 254configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT}) 255 256find_package(Doxygen) 257if (DOXYGEN_FOUND) 258 message("Doxygen build started") 259 260 add_custom_target(lwipdocs 261 COMMAND ${CMAKE_COMMAND} -E remove_directory ${DOXYGEN_DIR}/${DOXYGEN_OUTPUT_DIR}/html 262 COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT} 263 WORKING_DIRECTORY ${DOXYGEN_DIR} 264 COMMENT "Generating API documentation with Doxygen" 265 VERBATIM) 266else (DOXYGEN_FOUND) 267 message("Doxygen needs to be installed to generate the doxygen documentation") 268endif (DOXYGEN_FOUND) 269 270# lwIP libraries 271add_library(lwipcore EXCLUDE_FROM_ALL ${lwipnoapps_SRCS}) 272target_compile_options(lwipcore PRIVATE ${LWIP_COMPILER_FLAGS}) 273target_compile_definitions(lwipcore PRIVATE ${LWIP_DEFINITIONS} ${LWIP_MBEDTLS_DEFINITIONS}) 274target_include_directories(lwipcore PRIVATE ${LWIP_INCLUDE_DIRS} ${LWIP_MBEDTLS_INCLUDE_DIRS}) 275 276add_library(lwipallapps EXCLUDE_FROM_ALL ${lwipallapps_SRCS}) 277target_compile_options(lwipallapps PRIVATE ${LWIP_COMPILER_FLAGS}) 278target_compile_definitions(lwipallapps PRIVATE ${LWIP_DEFINITIONS} ${LWIP_MBEDTLS_DEFINITIONS}) 279target_include_directories(lwipallapps PRIVATE ${LWIP_INCLUDE_DIRS} ${LWIP_MBEDTLS_INCLUDE_DIRS}) 280