1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-16 00:00:02 +01:00
VILLASnode/lib/nodes/CMakeLists.txt

139 lines
3.8 KiB
CMake

# CMakeLists.
#
# @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
# @copyright 2018, 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/>.
###################################################################################
set(INCLUDE_DIRS
${JANSSON_INCLUDE_DIRS}
)
set(LIBRARIES
PkgConfig::JANSSON
)
set(NODE_SRC
influxdb.c
stats.c
signal_generator.c
)
if(LIBNL3_ROUTE_FOUND)
list(APPEND LIBRARIES PkgConfig::LIBNL3_ROUTE)
list(APPEND INCLUDE_DIRS LIBNL3_ROUTE_INCLUDE_DIRS)
endif()
if(WITH_IO)
list(APPEND NODE_SRC
test_rtt.c
file.c
socket.c
)
endif()
if(HAS_EVENTFD)
list(APPEND NODE_SRC
loopback.c
cbuilder.c
)
endif()
# Enable shared memory node-type
if(HAS_SEMAPHORE AND HAS_MMAN)
list(APPEND NODE_SRC shmem.c)
list(APPEND LIBRARIES "rt")
endif()
# Enable IEC61850 node-types when libiec61850 is available
if(LIBIEC61850_FOUND)
list(APPEND NODE_SRC iec61850_sv.c iec61850.c)
list(APPEND INCLUDE_DIRS ${LIBIEC61850_INCLUDE_DIRS})
list(APPEND LIBRARIES PkgConfig::LIBIEC61850)
endif()
# Enable OPAL-RT Asynchronous Process support (will result in 32bit binary!!!)
if(OPAL_FOUND AND BUILD32)
list(APPEND NODE_SRC opal.c)
list(APPEND INCLUDE_DIRS ${OPAL_INCLUDE_DIRS})
list(APPEND LIBRARIES ${OPAL_LIBRARIES})
endif()
# Enable nanomsg node type when libnanomsg is available
if(NANOMSG_FOUND AND WITH_IO)
list(APPEND NODE_SRC nanomsg.c)
list(APPEND INCLUDE_DIRS ${NANOMSG_INCLUDE_DIRS})
list(APPEND LIBRARIES PkgConfig::NANOMSG)
endif()
# Enable ZeroMQ node type when libzmq is available
if(LIBZMQ_FOUND AND WITH_IO)
list(APPEND NODE_SRC zeromq.c)
list(APPEND INCLUDE_DIRS ${LIBZMQ_INCLUDE_DIRS})
list(APPEND LIBRARIES PkgConfig::LIBZMQ)
endif()
# Enable NGSI support
if(CURL_FOUND)
list(APPEND NODE_SRC ngsi.c)
list(APPEND INCLUDE_DIRS ${CURL_INCLUDE_DIRS})
list(APPEND LIBRARIES ${CURL_LIBRARIES})
endif()
# Enable WebSocket support
if(LIBWEBSOCKETS_FOUND AND WITH_WEB AND WITH_IO)
list(APPEND NODE_SRC websockets.c)
list(APPEND INCLUDE_DIRS ${LIBWEBSOCKETS_INCLUDE_DIRS})
list(APPEND LIBRARIES websockets_shared)
endif()
# Enable AMQP support
if(RABBITMQ_C_FOUND AND WITH_IO)
list(APPEND NODE_SRC amqp.c)
list(APPEND INCLUDE_DIRS ${RABBITMQ_C_INCLUDE_DIRS})
list(APPEND LIBRARIES PkgConfig::RABBITMQ_C)
endif()
# Enable MQTT support
if(MOSQUITTO_FOUND AND WITH_IO)
list(APPEND NODE_SRC mqtt.c)
list(APPEND INCLUDE_DIRS ${MOSQUITTO_INCLUDE_DIRS})
list(APPEND LIBRARIES ${MOSQUITTO_LIBRARIES})
endif()
# Enable Comedi support
if(COMEDILIB_FOUND)
list(APPEND NODE_SRC comedi.c)
list(APPEND INCLUDE_DIRS ${COMEDILIB_INCLUDE_DIRS})
list(APPEND LIBRARIES PkgConfig::COMEDILIB)
endif()
add_library(villas-nodes SHARED ${NODE_SRC})
target_include_directories(villas-nodes PUBLIC ${INCLUDE_DIRS})
target_link_libraries(villas-nodes PUBLIC ${LIBRARIES})
#set_target_properties(villas-nodes PROPERTIES
# VERSION ${PROJECT_VERSION}
# SOVERSION ${PROJECT_SOVERSION}
#)
install(
TARGETS villas-nodes
COMPONENT lib
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)