Skip to content

Commit

Permalink
[protocols] Add CoAP support
Browse files Browse the repository at this point in the history
  • Loading branch information
jcelerier committed May 26, 2024
1 parent 8465beb commit b7dcb1b
Show file tree
Hide file tree
Showing 10 changed files with 714 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cmake/OssiaDeps.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ include(deps/unordered_dense)
include(deps/verdigris)
include(deps/websocketpp)

if(OSSIA_PROTOCOL_COAP)
include(deps/coap)
if(NOT TARGET libcoap::coap-3)
set(OSSIA_PROTOCOL_COAP FALSE CACHE INTERNAL "" FORCE)
endif()
endif()

if(OSSIA_PROTOCOL_MQTT5)
include(deps/mqtt)
if(NOT TARGET Async::MQTT5)
Expand Down
22 changes: 22 additions & 0 deletions cmake/deps/coap.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
if(OSSIA_USE_SYSTEM_LIBRARIES)
find_path(LIBCOAP_INCLUDEDIR coap3/libcoap.h)
find_library(LIBCOAP_LIBRARIES coap-3)
add_library(coap-3 IMPORTED SHARED GLOBAL)
add_library(libcoap::coap-3 ALIAS coap-3)
target_include_directories(coap-3 INTERFACE "${LIBCOAP_INCLUDEDIR}")
set_target_properties(coap-3 PROPERTIES IMPORTED_LOCATION "${LIBCOAP_LIBRARIES}")
endif()

if(NOT TARGET libcoap::coap-3)
include(FetchContent)
FetchContent_Declare(
libcoap
GIT_REPOSITORY "https://github.com/obgm/libcoap"
GIT_TAG develop
GIT_PROGRESS true
)

set(ENABLE_DTLS OFF)
FetchContent_MakeAvailable(libcoap)
endif()

Loading

0 comments on commit b7dcb1b

Please sign in to comment.