Skip to content

Commit

Permalink
Merge commit '5c036709bbc5b598233563cd1be8225fd4b20d97' as 'lib/lwip/…
Browse files Browse the repository at this point in the history
…lwip'
  • Loading branch information
trini committed Jun 6, 2024
2 parents 1fd58ec + 5c03670 commit 729fdb9
Show file tree
Hide file tree
Showing 726 changed files with 221,755 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/lwip/lwip/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# These files are text and should be normalized
*.txt text
*.c text
*.h text

# For git archive
.gitignore export-ignore
.gitattributes export-ignore
.github export-ignore
.vscode export-ignore
43 changes: 43 additions & 0 deletions lib/lwip/lwip/.github/workflows/ci-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: CI

on:
push:
branches: [master]

jobs:
build:
strategy:
matrix:
compiler: [gcc, clang]
env:
CC: ${{ matrix.compiler }}
LSAN_OPTIONS: verbosity=1:log_threads=1
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Install deps
run: sudo apt-get install check ninja-build doxygen

- name: Copy lwipcfg.h for example app
run: cp contrib/examples/example_app/lwipcfg.h.ci contrib/examples/example_app/lwipcfg.h

- name: Build unit tests with make
run: make -C contrib/ports/unix/check
- name: Run unit tests
run: make -C contrib/ports/unix/check check

- name: Run cmake
run: mkdir build && cd build && cmake .. -G Ninja
- name: Build with cmake
run: cd build && cmake --build .
- name: Build docs with cmake
run: cd build && cmake --build . --target lwipdocs

- name: Validate combinations of options
run: cd contrib/ports/unix/example_app && ./iteropts.sh

- name: Build the default example app
run: |
cp contrib/examples/example_app/lwipcfg.h.example contrib/examples/example_app/lwipcfg.h
make -C contrib/ports/unix/example_app TESTFLAGS="-Wno-documentation" -j 4
60 changes: 60 additions & 0 deletions lib/lwip/lwip/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
*.o
*.so
*.a
*.exe
*lwip_unittests.xml
*.suo
*.log
.depend*

/.vscode/ipch

/doc/doxygen/output/html

/test/fuzz/output
/test/fuzz/lwip_fuzz
/test/fuzz/lwip_fuzz2
/test/fuzz/lwip_fuzz3
/test/fuzz/.depend

/build

/contrib/examples/example_app/lwipcfg.h
/contrib/examples/example_app/lwipopts_test.h

/contrib/ports/unix/example_app/build
/contrib/ports/unix/example_app/example_app
/contrib/ports/unix/example_app/makefsdata

/contrib/ports/unix/check/build
/contrib/ports/unix/lib/build
/contrib/ports/unix/check/lwip_unittests

/contrib/ports/win32/example_app/build
/contrib/ports/win32/lwipcfg_msvc.h

/contrib/ports/win32/msvc/Debug
/contrib/ports/win32/msvc/Debug unittests
/contrib/ports/win32/msvc/Release
/contrib/ports/win32/msvc/Release unittests
/contrib/ports/win32/msvc/*.user
/contrib/ports/win32/msvc/*.ncb
/contrib/ports/win32/msvc/*.cache
/contrib/ports/win32/msvc/*.suo
/contrib/ports/win32/msvc/ipch
/contrib/ports/win32/msvc/*.opensdf
/contrib/ports/win32/msvc/*.sdf
/contrib/ports/win32/mingw/*.map
/contrib/ports/win32/mingw/cov-int
/contrib/ports/win32/msvc/.vs
/contrib/apps/LwipMibCompiler/.vs
/contrib/apps/LwipMibCompiler/CCodeGeneration/bin
/contrib/apps/LwipMibCompiler/CCodeGeneration/obj
/contrib/apps/LwipMibCompiler/LwipMibCompiler/bin
/contrib/apps/LwipMibCompiler/LwipMibCompiler/obj
/contrib/apps/LwipMibCompiler/LwipSnmpCodeGeneration/bin
/contrib/apps/LwipMibCompiler/LwipSnmpCodeGeneration/obj
/contrib/apps/LwipMibCompiler/MibViewer/bin
/contrib/apps/LwipMibCompiler/MibViewer/obj
/contrib/apps/LwipMibCompiler/SharpSnmpLib/bin
/contrib/apps/LwipMibCompiler/SharpSnmpLib/obj
28 changes: 28 additions & 0 deletions lib/lwip/lwip/.vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/src/include",
"${workspaceFolder}/contrib",
"${workspaceFolder}/contrib/examples/example_app",
"${workspaceFolder}/contrib/ports/unix/port/include",
"${workspaceFolder}/contrib/ports/unix/example_app"
],
"defines": [],
"intelliSenseMode": "gcc-x64",
"browse": {
"path": [
"${workspaceFolder}/**"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
},
"compilerPath": "/usr/bin/gcc",
"cStandard": "c11",
"cppStandard": "c++17",
"configurationProvider": "vector-of-bool.cmake-tools"
}
],
"version": 4
}
62 changes: 62 additions & 0 deletions lib/lwip/lwip/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch example_app",
"type": "cppdbg",
"request": "launch",
"args": [],
"stopAtEntry": true,
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"preLaunchTask": "Build example_app",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"linux": {
"cwd": "${workspaceFolder}/build/contrib/ports/unix/example_app",
"program": "${workspaceFolder}/build/contrib/ports/unix/example_app/example_app",
},
"windows": {
"cwd": "${workspaceFolder}/build/contrib/ports/win32/example_app",
"program": "${workspaceFolder}/build/contrib/ports/win32/example_app/example_app",
"miDebuggerPath": "gdb.exe",
}
},
{
"name": "(gdb) Launch unit tests",
"type": "cppdbg",
"request": "launch",
"args": [],
"stopAtEntry": true,
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"preLaunchTask": "Build unit tests",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"linux": {
"cwd": "${workspaceFolder}/contrib/ports/unix/check/build",
"program": "${workspaceFolder}/contrib/ports/unix/check/build/lwip_unittests",
},
"windows": {
"cwd": "${workspaceFolder}/contrib/ports/win32/check/build",
"program": "${workspaceFolder}/contrib/ports/win32/check/build/lwip_unittests",
"miDebuggerPath": "gdb.exe",
}
}
]
}
10 changes: 10 additions & 0 deletions lib/lwip/lwip/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"editor.tabSize": 2,
"editor.insertSpaces": true,
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
"files.trimTrailingWhitespace": true,
"files.associations": {
"*.h": "c"
}
}
54 changes: 54 additions & 0 deletions lib/lwip/lwip/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Build example_app",
"type": "shell",
"options": {
"cwd": "${workspaceFolder}/build"
},
"problemMatcher": "$gcc",
"group": {
"kind": "build",
"isDefault": true
},
"command": "cmake --build ."
},
{
"label": "Build unit tests",
"type": "shell",
"problemMatcher": "$gcc",
"group": "build",
"linux": {
"options": {
"cwd": "${workspaceFolder}/contrib/ports/unix/check/build"
},
},
"windows": {
"options": {
"cwd": "${workspaceFolder}/contrib/ports/win32/check/build"
},
},
"command": "cmake --build ."
},
{
"label": "Configure example_app",
"type": "shell",
"problemMatcher": "$gcc",
"group": "build",
"command": "cd ${workspaceFolder}; mkdir build; cd build; cmake .."
},
{
"label": "Generate documentation",
"type": "shell",
"problemMatcher": [],
"group": "none",
"options": {
"cwd": "${workspaceFolder}/build"
},
"command": "cmake --build . --target lwipdocs"
}
]
}
119 changes: 119 additions & 0 deletions lib/lwip/lwip/BUILDING
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
Building lwIP
=============

lwIP uses a CMake based build system.

The CMake files in this project are designed to
be included into your own CMake files. They are
mainly variable definitions containing a list of
source files and predefined static libraries to
be linked against application code.

1) lwIP sources:
src/Filelists.cmake provides file lists containing
the lwIP core library.
The file also contains two static libraries, lwipcore
and lwipallapps, where you can link your app against.
This is the file that is useful to all lwIP users.

2) Example applications:
contrib/Filelists.cmake provides several file lists
containing the example applications.
The file also contains several static libraries
for these example apps.
This file is only useful for you, if you can use one
of the examples in your application, which is normally
not the case.

3) OS/platform port:
Usually the OS port needs to be provided by the user.
If a port to Linux, Windows or MacOS is useful for
you, you can use
contrib/ports/{win32, unix}/Filelists.cmake
that contains file lists and libraries for
these operating systems.

VARIABLES
=========
In all cases, you need to provide two variables.

"LWIP_DIR" pointing to the lwIP directory
Example:
set(LWIP_DIR ${CMAKE_CURRENT_SOURCE_DIR}/externals/lwip)

"LWIP_INCLUDE_DIRS" that contains the include base paths
- for lwIP itself (${LWIP_DIR}/src/include)
- for lwIP contrib if you use it (${LWIP_DIR}/contrib)
- to a directory containing an OS port
- to a directory containing lwipopts.h

Example:
set (LWIP_INCLUDE_DIRS
"${LWIP_DIR}/src/include"
"${LWIP_DIR}/contrib"
"${LWIP_DIR}/contrib/ports/unix/port/include"
"${LWIP_DIR}/contrib/examples/example_app"
)

Putting it all together
=======================
To get a working application, your CMake system
needs to provide the variables described above, e.g.
set (LWIP_DIR <path to lwip sources>)
set (LWIP_INCLUDE_DIRS
"${LWIP_DIR}/src/include"
"${LWIP_DIR}/contrib"
"<path to my port>/include"
"<path to lwipopts.h>"
)

You may add some defines:
set (LWIP_DEFINITIONS LWIP_DEBUG=1)

Then include the filelists you need:
include(${LWIP_DIR}/src/Filelists.cmake)
include(${LWIP_DIR}/contrib/Filelists.cmake)

Then, declare you executable:
add_executable(my_app <my source files> <my lwip port files>)

Add lwIP include dirs to your app:
target_include_directories(my_app PRIVATE ${LWIP_INCLUDE_DIRS})

Link your app against the lwIP libs from the filelists you need:
target_link_libraries(my_app lwipcontribapps lwipallapps lwipcore)

Working example
===============
Working build examples can be found in the
contrib/ports/{win32, unix}/example_app
subdirectory.
To use them, create a build directory and call cmake with
the lwIP root dir:

- mkdir build
- cd build
- cmake ..
- cmake --build .

The CMakeLists.txt will autoselect the correct port
for your system (supported: Linux, Windows, Darwin).

To configure the example app to your needs, you need to copy the file
contrib/examples/example_app/lwipcfg.h.example
to
contrib/examples/example_app/lwipcfg.h
and edit to your needs.

Makefile based build system
===========================
lwIP also maintains file lists for Makefile-based
build systems. Look for Filelists.mk files
in the source tree. We try to maintain them,
but lwIP's mainly focused build system is CMake.

MS Visual Studio
================
lwIP also provides basic support for MSVS in the win32 port
folder under 'msvc'. We try to maintain these files,
but lwIP's mainly focused build system is CMake.
Loading

0 comments on commit 729fdb9

Please sign in to comment.