1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

cmake: improve supported combination of compile options

This commit is contained in:
Steffen Vogel 2019-04-05 20:57:34 +02:00
parent 6002f2debd
commit 8d3a140f4f
9 changed files with 88 additions and 57 deletions

View file

@ -33,7 +33,7 @@ set(PROJECT_HOMEPAGE_URL "https://www.fein-aachen.org/projects/villas-node/")
# Several CMake settings/defaults
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_THREAD_PREFER_PTHREAD ON)
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake;${PROJECT_SOURCE_DIR}/common/cmake")
@ -52,6 +52,7 @@ include(CheckIncludeFile)
include(FeatureSummary)
include(GNUInstallDirs)
include(GetVersion)
include(CMakeDependentOption)
# Compiler flags
if(BUILD32)
@ -114,37 +115,37 @@ if(NOT RE_FOUND)
endif()
# Build options
option(WITH_HOOKS "Build with support for processing hook plugins" ON)
option(WITH_WEB "Build with internal webserver" ON)
option(WITH_API "Build with remote control API" ON)
option(WITH_CONFIG "Build with support for libconfig configuration syntax" ${LIBCONFIG_FOUND})
option(WITH_SRC "Build villas-* executables" ${TOPLEVEL_PROJECT})
option(WITH_TOOLS "Build auxilary tools" ${TOPLEVEL_PROJECT})
option(WITH_TESTS "Run tests" ${TOPLEVEL_PROJECT})
option(WITH_PLUGINS "Build plugins" ${TOPLEVEL_PROJECT})
option(WITH_CLIENTS "Build client applications" ${TOPLEVEL_PROJECT})
option(WITH_DOC "Build documentation" ${TOPLEVEL_PROJECT})
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)
cmake_dependent_option(WITH_API "Build with remote control API" ON "" OFF)
cmake_dependent_option(WITH_CONFIG "Build with support for libconfig configuration syntax" ON "LIBCONFIG_FOUND" OFF)
cmake_dependent_option(WITH_SRC "Build villas-* executables" ON "TOPLEVEL_PROJECT" OFF)
cmake_dependent_option(WITH_TOOLS "Build auxilary tools" ON "TOPLEVEL_PROJECT" OFF)
cmake_dependent_option(WITH_TESTS "Run tests" ON "TOPLEVEL_PROJECT" OFF)
cmake_dependent_option(WITH_PLUGINS "Build plugins" ON "TOPLEVEL_PROJECT" OFF)
cmake_dependent_option(WITH_CLIENTS "Build client applications" ON "TOPLEVEL_PROJECT" OFF)
cmake_dependent_option(WITH_DOC "Build documentation" ON "TOPLEVEL_PROJECT" OFF)
option(WITH_NODE_AMQP "Build with amqp node-type" ${RABBITMQ_C_FOUND})
option(WITH_NODE_COMEDI "Build with comedi node-type" ${COMEDILIB_FOUND})
option(WITH_NODE_FILE "Build with file node-type" ON)
option(WITH_NODE_IEC61850 "Build with iec61850 node-types" ${LIBIEC61850_FOUND})
option(WITH_NODE_INFINIBAND "Build with infiniband node-type" ${IBVerbs_FOUND})
option(WITH_NODE_INFLUXDB "Build with influxdb node-type" ON)
option(WITH_NODE_LOOPBACK "Build with loopback node-type" ON)
option(WITH_NODE_MQTT "Build with mqtt node-type" ${Mosquitto_FOUND})
option(WITH_NODE_NANOMSG "Build with nanomsg node-type" ${NANOMSG_FOUND})
option(WITH_NODE_NGSI "Build with ngsi node-type" ${CURL_FOUND})
option(WITH_NODE_OPAL "Build with opal node-type" ${Opal_FOUND})
option(WITH_NODE_RTP "Build with rtp node-type" ${RE_FOUND})
option(WITH_NODE_SHMEM "Build with shmem node-type" ON)
option(WITH_NODE_SIGNAL_GENERATOR "Build with signal node-type" ON)
option(WITH_NODE_SOCKET "Build with socket node-type" ${LIBNL3_ROUTE_FOUND})
option(WITH_NODE_STATS "Build with stats node-type" ON)
option(WITH_NODE_TEST_RTT "Build with test_rtt node-type" ON)
option(WITH_NODE_ULDAQ "Build with uldaq node-type" ${ULDAQ_FOUND})
option(WITH_NODE_WEBSOCKET "Build with websocket node-type" ${LIBWEBSOCKETS_LDFLAGS})
option(WITH_NODE_ZEROMQ "Build with zeromq node-type" ${LIBZMQ_FOUND})
cmake_dependent_option(WITH_NODE_AMQP "Build with amqp node-type" ON "RABBITMQ_C_FOUND" OFF)
cmake_dependent_option(WITH_NODE_COMEDI "Build with comedi node-type" ON "COMEDILIB_FOUND" OFF)
cmake_dependent_option(WITH_NODE_FILE "Build with file node-type" ON "" OFF)
cmake_dependent_option(WITH_NODE_IEC61850 "Build with iec61850 node-types" ON "LIBIEC61850_FOUND" OFF)
cmake_dependent_option(WITH_NODE_INFINIBAND "Build with infiniband node-type" ON "IBVERBS_FOUND; RDMACM_FOUND" OFF)
cmake_dependent_option(WITH_NODE_INFLUXDB "Build with influxdb node-type" ON "" OFF)
cmake_dependent_option(WITH_NODE_LOOPBACK "Build with loopback node-type" ON "" OFF)
cmake_dependent_option(WITH_NODE_MQTT "Build with mqtt node-type" ON "Mosquitto_FOUND" OFF)
cmake_dependent_option(WITH_NODE_NANOMSG "Build with nanomsg node-type" ON "NANOMSG_FOUND" OFF)
cmake_dependent_option(WITH_NODE_NGSI "Build with ngsi node-type" ON "" OFF)
cmake_dependent_option(WITH_NODE_OPAL "Build with opal node-type" ON "BUILD32; Opal_FOUND" OFF)
cmake_dependent_option(WITH_NODE_RTP "Build with rtp node-type" ON "RE_FOUND" OFF)
cmake_dependent_option(WITH_NODE_SHMEM "Build with shmem node-type" ON "HAS_SEMAPHORE; HAS_MMAN" OFF)
cmake_dependent_option(WITH_NODE_SIGNAL "Build with signal node-type" ON "" OFF)
cmake_dependent_option(WITH_NODE_SOCKET "Build with socket node-type" ON "LIBNL3_ROUTE_FOUND" OFF)
cmake_dependent_option(WITH_NODE_STATS "Build with stats node-type" ON "" OFF)
cmake_dependent_option(WITH_NODE_TEST_RTT "Build with test_rtt node-type" ON "" OFF)
cmake_dependent_option(WITH_NODE_ULDAQ "Build with uldaq node-type" ON "LIBULDAQ_FOUND" OFF)
cmake_dependent_option(WITH_NODE_WEBSOCKET "Build with websocket node-type" ON "WITH_WEB; LIBWEBSOCKETS_FOUND" OFF)
cmake_dependent_option(WITH_NODE_ZEROMQ "Build with zeromq node-type" ON "LIBZMQ_FOUND" OFF)
# Add more build configurations
include(cmake/config/Debug.cmake)
@ -192,15 +193,36 @@ configure_file(
)
# Show feature summary
add_feature_info(HOOKS WITH_HOOKS "Build with support for processing hook plugins")
add_feature_info(WEB WITH_WEB "Build with internal webserver")
add_feature_info(API WITH_API "Build with remote control API")
add_feature_info(CONFIG WITH_CONFIG "Build with support for libconfig configuration syntax")
add_feature_info(TOOLS WITH_TOOLS "Build auxilary tools")
add_feature_info(TESTS WITH_TESTS "Run tests")
add_feature_info(PLUGINS WITH_PLUGINS "Build plugins")
add_feature_info(CLIENTS WITH_CLIENTS "Build client applications")
add_feature_info(DOC WITH_DOC "Build documentation")
add_feature_info(HOOKS WITH_HOOKS "Build with support for processing hook plugins")
add_feature_info(WEB WITH_WEB "Build with internal webserver")
add_feature_info(API WITH_API "Build with remote control API")
add_feature_info(CONFIG WITH_CONFIG "Build with support for libconfig configuration syntax")
add_feature_info(TOOLS WITH_TOOLS "Build auxilary tools")
add_feature_info(TESTS WITH_TESTS "Run tests")
add_feature_info(PLUGINS WITH_PLUGINS "Build plugins")
add_feature_info(CLIENTS WITH_CLIENTS "Build client applications")
add_feature_info(DOC WITH_DOC "Build documentation")
add_feature_info(NODE_AMQP WITH_NODE_AMQP "Build with amqp node-type")
add_feature_info(NODE_COMEDI WITH_NODE_COMEDI "Build with comedi node-type")
add_feature_info(NODE_FILE WITH_NODE_FILE "Build with file node-type")
add_feature_info(NODE_IEC61850 WITH_NODE_IEC61850 "Build with iec61850 node-types")
add_feature_info(NODE_INFINIBAND WITH_NODE_INFINIBAND "Build with infiniband node-type")
add_feature_info(NODE_INFLUXDB WITH_NODE_INFLUXDB "Build with influxdb node-type")
add_feature_info(NODE_LOOPBACK WITH_NODE_LOOPBACK "Build with loopback node-type")
add_feature_info(NODE_MQTT WITH_NODE_MQTT "Build with mqtt node-type")
add_feature_info(NODE_NANOMSG WITH_NODE_NANOMSG "Build with nanomsg node-type")
add_feature_info(NODE_NGSI WITH_NODE_NGSI "Build with ngsi node-type")
add_feature_info(NODE_OPAL WITH_NODE_OPAL "Build with opal node-type")
add_feature_info(NODE_RTP WITH_NODE_RTP "Build with rtp node-type")
add_feature_info(NODE_SHMEM WITH_NODE_SHMEM "Build with shmem node-type")
add_feature_info(NODE_SIGNAL_GENERATOR WITH_NODE_SIGNAL "Build with signal node-type")
add_feature_info(NODE_SOCKET WITH_NODE_SOCKET "Build with socket node-type")
add_feature_info(NODE_STATS WITH_NODE_STATS "Build with stats node-type")
add_feature_info(NODE_TEST_RTT WITH_NODE_TEST_RTT "Build with test_rtt node-type")
add_feature_info(NODE_ULDAQ WITH_NODE_ULDAQ "Build with uldaq node-type")
add_feature_info(NODE_WEBSOCKET WITH_NODE_WEBSOCKET "Build with websocket node-type")
add_feature_info(NODE_ZEROMQ WITH_NODE_ZEROMQ "Build with zeromq node-type")
if(TOPLEVEL_PROJECT)
feature_summary(WHAT ALL VAR FEATURES)
@ -213,6 +235,8 @@ if(TOPLEVEL_PROJECT)
message(STATUS " VARIANT: ${CMAKE_PROJECT_VARIANT}")
message(STATUS " BUILD_ID: ${CMAKE_PROJECT_BUILD_ID}")
message(STATUS " BUILD_DATE: ${CMAKE_PROJECT_BUILD_DATE}")
message(STATUS " ARCH: ${CMAKE_SYSTEM_PROCESSOR}")
message(STATUS " OS: ${CMAKE_SYSTEM_NAME}")
endif()
include(VILLASnodePackaging)

View file

@ -25,7 +25,7 @@
#include <jansson.h>
#include <villas/config.h>
#include <villas/node/config.h>
#include <villas/advio.h>
namespace villas {

View file

@ -24,13 +24,12 @@
#include <jansson.h>
#ifdef WITH_CONFIG
#include <libconfig.h>
#endif /* WITH_CONFIG */
#include <villas/node/config.h>
#include <villas/sample.h>
#ifdef WITH_CONFIG
#include <libconfig.h>
/** Convert a libconfig object to a jansson object */
json_t *config_to_json(config_setting_t *cfg);

View file

@ -68,7 +68,7 @@ set(LIB_SRC
)
if(IBVERBS_FOUND AND RDMACM_FOUND)
if(WITH_NODE_INFINIBAND)
list(APPEND LIB_SRC memory/ib.c)
endif()
@ -102,7 +102,7 @@ if(WITH_WEB)
list(APPEND LIBRARIES PkgConfig::LIBWEBSOCKETS)
endif()
if(WITH_API AND WITH_WEB)
if(WITH_API)
list(APPEND LIB_SRC
api.cpp
)

View file

@ -26,9 +26,6 @@ set(API_SRC
server.cpp
sessions/socket.cpp
sessions/wsi.cpp
sessions/http.cpp
sessions/websocket.cpp
actions/capabiltities.cpp
actions/shutdown.cpp
@ -40,6 +37,14 @@ set(API_SRC
actions/node.cpp
)
if(WITH_WEB)
list(APPEND API_SRC
sessions/wsi.cpp
sessions/http.cpp
sessions/websocket.cpp
)
endif()
add_library(api STATIC ${API_SRC})
target_include_directories(api PUBLIC ${INCLUDE_DIRS})
target_link_libraries(api INTERFACE ${LIBRARIES} PUBLIC villas-common)

View file

@ -35,7 +35,7 @@ if(WITH_NODE_STATS)
list(APPEND NODE_SRC stats.c)
endif()
if(WITH_NODE_SIGNAL_GENERATOR)
if(WITH_NODE_SIGNAL)
list(APPEND NODE_SRC signal_generator.c)
endif()
@ -63,7 +63,7 @@ if(WITH_NODE_ULDAQ)
endif()
# Enable shared memory node-type
if(WITH_NODE_SHMEM AND HAS_SEMAPHORE AND HAS_MMAN)
if(WITH_NODE_SHMEM)
list(APPEND NODE_SRC shmem.c)
if(CMAKE_SUSTEM_NAME STREQUAL Linux)
@ -79,7 +79,7 @@ if(WITH_NODE_IEC61850)
endif()
# Enable OPAL-RT Asynchronous Process support (will result in 32bit binary!!!)
if(WITH_NODE_OPAL AND BUILD32)
if(WITH_NODE_OPAL)
list(APPEND NODE_SRC opal.c)
list(APPEND INCLUDE_DIRS ${OPAL_INCLUDE_DIRS})
list(APPEND LIBRARIES ${OPAL_LIBRARIES})
@ -100,14 +100,14 @@ if(WITH_NODE_ZEROMQ)
endif()
# Enable NGSI support
if(WITH_NGSI)
if(WITH_NODE_NGSI)
list(APPEND NODE_SRC ngsi.c)
list(APPEND INCLUDE_DIRS ${CURL_INCLUDE_DIRS})
list(APPEND LIBRARIES ${CURL_LIBRARIES})
endif()
# Enable WebSocket support
if(WITH_NODE_WEBSOCKET AND WITH_WEB)
if(WITH_NODE_WEBSOCKET)
list(APPEND NODE_SRC websocket.c)
list(APPEND INCLUDE_DIRS ${LIBWEBSOCKETS_INCLUDE_DIRS})
list(APPEND LIBRARIES ${LIBWEBSOCKETS_LDLIBS})
@ -142,7 +142,7 @@ if(WITH_NODE_INFINIBAND)
endif()
# Enable RTP node type when libre is available
if(WITH_NODE_RE)
if(WITH_NODE_RTP)
list(APPEND NODE_SRC rtp.cpp)
list(APPEND INCLUDE_DIRS ${RE_INCLUDE_DIRS})
list(APPEND LIBRARIES PkgConfig::RE)

View file

@ -458,6 +458,7 @@ void SuperNode::stop()
#ifdef WITH_API
api.stop();
#endif
#ifdef WITH_WEB
web.stop();
#endif

View file

@ -61,12 +61,14 @@ lws_protocols protocols[] = {
.rx_buffer_size = 0
},
#endif /* WITH_API */
#ifdef WITH_NODE_WEBSOCKET
{
.name = "live",
.callback = websocket_protocol_cb,
.per_session_data_size = sizeof(websocket_connection),
.rx_buffer_size = 0
},
#endif /* WITH_NODE_WEBSOCKET */
{
.name = nullptr /* terminator */
}

View file

@ -62,7 +62,7 @@ static struct param params[] = {
{ "villas.binary", 10, 0 },
{ "csv", 10, 0 },
{ "json", 10, 0 },
#ifdef LIBPROTOBUF_FOUND
#ifdef PROTOBUF_FOUND
{ "protobuf", 10, 0 }
#endif
};