|
|
|
@ -1,7 +1,3 @@
|
|
|
|
|
include_directories(${mosquitto_SOURCE_DIR} ${mosquitto_SOURCE_DIR}/src
|
|
|
|
|
${mosquitto_SOURCE_DIR}/include ${mosquitto_SOURCE_DIR}/lib
|
|
|
|
|
${OPENSSL_INCLUDE_DIR} ${STDBOOL_H_PATH} ${STDINT_H_PATH})
|
|
|
|
|
|
|
|
|
|
set (MOSQ_SRCS
|
|
|
|
|
../lib/alias_mosq.c ../lib/alias_mosq.h
|
|
|
|
|
bridge.c bridge_topic.c
|
|
|
|
@ -71,110 +67,100 @@ set (MOSQ_SRCS
|
|
|
|
|
../lib/utf8_mosq.c
|
|
|
|
|
websockets.c
|
|
|
|
|
will_delay.c
|
|
|
|
|
../lib/will_mosq.c ../lib/will_mosq.h)
|
|
|
|
|
../lib/will_mosq.c ../lib/will_mosq.h
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
CHECK_INCLUDE_FILES(sys/event.h HAVE_SYS_EVENT_H)
|
|
|
|
|
if (HAVE_SYS_EVENT_H)
|
|
|
|
|
if(HAVE_SYS_EVENT_H)
|
|
|
|
|
add_definitions("-DWITH_KQUEUE")
|
|
|
|
|
endif (HAVE_SYS_EVENT_H)
|
|
|
|
|
|
|
|
|
|
if (WITH_BUNDLED_DEPS)
|
|
|
|
|
include_directories(${mosquitto_SOURCE_DIR} ${mosquitto_SOURCE_DIR}/deps)
|
|
|
|
|
endif (WITH_BUNDLED_DEPS)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
find_path(HAVE_SYS_EPOLL_H sys/epoll.h)
|
|
|
|
|
if (HAVE_SYS_EPOLL_H)
|
|
|
|
|
if(HAVE_SYS_EPOLL_H)
|
|
|
|
|
add_definitions("-DWITH_EPOLL")
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
option(INC_BRIDGE_SUPPORT
|
|
|
|
|
"Include bridge support for connecting to other brokers?" ON)
|
|
|
|
|
if (INC_BRIDGE_SUPPORT)
|
|
|
|
|
if(INC_BRIDGE_SUPPORT)
|
|
|
|
|
set (MOSQ_SRCS ${MOSQ_SRCS} bridge.c)
|
|
|
|
|
add_definitions("-DWITH_BRIDGE")
|
|
|
|
|
endif (INC_BRIDGE_SUPPORT)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
option(USE_LIBWRAP
|
|
|
|
|
"Include tcp-wrappers support?" OFF)
|
|
|
|
|
option(USE_LIBWRAP "Include tcp-wrappers support?" OFF)
|
|
|
|
|
|
|
|
|
|
if (USE_LIBWRAP)
|
|
|
|
|
if(USE_LIBWRAP)
|
|
|
|
|
set (MOSQ_LIBS ${MOSQ_LIBS} wrap)
|
|
|
|
|
add_definitions("-DWITH_WRAP")
|
|
|
|
|
endif (USE_LIBWRAP)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
option(INC_DB_UPGRADE
|
|
|
|
|
"Include database upgrade support? (recommended)" ON)
|
|
|
|
|
option(INC_DB_UPGRADE "Include database upgrade support? (recommended)" ON)
|
|
|
|
|
|
|
|
|
|
option(INC_MEMTRACK
|
|
|
|
|
"Include memory tracking support?" ON)
|
|
|
|
|
if (INC_MEMTRACK)
|
|
|
|
|
option(INC_MEMTRACK "Include memory tracking support?" ON)
|
|
|
|
|
if(INC_MEMTRACK)
|
|
|
|
|
add_definitions("-DWITH_MEMORY_TRACKING")
|
|
|
|
|
endif (INC_MEMTRACK)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
option(WITH_PERSISTENCE
|
|
|
|
|
"Include persistence support?" ON)
|
|
|
|
|
if (WITH_PERSISTENCE)
|
|
|
|
|
option(WITH_PERSISTENCE "Include persistence support?" ON)
|
|
|
|
|
if(WITH_PERSISTENCE)
|
|
|
|
|
add_definitions("-DWITH_PERSISTENCE")
|
|
|
|
|
endif (WITH_PERSISTENCE)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
option(WITH_SYS_TREE
|
|
|
|
|
"Include $SYS tree support?" ON)
|
|
|
|
|
if (WITH_SYS_TREE)
|
|
|
|
|
option(WITH_SYS_TREE "Include $SYS tree support?" ON)
|
|
|
|
|
if(WITH_SYS_TREE)
|
|
|
|
|
add_definitions("-DWITH_SYS_TREE")
|
|
|
|
|
endif (WITH_SYS_TREE)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
option(WITH_ADNS
|
|
|
|
|
"Include ADNS support?" OFF)
|
|
|
|
|
option(WITH_ADNS "Include ADNS support?" OFF)
|
|
|
|
|
|
|
|
|
|
if (CMAKE_SYSTEM_NAME STREQUAL Linux)
|
|
|
|
|
option(WITH_SYSTEMD
|
|
|
|
|
"Include systemd support?" OFF)
|
|
|
|
|
if (WITH_SYSTEMD)
|
|
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
|
|
|
|
|
option(WITH_SYSTEMD "Include systemd support?" OFF)
|
|
|
|
|
if(WITH_SYSTEMD)
|
|
|
|
|
add_definitions("-DWITH_SYSTEMD")
|
|
|
|
|
find_library(SYSTEMD_LIBRARY systemd)
|
|
|
|
|
set (MOSQ_LIBS ${MOSQ_LIBS} ${SYSTEMD_LIBRARY})
|
|
|
|
|
endif (WITH_SYSTEMD)
|
|
|
|
|
endif (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)
|
|
|
|
|
if(WITH_WEBSOCKETS)
|
|
|
|
|
find_package(libwebsockets)
|
|
|
|
|
add_definitions("-DWITH_WEBSOCKETS")
|
|
|
|
|
endif (WITH_WEBSOCKETS)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
option(WITH_CONTROL "Include $CONTROL topic support?" ON)
|
|
|
|
|
if (WITH_CONTROL)
|
|
|
|
|
if(WITH_CONTROL)
|
|
|
|
|
add_definitions("-DWITH_CONTROL")
|
|
|
|
|
endif (WITH_CONTROL)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (WIN32 OR CYGWIN)
|
|
|
|
|
if(WIN32 OR CYGWIN)
|
|
|
|
|
set (MOSQ_SRCS ${MOSQ_SRCS} service.c)
|
|
|
|
|
endif (WIN32 OR CYGWIN)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
add_definitions (-DWITH_BROKER)
|
|
|
|
|
|
|
|
|
|
if (WITH_DLT)
|
|
|
|
|
if(WITH_DLT)
|
|
|
|
|
message(STATUS "DLT_LIBDIR = ${DLT_LIBDIR}")
|
|
|
|
|
link_directories(${DLT_LIBDIR})
|
|
|
|
|
set (MOSQ_LIBS ${MOSQ_LIBS} ${DLT_LIBRARIES})
|
|
|
|
|
endif (WITH_DLT)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
set (MOSQ_LIBS ${MOSQ_LIBS} ${OPENSSL_LIBRARIES})
|
|
|
|
|
# Check for getaddrinfo_a
|
|
|
|
|
include(CheckLibraryExists)
|
|
|
|
|
check_library_exists(anl getaddrinfo_a "" HAVE_GETADDRINFO_A)
|
|
|
|
|
if (HAVE_GETADDRINFO_A AND WITH_ADNS)
|
|
|
|
|
if(HAVE_GETADDRINFO_A AND WITH_ADNS)
|
|
|
|
|
add_definitions("-DWITH_ADNS")
|
|
|
|
|
add_definitions(-DHAVE_GETADDRINFO_A)
|
|
|
|
|
set (MOSQ_LIBS ${MOSQ_LIBS} anl)
|
|
|
|
|
endif (HAVE_GETADDRINFO_A AND WITH_ADNS)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (UNIX)
|
|
|
|
|
if (APPLE)
|
|
|
|
|
if(UNIX)
|
|
|
|
|
if(APPLE)
|
|
|
|
|
set (MOSQ_LIBS ${MOSQ_LIBS} dl m)
|
|
|
|
|
elseif (${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
|
|
|
|
|
set (MOSQ_LIBS ${MOSQ_LIBS} m)
|
|
|
|
@ -182,44 +168,71 @@ if (UNIX)
|
|
|
|
|
set (MOSQ_LIBS ${MOSQ_LIBS} m)
|
|
|
|
|
elseif(QNX)
|
|
|
|
|
set(MOSQ_LIBS ${MOSQ_LIBS} m socket)
|
|
|
|
|
else(APPLE)
|
|
|
|
|
else()
|
|
|
|
|
set (MOSQ_LIBS ${MOSQ_LIBS} dl m)
|
|
|
|
|
find_library(LIBRT rt)
|
|
|
|
|
if (LIBRT)
|
|
|
|
|
if(LIBRT)
|
|
|
|
|
set (MOSQ_LIBS ${MOSQ_LIBS} rt)
|
|
|
|
|
endif (LIBRT)
|
|
|
|
|
endif (APPLE)
|
|
|
|
|
endif (UNIX)
|
|
|
|
|
endif()
|
|
|
|
|
endif()
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if (WIN32)
|
|
|
|
|
if(WIN32)
|
|
|
|
|
set (MOSQ_LIBS ${MOSQ_LIBS} ws2_32)
|
|
|
|
|
endif (WIN32)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if (WITH_WEBSOCKETS)
|
|
|
|
|
if (STATIC_WEBSOCKETS)
|
|
|
|
|
if(WITH_WEBSOCKETS)
|
|
|
|
|
if(STATIC_WEBSOCKETS)
|
|
|
|
|
set (MOSQ_LIBS ${MOSQ_LIBS} websockets_static)
|
|
|
|
|
if (WIN32)
|
|
|
|
|
if(WIN32)
|
|
|
|
|
set (MOSQ_LIBS ${MOSQ_LIBS} iphlpapi)
|
|
|
|
|
link_directories(${mosquitto_SOURCE_DIR})
|
|
|
|
|
endif (WIN32)
|
|
|
|
|
else (STATIC_WEBSOCKETS)
|
|
|
|
|
endif(IN32)
|
|
|
|
|
else(STATIC_WEBSOCKETS)
|
|
|
|
|
set (MOSQ_LIBS ${MOSQ_LIBS} websockets)
|
|
|
|
|
endif (STATIC_WEBSOCKETS)
|
|
|
|
|
endif (WITH_WEBSOCKETS)
|
|
|
|
|
endif()
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
add_executable(mosquitto ${MOSQ_SRCS})
|
|
|
|
|
target_link_libraries(mosquitto ${MOSQ_LIBS})
|
|
|
|
|
if (WIN32)
|
|
|
|
|
set_target_properties(mosquitto PROPERTIES ENABLE_EXPORTS 1)
|
|
|
|
|
endif (WIN32)
|
|
|
|
|
|
|
|
|
|
if (UNIX)
|
|
|
|
|
if (APPLE)
|
|
|
|
|
set_target_properties(mosquitto PROPERTIES LINK_FLAGS "-Wl,-exported_symbols_list -Wl,${mosquitto_SOURCE_DIR}/src/linker-macosx.syms")
|
|
|
|
|
else (APPLE)
|
|
|
|
|
set_target_properties(mosquitto PROPERTIES LINK_FLAGS "-Wl,-dynamic-list=${mosquitto_SOURCE_DIR}/src/linker.syms")
|
|
|
|
|
endif (APPLE)
|
|
|
|
|
endif (UNIX)
|
|
|
|
|
|
|
|
|
|
install(TARGETS mosquitto RUNTIME DESTINATION "${CMAKE_INSTALL_SBINDIR}")
|
|
|
|
|
|
|
|
|
|
target_include_directories(mosquitto PRIVATE
|
|
|
|
|
"${OPENSSL_INCLUDE_DIR}"
|
|
|
|
|
"${STDBOOL_H_PATH}"
|
|
|
|
|
"${STDINT_H_PATH}"
|
|
|
|
|
"${mosquitto_SOURCE_DIR}"
|
|
|
|
|
"${mosquitto_SOURCE_DIR}/include"
|
|
|
|
|
"${mosquitto_SOURCE_DIR}/lib"
|
|
|
|
|
"${mosquitto_SOURCE_DIR}/src"
|
|
|
|
|
)
|
|
|
|
|
if(WITH_BUNDLED_DEPS)
|
|
|
|
|
target_include_directories(mosquitto PRIVATE
|
|
|
|
|
"${mosquitto_SOURCE_DIR}/deps"
|
|
|
|
|
)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
target_link_libraries(mosquitto
|
|
|
|
|
${MOSQ_LIBS}
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
if(WIN32)
|
|
|
|
|
set_target_properties(mosquitto PROPERTIES
|
|
|
|
|
ENABLE_EXPORTS 1
|
|
|
|
|
)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if(UNIX)
|
|
|
|
|
if(APPLE)
|
|
|
|
|
set_target_properties(mosquitto PROPERTIES
|
|
|
|
|
LINK_FLAGS "-Wl,-exported_symbols_list -Wl,${mosquitto_SOURCE_DIR}/src/linker-macosx.syms"
|
|
|
|
|
)
|
|
|
|
|
else()
|
|
|
|
|
set_target_properties(mosquitto PROPERTIES
|
|
|
|
|
LINK_FLAGS "-Wl,-dynamic-list=${mosquitto_SOURCE_DIR}/src/linker.syms"
|
|
|
|
|
)
|
|
|
|
|
endif()
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
install(TARGETS mosquitto
|
|
|
|
|
RUNTIME DESTINATION "${CMAKE_INSTALL_SBINDIR}"
|
|
|
|
|
)
|
|
|
|
|
install(FILES ../include/mosquitto_broker.h ../include/mosquitto_plugin.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
|
|
|
|
|