CMake fixes.

Builtin websockets support.
Persist sqlite plugin build.
Broker cJSON support
Add wildcard-temp plugin.
pull/2396/merge
Roger A. Light 4 years ago
parent 682e6c0401
commit bc1adfd46d

@ -64,6 +64,9 @@ if(WITH_SOCKS)
add_definitions("-DWITH_SOCKS")
endif()
option(WITH_WEBSOCKETS "Include websockets support?" ON)
option(WITH_WEBSOCKETS_BUILTIN "Websockets support uses builtin library? Set OFF to use libwebsockets" ON)
option(WITH_SRV "Include SRV lookup support?" OFF)
option(WITH_STATIC_LIBRARIES "Build static versions of the libmosquitto/pp libraries?" OFF)
option(WITH_PIC "Build the static library with PIC (Position Independent Code) enabled archives?" OFF)
@ -102,12 +105,13 @@ endif()
option(WITH_CJSON "Build with cJSON support (required for dynamic security plugin and useful for mosquitto_sub)?" ON)
if(WITH_CJSON)
FIND_PACKAGE(cJSON)
if(CJSON_FOUND)
message(STATUS ${CJSON_FOUND})
else()
message(STATUS "Optional dependency cJSON not found. Some features will be disabled.")
endif()
FIND_PACKAGE(cJSON)
if(CJSON_FOUND)
message(STATUS ${CJSON_FOUND})
add_definitions(-DWITH_CJSON)
else()
message(STATUS "Optional dependency cJSON not found. Some features will be disabled.")
endif()
endif()
# ========================================

@ -21,6 +21,10 @@ if(CJSON_FOUND)
set(CLIENT_INC "${CLIENT_INC};${CJSON_INCLUDE_DIRS}")
endif()
if(WITH_WEBSOCKETS AND WITH_WEBSOCKETS_BUILTIN)
add_definitions("-DWITH_WEBSOCKETS=WS_IS_BUILTIN")
endif()
add_executable(mosquitto_pub pub_client.c pub_shared.c ${shared_src})
add_executable(mosquitto_sub sub_client.c sub_client_output.c ${shared_src})
add_executable(mosquitto_rr rr_client.c pub_shared.c sub_client_output.c ${shared_src})

@ -82,10 +82,25 @@ if(WITH_SRV)
endif()
endif()
if(WITH_WEBSOCKETS AND WITH_WEBSOCKETS_BUILTIN)
add_definitions("-DWITH_WEBSOCKETS=WS_IS_BUILTIN")
set(C_SRC ${C_SRC}
../deps/picohttpparser/picohttpparser.c
base64_mosq.c base64_mosq.h
http_client.c http_client.h
net_ws.c
)
endif()
add_library(libmosquitto SHARED
${C_SRC}
)
if(WITH_WEBSOCKETS AND WITH_WEBSOCKETS_BUILTIN)
target_include_directories(libmosquitto PRIVATE
"${mosquitto_SOURCE_DIR}/deps/picohttpparser")
endif()
target_include_directories(libmosquitto PRIVATE
"${OPENSSL_INCLUDE_DIR}"
"${PTHREAD_INCLUDE_DIR}"

@ -12,3 +12,4 @@ add_subdirectory(payload-modification)
add_subdirectory(payload-size-stats)
add_subdirectory(print-ip-on-publish)
add_subdirectory(topic-modification)
add_subdirectory(wildcard-temp)

@ -8,6 +8,7 @@ target_include_directories(${PLUGIN_NAME} PRIVATE
"${STDBOOL_H_PATH}"
"${STDINT_H_PATH}"
"${mosquitto_SOURCE_DIR}"
"${mosquitto_SOURCE_DIR}/deps"
"${mosquitto_SOURCE_DIR}/include"
)

@ -1,4 +1,5 @@
if(SQLITE3_FOUND)
if(SQLITE3_FOUND AND CJSON_FOUND)
add_definitions("-DWITH_CJSON")
set(CLIENT_INC
"${SQLITE3_INCLUDE_DIRS}"
"${PTHREAD_INCLUDE_DIR}"

@ -132,12 +132,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL Linux)
endif()
endif()
option(WITH_WEBSOCKETS "Include websockets support?" OFF)
option(STATIC_WEBSOCKETS "Use the static libwebsockets library?" OFF)
if(WITH_WEBSOCKETS)
find_package(libwebsockets)
add_definitions("-DWITH_WEBSOCKETS")
endif()
option(WITH_CONTROL "Include $CONTROL topic support?" ON)
if(WITH_CONTROL)
@ -193,19 +188,38 @@ if(WIN32)
endif()
if(WITH_WEBSOCKETS)
if(STATIC_WEBSOCKETS)
set (MOSQ_LIBS ${MOSQ_LIBS} websockets_static)
if(WIN32)
set (MOSQ_LIBS ${MOSQ_LIBS} iphlpapi)
link_directories(${mosquitto_SOURCE_DIR})
endif()
else(STATIC_WEBSOCKETS)
set (MOSQ_LIBS ${MOSQ_LIBS} websockets)
if(WITH_WEBSOCKETS_BUILTIN)
add_definitions("-DWITH_WEBSOCKETS=WS_IS_BUILTIN")
set(MOSQ_SRCS ${MOSQ_SRCS} ../deps/picohttpparser/picohttpparser.c)
else()
find_package(libwebsockets)
add_definitions("-DWITH_WEBSOCKETS=WS_IS_LWS")
endif()
endif()
add_executable(mosquitto ${MOSQ_SRCS})
if(WITH_WEBSOCKETS)
if(WITH_WEBSOCKETS_BUILTIN)
target_include_directories(mosquitto PRIVATE
"${mosquitto_SOURCE_DIR}/deps/picohttpparser")
else()
if(STATIC_WEBSOCKETS)
set (MOSQ_LIBS ${MOSQ_LIBS} websockets_static)
if(WIN32)
set (MOSQ_LIBS ${MOSQ_LIBS} iphlpapi)
link_directories(${mosquitto_SOURCE_DIR})
endif()
else(STATIC_WEBSOCKETS)
set (MOSQ_LIBS ${MOSQ_LIBS} websockets)
endif()
endif()
endif()
if(CJSON_FOUND)
set (MOSQ_LIBS ${MOSQ_LIBS} cjson)
endif()
target_include_directories(mosquitto PRIVATE
"${OPENSSL_INCLUDE_DIR}"
"${STDBOOL_H_PATH}"

Loading…
Cancel
Save