代码拉取完成,页面将自动刷新
同步操作将从 Dallans/libcoap 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
For Windows builds - see the Windows Section
Obtaining the Libcoap Source
============================
To get the libcoap library source, you need to do either the following
* Obtain the latest distribution package file from
https://github.com/obgm/libcoap/archive/develop.zip
[There is a stable version at
https://github.com/obgm/libcoap/archive/main.zip]
* Change to the directory that you want to install the libcoap sub-directory
into
* Unpack the distribution package file
* Change into the top level directory of the unpackaged files
or alternatively, clone the libcoap git repository from github
* Change to the directory that you want to install the libcoap sub-directory
into.
* Then clone the latest (develop) version of the code:-
git clone https://github.com/obgm/libcoap.git
* Change into the top level directory of the cloned files
* Optionally, change the branch from develop to the stable main branch:-
git checkout main
Building Libcoap Libraries and Examples
=======================================
Follow the appropriate sections below
TinyDTLS Only
=============
It is possible that you may need to execute the following two commands once to
get the TinyDTLS code into your project, so the TinyDTLS library can be used.
git submodule init
git submodule update
General Building with cmake for linux/windows/macos/android (not for LwIP or Contiki - see below)
================
cmake -E remove_directory build
cmake -E make_directory build
cd build
cmake .. -DENABLE_TESTS=ON
cmake --build .
[sudo] cmake --build . -- install
cd ..
Note: to see possible options (TLS lib, doc, tests, examples etc.):
cmake -LH build
Note: For Windows, this is supported by Visual Studio Code with CMake extension
Note: You must use cmake version >=3.10.
Note: you can use cmake's find package after installation: find_package(libcoap-2 REQUIRED),
and target_link_libraries(myTarget PRIVATE libcoap::coap-2)
Note: Shared Library support is not currently available for Windows.
General Building with autoconf (not for LwIP or Contiki - see below)
================
./autogen.sh
./configure
make
sudo make install
./autogen.sh will fail if there is a required package for buildling libcoap
that is missing. Install the missing package and try ./autogen.sh again.
It is possible that you may need to provide some options to ./configure
to customize your installation.
In particular you may need to define which (D)TLS library to use as well as
disable some building of documentation.
General configure instructions can be found in INSTALL, which is built
by ./autogen.sh
./configure --help
gives the specific options available to libcoap.
Some examples are:-
# No DTLS
./configure --enable-tests --disable-documentation --enable-examples --disable-dtls --enable-shared
# With TinyDTLS
./configure --enable-tests --disable-documentation --enable-examples --with-tinydtls --enable-shared
Note: FreeBSD requires gmake instead of make when building TinyDTLS - i.e.
gmake
sudo gmake install
# With OpenSSL
./configure --with-openssl --enable-tests --enable-shared
# With GnuTLS
./configure --with-gnutls --enable-tests --enable-shared
Note: --disable-documentation disables the building of doxygen and man page
files. If you want to only disable one of them, use --disable-doxygen or
--disable-manpages. Doxygen requires the program doxygen and man pages require
the program a2x to build the appropriate files.
If you need to rebuild the libcoap-*.{map,sym} files to update any exposed
function changes, run
make update-map-file
prior to running 'make'.
LwIP
====
./autogen.sh
./configure --disable-tests --disable-documentation --disable-examples --disable-dtls
cd examples/lwip
make
Executable is ./server. See examples/lwip/README for further information
Contiki
=======
./autogen.sh
./configure --disable-tests --disable-documentation --disable-examples --disable-dtls
cd examples/contiki
make
Executable is ./server.minimal-net. See examples/contiki/README for further
information
Windows
=======
Install OpenSSL (minimum version 1.1.0) including the development libraries if
not already installed.
Within Visual Studio, "Clone or check out code" using the repository
https://github.com/obgm/libcoap.git
You may need to update the SDK version of the libcoap Windows Project files to
match that of the SDK version of the Visual Studio you are using. In Solution
Explorer with the view set to libcoap.sln, right click "Solution 'libcoap'"
and then "Retarget solution".
You may need to edit win32\libcoap.props to update the OpenSSLRootDir and
OpenSSLRootDirDbg variables to point to the top level directory where OpenSSL
is installed so that the include, lib etc. directories are correctly set up.
Note: Make sure that you include a trailing \ in the variable definitions.
Alternatively you can build everything in Visual Studio with CMake.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。