• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_CONTRIB_DIR is defined pointing to the
4# root path of lwIP/contrib 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
11if(NOT ${CMAKE_VERSION} VERSION_LESS "3.10.0")
12    include_guard(GLOBAL)
13endif()
14
15set(lwipcontribportwindows_SRCS
16    ${LWIP_CONTRIB_DIR}/ports/win32/sys_arch.c
17    ${LWIP_CONTRIB_DIR}/ports/win32/sio.c
18    ${LWIP_CONTRIB_DIR}/ports/win32/pcapif.c
19    ${LWIP_CONTRIB_DIR}/ports/win32/pcapif_helper.c
20)
21
22# pcapif needs WinPcap developer package: https://www.winpcap.org/devel.htm
23if(NOT DEFINED WPDPACK_DIR)
24    set(WPDPACK_DIR ${LWIP_DIR}/../WpdPack)
25    message(STATUS "WPDPACK_DIR not set - using default location ${WPDPACK_DIR}")
26endif()
27if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
28    if(CMAKE_SIZEOF_VOID_P EQUAL 8)
29        set(WPDPACK_LIB_DIR ${WPDPACK_DIR}/lib/x64)
30    else()
31        set(WPDPACK_LIB_DIR ${WPDPACK_DIR}/lib)
32    endif()
33    set(WPCAP  ${WPDPACK_LIB_DIR}/wpcap.lib)
34    set(PACKET ${WPDPACK_LIB_DIR}/packet.lib)
35else()
36    find_library(WPCAP  wpcap  HINTS ${WPDPACK_DIR}/lib/x64)
37    find_library(PACKET packet HINTS ${WPDPACK_DIR}/lib/x64)
38endif()
39message(STATUS "WPCAP library: ${WPCAP}")
40message(STATUS "PACKET library: ${PACKET}")
41
42add_library(lwipcontribportwindows EXCLUDE_FROM_ALL ${lwipcontribportwindows_SRCS})
43target_include_directories(lwipcontribportwindows PRIVATE ${LWIP_INCLUDE_DIRS} "${WPDPACK_DIR}/include" ${LWIP_MBEDTLS_INCLUDE_DIRS})
44target_compile_options(lwipcontribportwindows PRIVATE ${LWIP_COMPILER_FLAGS})
45target_compile_definitions(lwipcontribaddons PRIVATE ${LWIP_DEFINITIONS} ${LWIP_MBEDTLS_DEFINITIONS})
46target_link_libraries(lwipcontribportwindows PUBLIC ${WPCAP} ${PACKET} ${LWIP_MBEDTLS_LINK_LIBRARIES})
47