Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ find_library(libuci NAMES uci)
find_library(libubox NAMES ubox)
find_library(libubus NAMES ubus)
find_library(libblobmsg_json NAMES blobmsg_json)
find_library(wslay NAMES wslay)
find_path(wslay_include NAMES wslay/wslay.h)
find_package(ZLIB)
find_library(libmd NAMES libmd.a md)
find_library(libffi NAMES ffi)
Expand All @@ -100,6 +102,10 @@ if(libubox)
set(DEFAULT_ULOOP_SUPPORT ON)
endif()

if(wslay AND wslay_include AND libubox)
set(DEFAULT_WEBSOCKET_SUPPORT ON)
endif()

if(ZLIB_FOUND)
set(DEFAULT_ZLIB_SUPPORT ON)
endif()
Expand All @@ -126,6 +132,7 @@ option(STRUCT_SUPPORT "Struct plugin support" ON)
option(ULOOP_SUPPORT "Uloop plugin support" ${DEFAULT_ULOOP_SUPPORT})
option(LOG_SUPPORT "Log plugin support" ON)
option(SOCKET_SUPPORT "Socket plugin support" ON)
option(WEBSOCKET_SUPPORT "WebSocket plugin support" ${DEFAULT_WEBSOCKET_SUPPORT})
option(SERIAL_SUPPORT "Serial port plugin support" ON)
option(ZLIB_SUPPORT "Zlib plugin support" ${DEFAULT_ZLIB_SUPPORT})
option(DIGEST_SUPPORT "Digest plugin support" ${DEFAULT_DIGEST_SUPPORT})
Expand Down Expand Up @@ -421,6 +428,15 @@ if(SOCKET_SUPPORT)
target_link_options(socket_lib PRIVATE ${UCODE_MODULE_LINK_OPTIONS})
endif()

if(WEBSOCKET_SUPPORT)
set(LIBRARIES ${LIBRARIES} websocket_lib)
add_library(websocket_lib MODULE lib/websocket.c)
set_target_properties(websocket_lib PROPERTIES OUTPUT_NAME websocket PREFIX "")
target_include_directories(websocket_lib PRIVATE ${wslay_include})
target_link_options(websocket_lib PRIVATE ${UCODE_MODULE_LINK_OPTIONS})
target_link_libraries(websocket_lib ${wslay} ${libubox})
endif()

if(SERIAL_SUPPORT)
set(LIBRARIES ${LIBRARIES} serial_lib)
add_library(serial_lib MODULE lib/serial.c)
Expand Down
378 changes: 378 additions & 0 deletions WEBSOCKET_PLAN.md

Large diffs are not rendered by default.

Loading