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 ${LWIP_DIR}/src/core/net_group.c 56 ${LWIP_DIR}/src/core/lowpower.c 57) 58set(lwipcore4_SRCS 59 ${LWIP_DIR}/src/core/ipv4/autoip.c 60 ${LWIP_DIR}/src/core/ipv4/dhcp.c 61 ${LWIP_DIR}/src/core/ipv4/etharp.c 62 ${LWIP_DIR}/src/core/ipv4/icmp.c 63 ${LWIP_DIR}/src/core/ipv4/igmp.c 64 ${LWIP_DIR}/src/core/ipv4/ip4_frag.c 65 ${LWIP_DIR}/src/core/ipv4/ip4.c 66 ${LWIP_DIR}/src/core/ipv4/ip4_addr.c 67) 68set(lwipcore6_SRCS 69 ${LWIP_DIR}/src/core/ipv6/dhcp6.c 70 ${LWIP_DIR}/src/core/ipv6/ethip6.c 71 ${LWIP_DIR}/src/core/ipv6/icmp6.c 72 ${LWIP_DIR}/src/core/ipv6/inet6.c 73 ${LWIP_DIR}/src/core/ipv6/ip6.c 74 ${LWIP_DIR}/src/core/ipv6/ip6_addr.c 75 ${LWIP_DIR}/src/core/ipv6/ip6_frag.c 76 ${LWIP_DIR}/src/core/ipv6/mld6.c 77 ${LWIP_DIR}/src/core/ipv6/nd6.c 78) 79 80# APIFILES: The files which implement the sequential and socket APIs. 81set(lwipapi_SRCS 82 ${LWIP_DIR}/src/api/api_lib.c 83 ${LWIP_DIR}/src/api/api_msg.c 84 ${LWIP_DIR}/src/api/err.c 85 ${LWIP_DIR}/src/api/if_api.c 86 ${LWIP_DIR}/src/api/netbuf.c 87 ${LWIP_DIR}/src/api/netdb.c 88 ${LWIP_DIR}/src/api/netifapi.c 89 ${LWIP_DIR}/src/api/sockets.c 90 ${LWIP_DIR}/src/api/tcpip.c 91) 92 93# Files implementing various generic network interface functions 94set(lwipnetif_SRCS 95 ${LWIP_DIR}/src/netif/ethernet.c 96 ${LWIP_DIR}/src/netif/bridgeif.c 97 ${LWIP_DIR}/src/netif/bridgeif_fdb.c 98 ${LWIP_DIR}/src/netif/slipif.c 99) 100 101# 6LoWPAN 102set(lwipsixlowpan_SRCS 103 ${LWIP_DIR}/src/netif/lowpan6_common.c 104 ${LWIP_DIR}/src/netif/lowpan6.c 105 ${LWIP_DIR}/src/netif/lowpan6_ble.c 106 ${LWIP_DIR}/src/netif/zepif.c 107) 108 109# PPP 110set(lwipppp_SRCS 111 ${LWIP_DIR}/src/netif/ppp/auth.c 112 ${LWIP_DIR}/src/netif/ppp/ccp.c 113 ${LWIP_DIR}/src/netif/ppp/chap-md5.c 114 ${LWIP_DIR}/src/netif/ppp/chap_ms.c 115 ${LWIP_DIR}/src/netif/ppp/chap-new.c 116 ${LWIP_DIR}/src/netif/ppp/demand.c 117 ${LWIP_DIR}/src/netif/ppp/eap.c 118 ${LWIP_DIR}/src/netif/ppp/ecp.c 119 ${LWIP_DIR}/src/netif/ppp/eui64.c 120 ${LWIP_DIR}/src/netif/ppp/fsm.c 121 ${LWIP_DIR}/src/netif/ppp/ipcp.c 122 ${LWIP_DIR}/src/netif/ppp/ipv6cp.c 123 ${LWIP_DIR}/src/netif/ppp/lcp.c 124 ${LWIP_DIR}/src/netif/ppp/magic.c 125 ${LWIP_DIR}/src/netif/ppp/mppe.c 126 ${LWIP_DIR}/src/netif/ppp/multilink.c 127 ${LWIP_DIR}/src/netif/ppp/ppp.c 128 ${LWIP_DIR}/src/netif/ppp/pppapi.c 129 ${LWIP_DIR}/src/netif/ppp/pppcrypt.c 130 ${LWIP_DIR}/src/netif/ppp/pppoe.c 131 ${LWIP_DIR}/src/netif/ppp/pppol2tp.c 132 ${LWIP_DIR}/src/netif/ppp/pppos.c 133 ${LWIP_DIR}/src/netif/ppp/upap.c 134 ${LWIP_DIR}/src/netif/ppp/utils.c 135 ${LWIP_DIR}/src/netif/ppp/vj.c 136 ${LWIP_DIR}/src/netif/ppp/polarssl/arc4.c 137 ${LWIP_DIR}/src/netif/ppp/polarssl/des.c 138 ${LWIP_DIR}/src/netif/ppp/polarssl/md4.c 139 ${LWIP_DIR}/src/netif/ppp/polarssl/md5.c 140 ${LWIP_DIR}/src/netif/ppp/polarssl/sha1.c 141) 142 143# SNMPv3 agent 144set(lwipsnmp_SRCS 145 ${LWIP_DIR}/src/apps/snmp/snmp_asn1.c 146 ${LWIP_DIR}/src/apps/snmp/snmp_core.c 147 ${LWIP_DIR}/src/apps/snmp/snmp_mib2.c 148 ${LWIP_DIR}/src/apps/snmp/snmp_mib2_icmp.c 149 ${LWIP_DIR}/src/apps/snmp/snmp_mib2_interfaces.c 150 ${LWIP_DIR}/src/apps/snmp/snmp_mib2_ip.c 151 ${LWIP_DIR}/src/apps/snmp/snmp_mib2_snmp.c 152 ${LWIP_DIR}/src/apps/snmp/snmp_mib2_system.c 153 ${LWIP_DIR}/src/apps/snmp/snmp_mib2_tcp.c 154 ${LWIP_DIR}/src/apps/snmp/snmp_mib2_udp.c 155 ${LWIP_DIR}/src/apps/snmp/snmp_snmpv2_framework.c 156 ${LWIP_DIR}/src/apps/snmp/snmp_snmpv2_usm.c 157 ${LWIP_DIR}/src/apps/snmp/snmp_msg.c 158 ${LWIP_DIR}/src/apps/snmp/snmpv3.c 159 ${LWIP_DIR}/src/apps/snmp/snmp_netconn.c 160 ${LWIP_DIR}/src/apps/snmp/snmp_pbuf_stream.c 161 ${LWIP_DIR}/src/apps/snmp/snmp_raw.c 162 ${LWIP_DIR}/src/apps/snmp/snmp_scalar.c 163 ${LWIP_DIR}/src/apps/snmp/snmp_table.c 164 ${LWIP_DIR}/src/apps/snmp/snmp_threadsync.c 165 ${LWIP_DIR}/src/apps/snmp/snmp_traps.c 166) 167 168# HTTP server + client 169set(lwiphttp_SRCS 170 ${LWIP_DIR}/src/apps/http/altcp_proxyconnect.c 171 ${LWIP_DIR}/src/apps/http/fs.c 172 ${LWIP_DIR}/src/apps/http/http_client.c 173 ${LWIP_DIR}/src/apps/http/httpd.c 174) 175 176# MAKEFSDATA HTTP server host utility 177set(lwipmakefsdata_SRCS 178 ${LWIP_DIR}/src/apps/http/makefsdata/makefsdata.c 179) 180 181# IPERF server 182set(lwipiperf_SRCS 183 ${LWIP_DIR}/src/apps/lwiperf/lwiperf.c 184) 185 186# SMTP client 187set(lwipsmtp_SRCS 188 ${LWIP_DIR}/src/apps/smtp/smtp.c 189) 190 191# SNTP client 192set(lwipsntp_SRCS 193 ${LWIP_DIR}/src/apps/sntp/sntp.c 194) 195 196# MDNS responder 197set(lwipmdns_SRCS 198 ${LWIP_DIR}/src/apps/mdns/mdns.c 199) 200 201# NetBIOS name server 202set(lwipnetbios_SRCS 203 ${LWIP_DIR}/src/apps/netbiosns/netbiosns.c 204) 205 206# TFTP server files 207set(lwiptftp_SRCS 208 ${LWIP_DIR}/src/apps/tftp/tftp_server.c 209) 210 211# MQTT client files 212set(lwipmqtt_SRCS 213 ${LWIP_DIR}/src/apps/mqtt/mqtt.c 214) 215 216# ARM MBEDTLS related files of lwIP rep 217set(lwipmbedtls_SRCS 218 ${LWIP_DIR}/src/apps/altcp_tls/altcp_tls_mbedtls.c 219 ${LWIP_DIR}/src/apps/altcp_tls/altcp_tls_mbedtls_mem.c 220 ${LWIP_DIR}/src/apps/snmp/snmpv3_mbedtls.c 221) 222 223# All LWIP files without apps 224set(lwipnoapps_SRCS 225 ${lwipcore_SRCS} 226 ${lwipcore4_SRCS} 227 ${lwipcore6_SRCS} 228 ${lwipapi_SRCS} 229 ${lwipnetif_SRCS} 230 ${lwipsixlowpan_SRCS} 231 ${lwipppp_SRCS} 232) 233 234# LWIPAPPFILES: All LWIP APPs 235set(lwipallapps_SRCS 236 ${lwipsnmp_SRCS} 237 ${lwiphttp_SRCS} 238 ${lwipiperf_SRCS} 239 ${lwipsmtp_SRCS} 240 ${lwipsntp_SRCS} 241 ${lwipmdns_SRCS} 242 ${lwipnetbios_SRCS} 243 ${lwiptftp_SRCS} 244 ${lwipmqtt_SRCS} 245 ${lwipmbedtls_SRCS} 246) 247 248# Generate lwip/init.h (version info) 249configure_file(${LWIP_DIR}/src/include/lwip/init.h.cmake.in ${LWIP_DIR}/src/include/lwip/init.h) 250 251# Documentation 252set(DOXYGEN_DIR ${LWIP_DIR}/doc/doxygen) 253set(DOXYGEN_OUTPUT_DIR output) 254set(DOXYGEN_IN ${LWIP_DIR}/doc/doxygen/lwip.Doxyfile.cmake.in) 255set(DOXYGEN_OUT ${LWIP_DIR}/doc/doxygen/lwip.Doxyfile) 256configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT}) 257 258find_package(Doxygen) 259if (DOXYGEN_FOUND) 260 message("Doxygen build started") 261 262 add_custom_target(lwipdocs 263 COMMAND ${CMAKE_COMMAND} -E remove_directory ${DOXYGEN_DIR}/${DOXYGEN_OUTPUT_DIR}/html 264 COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT} 265 WORKING_DIRECTORY ${DOXYGEN_DIR} 266 COMMENT "Generating API documentation with Doxygen" 267 VERBATIM) 268else (DOXYGEN_FOUND) 269 message("Doxygen needs to be installed to generate the doxygen documentation") 270endif (DOXYGEN_FOUND) 271 272# lwIP libraries 273add_library(lwipcore EXCLUDE_FROM_ALL ${lwipnoapps_SRCS}) 274target_compile_options(lwipcore PRIVATE ${LWIP_COMPILER_FLAGS}) 275target_compile_definitions(lwipcore PRIVATE ${LWIP_DEFINITIONS} ${LWIP_MBEDTLS_DEFINITIONS}) 276target_include_directories(lwipcore PRIVATE ${LWIP_INCLUDE_DIRS} ${LWIP_MBEDTLS_INCLUDE_DIRS}) 277 278add_library(lwipallapps EXCLUDE_FROM_ALL ${lwipallapps_SRCS}) 279target_compile_options(lwipallapps PRIVATE ${LWIP_COMPILER_FLAGS}) 280target_compile_definitions(lwipallapps PRIVATE ${LWIP_DEFINITIONS} ${LWIP_MBEDTLS_DEFINITIONS}) 281target_include_directories(lwipallapps PRIVATE ${LWIP_INCLUDE_DIRS} ${LWIP_MBEDTLS_INCLUDE_DIRS}) 282