mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
cmake: check if libwebsockets is built with deflate extension
This commit is contained in:
parent
52aee99a66
commit
b6234d27ae
5 changed files with 48 additions and 1 deletions
|
@ -52,6 +52,7 @@ include(CheckIncludeFile)
|
|||
include(FeatureSummary)
|
||||
include(GNUInstallDirs)
|
||||
include(GetVersion)
|
||||
include(FindSymbol)
|
||||
include(CMakeDependentOption)
|
||||
|
||||
# Compiler flags
|
||||
|
@ -90,7 +91,7 @@ find_package(Etherlab)
|
|||
# Check for tools
|
||||
find_program(PASTE NAMES paste)
|
||||
if(NOT PASTE)
|
||||
message(SEND_ERROR "GNU paste is missing. Please install coreutils")
|
||||
message(SEND_ERROR "GNU paste is missing. Please install coreutils")
|
||||
endif()
|
||||
|
||||
# Check programs
|
||||
|
@ -124,6 +125,9 @@ if(NOT RE_FOUND)
|
|||
pkg_check_modules(RE IMPORTED_TARGET libre>=0.5.6)
|
||||
endif()
|
||||
|
||||
# Check if libwebsockets is build with deflate extension
|
||||
FindSymbol(${LIBWEBSOCKETS_LINK_LIBRARIES} lws_extension_callback_pm_deflate LWS_DEFLATE_FOUND)
|
||||
|
||||
# Build options
|
||||
cmake_dependent_option(WITH_HOOKS "Build with support for processing hook plugins" ON "" OFF)
|
||||
cmake_dependent_option(WITH_WEB "Build with internal webserver" ON "LIBWEBSOCKETS_FOUND" OFF)
|
||||
|
|
36
cmake/FindSymbol.cmake
Normal file
36
cmake/FindSymbol.cmake
Normal file
|
@ -0,0 +1,36 @@
|
|||
# CMakeLists.txt.
|
||||
#
|
||||
# @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
|
||||
# @copyright 2014-2020, Institute for Automation of Complex Power Systems, EONERC
|
||||
# @license GNU General Public License (version 3)
|
||||
#
|
||||
# VILLASnode
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
###################################################################################
|
||||
|
||||
function(FindSymbol LIBRARY SYMBOL FOUND)
|
||||
find_program(OBJDUMP_EXECUTABLE NAMES objdump)
|
||||
|
||||
execute_process(
|
||||
COMMAND /bin/sh -c "${OBJDUMP_EXECUTABLE} -T ${LIBRARY} | grep ${SYMBOL} | wc -l"
|
||||
OUTPUT_VARIABLE OUTPUT
|
||||
)
|
||||
|
||||
if(OUTPUT GREATER 0)
|
||||
set(${FOUND} "${SYMBOL}" PARENT_SCOPE)
|
||||
else()
|
||||
set(${FOUND} "${SYMBOL}-NOTFOUND" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
|
@ -65,3 +65,6 @@
|
|||
#cmakedefine PROTOBUF_FOUND
|
||||
#cmakedefine LIBNL3_ROUTE_FOUND
|
||||
#cmakedefine IBVERBS_FOUND
|
||||
|
||||
/* Library features */
|
||||
#cmakedefine LWS_DEFLATE_FOUND
|
||||
|
|
|
@ -110,6 +110,7 @@ static lws_http_mount mounts[] = {
|
|||
|
||||
/** List of libwebsockets extensions. */
|
||||
static const lws_extension extensions[] = {
|
||||
#ifdef LWS_DEFLATE_FOUND
|
||||
{
|
||||
.name = "permessage-deflate",
|
||||
.callback = lws_extension_callback_pm_deflate,
|
||||
|
@ -120,6 +121,7 @@ static const lws_extension extensions[] = {
|
|||
.callback = lws_extension_callback_pm_deflate,
|
||||
.client_offer = "deflate_frame"
|
||||
},
|
||||
#endif /* LWS_DEFLATE_FOUND */
|
||||
{ nullptr /* terminator */ }
|
||||
};
|
||||
|
||||
|
|
|
@ -522,6 +522,7 @@ int Relay::main() {
|
|||
}
|
||||
|
||||
const std::vector<lws_extension> Relay::extensions = {
|
||||
#ifdef LWS_DEFLATE_FOUND
|
||||
{
|
||||
"permessage-deflate",
|
||||
lws_extension_callback_pm_deflate,
|
||||
|
@ -532,6 +533,7 @@ const std::vector<lws_extension> Relay::extensions = {
|
|||
lws_extension_callback_pm_deflate,
|
||||
"deflate_frame"
|
||||
},
|
||||
#endif /* LWS_DEFLATE_FOUND */
|
||||
{ nullptr /* terminator */ }
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue