lejp bring into lws
lejp is already in lws as part of lwsws. However it's too generally useful to just put directly in lwsws, it will lead to multiple copies of the source in differet subprojects. This moves it directly into lws, lwsws now gets it from there. Like lwsws, by default at cmake it is disabled. Selecting LWS_WITH_LWSWS now selects LWS_WITH_LEJP and you can set that at cmake individually as well. Signed-off-by: Andy Green <andy@warmcat.com>
This commit is contained in:
parent
b293f52672
commit
5afc56770d
4 changed files with 19 additions and 7 deletions
|
@ -97,6 +97,7 @@ option(LWS_WITH_LWSWS "Libwebsockets Webserver" OFF)
|
|||
option(LWS_WITH_PLUGINS "Support plugins for protocols and extensions" OFF)
|
||||
option(LWS_WITH_ACCESS_LOG "Support generating Apache-compatible access logs" OFF)
|
||||
option(LWS_WITH_SERVER_STATUS "Support json + jscript server monitoring" OFF)
|
||||
option(LWS_WITH_LEJP "With the Lightweight JSON Parser" OFF)
|
||||
|
||||
if (LWS_WITH_LWSWS)
|
||||
message(STATUS "LWS_WITH_LWSWS --> Enabling LWS_WITH_PLUGINS and LWS_WITH_LIBUV")
|
||||
|
@ -104,6 +105,7 @@ if (LWS_WITH_LWSWS)
|
|||
set(LWS_WITH_LIBUV 1)
|
||||
set(LWS_WITH_ACCESS_LOG 1)
|
||||
set(LWS_WITH_SERVER_STATUS 1)
|
||||
set(LWS_WITH_LEJP 1)
|
||||
endif()
|
||||
|
||||
if (LWS_WITH_PLUGINS AND NOT LWS_WITH_LIBUV)
|
||||
|
@ -576,6 +578,13 @@ if (LWS_WITH_LIBUV)
|
|||
lib/libuv.c)
|
||||
endif()
|
||||
|
||||
if (LWS_WITH_LEJP)
|
||||
list(APPEND SOURCES
|
||||
lib/lejp.c)
|
||||
list(APPEND HDR_PUBLIC
|
||||
lib/lejp.h)
|
||||
endif()
|
||||
|
||||
# Add helper files for Windows.
|
||||
if (WIN32)
|
||||
set(WIN32_HELPERS_PATH win32port/win32helpers)
|
||||
|
@ -1249,7 +1258,6 @@ endif(NOT LWS_WITHOUT_TESTAPPS)
|
|||
if (LWS_WITH_LWSWS)
|
||||
list(APPEND LWSWS_SRCS
|
||||
"lwsws/main.c"
|
||||
"lwsws/lejp.c"
|
||||
"lwsws/conf.c"
|
||||
"lwsws/http.c"
|
||||
)
|
||||
|
@ -1495,6 +1503,7 @@ message(" LIBHUBBUB_LIBRARIES = ${LIBHUBBUB_LIBRARIES}")
|
|||
message(" PLUGINS = ${PLUGINS_LIST}")
|
||||
message(" LWS_WITH_ACCESS_LOG = ${LWS_WITH_ACCESS_LOG}")
|
||||
message(" LWS_WITH_SERVER_STATUS = ${LWS_WITH_SERVER_STATUS}")
|
||||
message(" LWS_WITH_LEJP = ${LWS_WITH_LEJP}")
|
||||
message("---------------------------------------------------------------------")
|
||||
|
||||
# These will be available to parent projects including libwebsockets using add_subdirectory()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
#include "libwebsockets.h"
|
||||
struct lejp_ctx;
|
||||
|
||||
#ifndef ARRAY_SIZE
|
||||
|
@ -213,20 +213,20 @@ struct lejp_ctx {
|
|||
unsigned char wildcount;
|
||||
};
|
||||
|
||||
extern void
|
||||
LWS_VISIBLE void
|
||||
lejp_construct(struct lejp_ctx *ctx,
|
||||
char (*callback)(struct lejp_ctx *ctx, char reason), void *user,
|
||||
const char * const *paths, unsigned char paths_count);
|
||||
|
||||
extern void
|
||||
LWS_VISIBLE void
|
||||
lejp_destruct(struct lejp_ctx *ctx);
|
||||
|
||||
extern int
|
||||
LWS_VISIBLE int
|
||||
lejp_parse(struct lejp_ctx *ctx, const unsigned char *json, int len);
|
||||
|
||||
extern void
|
||||
LWS_VISIBLE void
|
||||
lejp_change_callback(struct lejp_ctx *ctx,
|
||||
char (*callback)(struct lejp_ctx *ctx, char reason));
|
||||
|
||||
extern int
|
||||
LWS_VISIBLE int
|
||||
lejp_get_wildcard(struct lejp_ctx *ctx, int wildcard, char *dest, int len);
|
|
@ -99,4 +99,7 @@
|
|||
/* Maximum supported service threads */
|
||||
#define LWS_MAX_SMP ${LWS_MAX_SMP}
|
||||
|
||||
/* Lightweight JSON Parser */
|
||||
#cmakedefine LWS_WITH_LEJP
|
||||
|
||||
${LWS_SIZEOFPTR_CODE}
|
||||
|
|
Loading…
Add table
Reference in a new issue