220 lines
7.4 KiB
HTML
220 lines
7.4 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
|
<meta name="generator" content="Doxygen 1.8.20"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
<title>lwIP: CMake build system</title>
|
|
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="jquery.js"></script>
|
|
<script type="text/javascript" src="dynsections.js"></script>
|
|
<link href="navtree.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="resize.js"></script>
|
|
<script type="text/javascript" src="navtreedata.js"></script>
|
|
<script type="text/javascript" src="navtree.js"></script>
|
|
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="search/searchdata.js"></script>
|
|
<script type="text/javascript" src="search/search.js"></script>
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
|
</head>
|
|
<body>
|
|
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
|
<div id="titlearea">
|
|
<table cellspacing="0" cellpadding="0">
|
|
<tbody>
|
|
<tr style="height: 56px;">
|
|
<td id="projectalign" style="padding-left: 0.5em;">
|
|
<div id="projectname">lwIP
|
|
 <span id="projectnumber">2.2.1</span>
|
|
</div>
|
|
<div id="projectbrief">Lightweight IP stack</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- end header part -->
|
|
<!-- Generated by Doxygen 1.8.20 -->
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
|
var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
|
/* @license-end */
|
|
</script>
|
|
<script type="text/javascript" src="menudata.js"></script>
|
|
<script type="text/javascript" src="menu.js"></script>
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
|
$(function() {
|
|
initMenu('',true,false,'search.php','Search');
|
|
$(document).ready(function() { init_search(); });
|
|
});
|
|
/* @license-end */</script>
|
|
<div id="main-nav"></div>
|
|
</div><!-- top -->
|
|
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
|
<div id="nav-tree">
|
|
<div id="nav-tree-contents">
|
|
<div id="nav-sync" class="sync"></div>
|
|
</div>
|
|
</div>
|
|
<div id="splitbar" style="-moz-user-select:none;"
|
|
class="ui-resizable-handle">
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
|
$(document).ready(function(){initNavTree('cmake.html',''); initResizable(); });
|
|
/* @license-end */
|
|
</script>
|
|
<div id="doc-content">
|
|
<!-- window showing the filter options -->
|
|
<div id="MSearchSelectWindow"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
|
</div>
|
|
|
|
<!-- iframe showing the search results (closed by default) -->
|
|
<div id="MSearchResultsWindow">
|
|
<iframe src="javascript:void(0)" frameborder="0"
|
|
name="MSearchResults" id="MSearchResults">
|
|
</iframe>
|
|
</div>
|
|
|
|
<div class="PageDoc"><div class="header">
|
|
<div class="headertitle">
|
|
<div class="title">CMake build system </div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
<div class="textblock"><pre class="fragment">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.
|
|
</pre> </div></div><!-- contents -->
|
|
</div><!-- PageDoc -->
|
|
</div><!-- doc-content -->
|
|
<!-- start footer part -->
|
|
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
|
<ul>
|
|
<li class="footer">Generated by <a href="http://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.8.20 </li>
|
|
</ul>
|
|
</div>
|
|
</body>
|
|
</html>
|