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: add more CMakeLists.txt

This commit is contained in:
Steffen Vogel 2018-06-25 09:44:58 +02:00
parent 09f55734f0
commit 9094941b4c
27 changed files with 965 additions and 94 deletions

View file

@ -1,7 +1,7 @@
# Main CMakeLists.
#
# @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
# @copyright 2017, Institute for Automation of Complex Power Systems, EONERC
# @copyright 2018, Institute for Automation of Complex Power Systems, EONERC
# @license GNU General Public License (version 3)
#
# VILLASnode
@ -22,17 +22,36 @@
cmake_minimum_required(VERSION 3.0)
project(VILLASnode)
project(VILLASnode C CXX)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 11)
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH ON)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig:/usr/local/share/pkgconfig")
find_package(PkgConfig)
if(APPLE)
set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:/opt/local/lib/pkgconfig")
endif()
include(FindPkgConfig)
include(CheckIncludeFile)
include(FeatureSummary)
include(CheckCCompilerFlag)
#include(CheckCxxCompilerFlag)
include(GNUInstallDirs)
include(VILLASnodePackaging)
# Compiler flags
if(BUILD32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m32")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -m32")
set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} -m32")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fdiagnostics-color=auto -D_POSIX_C_SOURCE=200809L -D_GNU_SOURCE=1")
if(MSVC)
check_c_compiler_flag("/W4 /WX" C_SUPPORTS_WERROR)
@ -58,53 +77,58 @@ else()
endif()
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
string(APPEND VARIANTS "-debug")
else()
string(APPEND VARIANTS "-release")
endif()
if(PROFILE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pg")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -pg")
set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} -pg")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg")
string(APPEND VARIANTS "-profile")
endif()
if(COVERAGE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage")
target_link_libraries("gcov")
string(APPEND VARIANTS "-coverage")
endif()
# Check OS
check_include_file("sys/eventfd.h" HAS_EVENTFD)
check_include_file("semaphore.h" HAS_SEMAPHORE)
check_include_file("sys/mman.h" HAS_MMAN)
pkg_check_modules(JANSSON IMPORTED_TARGET REQUIRED jansson)
pkg_check_modules(LIBNL3_ROUTE IMPORTED_TARGET libnl-route-3.0)
pkg_check_modules(LIBIEC61850 IMPORTED_TARGET libiec61850>=1.2.0)
pkg_check_modules(LIBCONFIG IMPORTED_TARGET libconfig)
pkg_check_modules(RABBITMQ_C IMPORTED_TARGET librabbitmq)
pkg_check_modules(COMEDILIB IMPORTED_TARGET comedilib)
pkg_check_modules(LIBZMQ IMPORTED_TARGET libzmq)
pkg_check_modules(NANOMSG IMPORTED_TARGET nanomsg)
if(NOT NANOMSG_FOUND)
pkg_check_modules(NANOMSG IMPORTED_TARGET libnanomsg)
endif()
find_package(Libwebsockets REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(CURL REQUIRED)
find_package(Protobuf)
find_package(Opal)
# Build options
option(WITH_HOOKS "Build with support for processing hook plugins" ON)
option(WITH_IO "Build with support format 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" ON)
option(WITH_HOOKS "Build with support for processing hook plugins" ON)
option(WITH_IO "Build with support format 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" ON)
set(V 2)
set(PREFIX ${CMAKE_INSTALL_PREFIX})
set(VARIANT "${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
# Add more build configurations
include(cmake/config/Debug.cmake)
include(cmake/config/Release.cmake)
include(cmake/config/Coverage.cmake)
include(cmake/config/Profiling.cmake)
# Add git revision and build variant defines
set(PROJECT_SOVERSION 1)
execute_process(
COMMAND git describe --tags --abbrev=0 --match "v*"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE VERSION
OUTPUT_VARIABLE PROJECT_VERSION_STR
OUTPUT_STRIP_TRAILING_WHITESPACE
)
string(SUBSTRING ${VERSION} 2 -1 VERSION_NUM)
string(SUBSTRING ${PROJECT_VERSION_STR} 2 -1 PROJECT_VERSION)
string(TIMESTAMP BUILD_DATE "%Y%m%d")
if(DEFINED ENV{CI})
@ -128,20 +152,15 @@ else()
endif()
if(DEFINED ENV{CI_COMMIT_TAG})
set(RELEASE 1)
set(PROJECT_RELEASE 1)
else()
string(REPLACE "-" "_" GIT_BRANCH_NORM ${GIT_BRANCH})
string(REPLACE "-" "_" VARIANT_NORM ${VARIANT})
set(RELEASE "1.${GIT_BRANCH_NORM}_${VARIANT_NORM}.${BUILD_DATE}git${GIT_REV}")
set(PROJECT_RELEASE "1.${GIT_BRANCH_NORM}_${VARIANT_NORM}.${BUILD_DATE}git${GIT_REV}")
endif()
set(BUILDID "${VERSION}-${GIT_REV}-${VARIANT}")
configure_file(
${CMAKE_SOURCE_DIR}/include/villas/config.h.in
${CMAKE_BINARY_DIR}/include/villas/config.h
)
set(BUILDID "${PROJECT_VERSION_STR}-${GIT_REV}-${VARIANT}")
include_directories(
${CMAKE_SOURCE_DIR}/include
@ -151,7 +170,18 @@ include_directories(
add_subdirectory(lib)
add_subdirectory(src)
add_subdirectory(tools)
add_subdirectory(plugins)
add_subdirectory(etc)
add_subdirectory(doc)
add_subdirectory(web)
add_subdirectory(clients)
add_subdirectory(tests)
add_subdirectory(packaging)
configure_file(
${CMAKE_SOURCE_DIR}/include/villas/config.h.in
${CMAKE_BINARY_DIR}/include/villas/config.h
)
# Show feature summary
add_feature_info(HOOKS WITH_HOOKS "Build with support for processing hook plugins")

24
clients/CMakeLists.txt Normal file
View file

@ -0,0 +1,24 @@
# CMakeLists.txt.
#
# @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/>.
###################################################################################
add_subdirectory(python)
add_subdirectory(opal)

View file

@ -0,0 +1,32 @@
# CMakeLists.txt.
#
# @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/>.
###################################################################################
if(OPAL_FOUND)
set(ASYNCIP_PATH ${CMAKE_CURRENT_SOURCE_DIR}/models/send_receive)
set(ASYNCIP_OPTS RTLAB_INTEL_COMPILER=0 PROTOCOL=GTNET_SKT OPAL_LIBS="-lSystem -luuid" OPAL_LIBPATH=-L$(SRCDIR)/thirdparty/libopal/ OPAL_INCPATH=-I$(SRCDIR)/thirdparty/libopal/include/opal)
# Just call the original Makefile
add_custom_target(clients-opal
COMMAND make -C ${ASYNCIP_PATH} -f Makefile.mk AsyncIP ${ASYNCIP_OPTS}
)
endif()

View file

@ -0,0 +1,27 @@
# Makefile.
#
# @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
# @copyright 2017, 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/>.
###################################################################################
add_custom_command(OUTPUT villas_pb2.py
COMMAND protoc ${CMAKE_SOURCE_DIR}/lib/nodes/villas.proto
MAIN_DEPENDENCY villas.proto
)

40
cmake/FindMosquitto.cmake Normal file
View file

@ -0,0 +1,40 @@
# CMakeLists.txt.
#
# @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/>.
###################################################################################
find_path(MOSQUITTO_INCLUDE_DIR
NAMES mosquitto.h
)
find_library(MOSQUITTO_LIBRARY
NAMES mosquitto
)
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set VILLASNODE_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(MOSQUITTO DEFAULT_MSG
MOSQUITTO_LIBRARY MOSQUITTO_INCLUDE_DIR)
mark_as_advanced(MOSQUITTO_INCLUDE_DIR MOSQUITTO_LIBRARY)
set(MOSQUITTO_LIBRARIES ${MOSQUITTO_LIBRARY})
set(MOSQUITTO_INCLUDE_DIRS ${MOSQUITTO_INCLUDE_DIR})

39
cmake/FindOpal.cmake Normal file
View file

@ -0,0 +1,39 @@
# CMakeLists.txt.
#
# @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/>.
###################################################################################
find_path(OPAL_INCLUDE_DIR
NAMES opal/AsyncApi.h
)
find_library(OPAL_LIBRARY
NAMES OpalAsyncApiCore
)
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set VILLASNODE_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(OPAL DEFAULT_MSG OPAL_LIBRARY OPAL_INCLUDE_DIR)
mark_as_advanced(OPAL_INCLUDE_DIR OPAL_LIBRARY)
set(OPAL_LIBRARIES ${OPAL_LIBRARY} OpalCore OpalUtils irc)
set(OPAL_INCLUDE_DIRS ${OPAL_INCLUDE_DIR})

View file

@ -0,0 +1,54 @@
# CMakeLists.txt.
#
# @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(PROJECT_AUTHOR "Steffen Vogel")
set(PROJECT_COPYRIGHT "2018, Institute for Automation of Complex Power Systems, RWTH Aachen University")
set(CPACK_PACKAGE_NAME ${PROJECT_NAME})
set(CPACK_PACKAGE_VENDOR ${PROJECT_AUTHOR})
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "This is VILLASnode, a gateway for processing and forwardning simulation data between real-time simulators.")
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_MAJOR_VERSION})
set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_MINOR_VERSION})
set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_PATCH_VERSION})
set(CPACK_RPM_PACKAGE_VERSION ${PROJECT_VERSION})
set(CPACK_RPM_PACKAGE_RELEASE ${PROJECT_RELEASE})
set(CPACK_RPM_PACKAGE_ARCHITECTURE "x86_64")
set(CPACK_RPM_PACKAGE_LICENSE "GPLv3")
set(CPACK_RPM_PACKAGE_URL "http://www.fein-aachen.org/projects/dpsim/")
set(CPACK_RPM_PACKAGE_REQUIRES "openssl libconfig libnl3 libcurl jansson libwebsockets zeromq nanomsg libiec61850 librabbitmq mosquitto comedilib")
set(CPACK_RPM_PACKAGE_GROUP "Development/Libraries")
# As close as possible to Fedoras naming
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_RPM_PACKAGE_RELEASE}.${CPACK_RPM_PACKAGE_ARCHITECTURE}")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING.md")
set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md")
set(CPACK_SOURCE_IGNORE_FILES "build/;\\.gitmodules;\\.git/;\\.vscode;\\.editorconfig;\\.gitlab-ci.yml;\\.(docker|git)ignore;\\.DS_Store")
if(NOT DEFINED CPACK_GENERATOR)
set(CPACK_GENERATOR "RPM;TGZ")
endif()
include(CPack)

View file

@ -0,0 +1,58 @@
# CMakeLists.txt.
#
# @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(CMAKE_CXX_FLAGS_COVERAGE
"${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage"
CACHE STRING "Flags used by the C++ compiler during coverage builds."
FORCE
)
set(CMAKE_C_FLAGS_COVERAGE
"${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage"
CACHE STRING "Flags used by the C compiler during coverage builds."
FORCE
)
set(CMAKE_EXE_LINKER_FLAGS_COVERAGE
"${CMAKE_EXE_LINKER_FLAGS}"
CACHE STRING "Flags used for linking binaries during coverage builds."
FORCE
)
set(CMAKE_SHARED_LINKER_FLAGS_COVERAGE
"${CMAKE_SHARED_LINKER_FLAGS_COVERAGE}"
CACHE STRING "Flags used by the shared libraries linker during coverage builds."
FORCE
)
mark_as_advanced(
CMAKE_CXX_FLAGS_COVERAGE
CMAKE_C_FLAGS_COVERAGE
CMAKE_EXE_LINKER_FLAGS_COVERAGE
CMAKE_SHARED_LINKER_FLAGS_COVERAGE
)
if(CMAKE_BUILD_TYPE STREQUAL "Coverage")
target_link_libraries("gcov")
string(APPEND VARIANTS "-coverage")
endif()

25
cmake/config/Debug.cmake Normal file
View file

@ -0,0 +1,25 @@
# CMakeLists.txt.
#
# @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/>.
###################################################################################
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
string(APPEND VARIANTS "-debug")
endif()

View file

@ -0,0 +1,58 @@
# CMakeLists.txt.
#
# @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(CMAKE_CXX_FLAGS_PROFILING
"${CMAKE_CXX_FLAGS} -pg"
CACHE STRING "Flags used by the C++ compiler during coverage builds."
FORCE
)
set(CMAKE_C_FLAGS_PROFILING
"${CMAKE_C_FLAGS} -pg"
CACHE STRING "Flags used by the C compiler during coverage builds."
FORCE
)
set(CMAKE_EXE_LINKER_FLAGS_PROFILING
"${CMAKE_EXE_LINKER_FLAGS} -pg"
CACHE STRING "Flags used for linking binaries during coverage builds."
FORCE
)
set(CMAKE_SHARED_LINKER_FLAGS_PROFILING
"${CMAKE_SHARED_LINKER_FLAGS_COVERAGE} -pg"
CACHE STRING "Flags used by the shared libraries linker during coverage builds."
FORCE
)
mark_as_advanced(
CMAKE_CXX_FLAGS_PROFILING
CMAKE_C_FLAGS_PROFILING
CMAKE_EXE_LINKER_FLAGS_PROFILING
CMAKE_SHARED_LINKER_FLAGS_PROFILING
)
if(CMAKE_BUILD_TYPE STREQUAL "Profiling")
string(APPEND VARIANTS "-profile")
endif()

View file

@ -0,0 +1,25 @@
# CMakeLists.txt.
#
# @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/>.
###################################################################################
if(CMAKE_BUILD_TYPE STREQUAL "Release")
string(APPEND VARIANTS "-release")
endif()

25
etc/CMakeLists.txt Normal file
View file

@ -0,0 +1,25 @@
# CMakeLists.txt.
#
# @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/>.
###################################################################################
install(DIRECTORY .
DESTINATION etc/villas/node/
)

View file

@ -1,7 +1,7 @@
# CMakeLists.
#
# @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
# @copyright 2017, Institute for Automation of Complex Power Systems, EONERC
# @copyright 2018, Institute for Automation of Complex Power Systems, EONERC
# @license GNU General Public License (version 3)
#
# VILLASnode
@ -20,11 +20,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
###################################################################################
find_package(OpenSSL REQUIRED)
find_package(curl REQUIRED)
pkg_check_modules(JANSSON IMPORTED_TARGET REQUIRED jansson)
set(INCLUDE_DIRS
${JANSSON_INCLUDE_DIRS}
${OPENSSL_INCLUDE_DIR}
@ -73,11 +68,9 @@ set(LIB_SRC
add_subdirectory(nodes)
if(WITH_CONFIG)
pkg_check_modules(CONFIG IMPORTED_TARGET REQUIRED libconfig)
list(APPEND INCLUDE_DIRS ${CONFIG_INCLUDE_DIRS})
list(APPEND LIBRARIES PkgConfig::CONFIG)
if(LIBCONFIG_FOUND)
list(APPEND INCLUDE_DIRS ${LIBCONFIG_INCLUDE_DIRS})
list(APPEND LIBRARIES PkgConfig::LIBCONFIG)
endif()
if(WITH_IO)
@ -95,7 +88,7 @@ if(WITH_HOOKS)
hook.c
hook_type.c
)
add_subdirectory(hooks)
list(APPEND LIBRARIES villas-hooks)
endif()
@ -104,10 +97,6 @@ if(WITH_WEB)
list(APPEND LIB_SRC
web.c
)
find_package(libwebsockets REQUIRED)
message("LWS: ${LIBWEBSOCKETS_LIBRARIES}")
list(APPEND INCLUDE_DIRS ${LIBWEBSOCKETS_INCLUDE_DIRS})
list(APPEND LIBRARIES websockets_shared)
@ -122,7 +111,35 @@ if(WITH_API AND WITH_WEB)
list(APPEND LIBRARIES villas-api)
endif()
# libnl3 is optional but required for network emulation and IRQ pinning
if(LIBNL3_ROUTE_FOUND)
list(APPEND LIB_SRC
kernel/nl.c
kernel/tc.c
kernel/tc_netem.c
kernel/if.c
)
list(APPEND INCLUDE_DIRS ${LIBNL3_ROUTE_INCLUDE_DIRS})
list(APPEND LIBRARIES PkgConfig::LIBNL3_ROUTE)
endif()
add_library(villas SHARED ${LIB_SRC})
target_include_directories(villas PUBLIC ${INCLUDE_DIRS})
target_link_libraries(villas PUBLIC ${LIBRARIES})
set_target_properties(villas PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_SOVERSION}
)
install(TARGETS villas EXPORT VILLASNodeConfig
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(DIRECTORY ../include/villas/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/villas/)
#install(EXPORT VILLASNodeConfig DESTINATION share/VILLASNode/cmake)
#export(TARGETS villas FILE VILLASNodeConfig.cmake)

View file

@ -2,7 +2,7 @@
# CMakeLists.
#
# @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
# @copyright 2017, Institute for Automation of Complex Power Systems, EONERC
# @copyright 2018, Institute for Automation of Complex Power Systems, EONERC
# @license GNU General Public License (version 3)
#
# VILLASnode
@ -21,8 +21,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
###################################################################################
find_package(openssl REQUIRED)
set(INCLUDE_DIRS
${OPENSSL_INCLUDE_DIR}
)
@ -31,12 +29,17 @@ set(LIBRARIES
${OPENSSL_LIBRARIES}
)
file(GLOB ACTION_SRC actions/*.c)
add_library(villas-api STATIC
${ACTION_SRC}
set(API_SRC
session.c
actions/capabiltities.c
actions/config.c
actions/nodes.c
actions/paths.c
actions/restart.c
actions/shutdown.c
actions/status.c
)
add_library(villas-api SHARED ${API_SRC})
target_include_directories(villas-api PUBLIC ${INCLUDE_DIRS})
target_link_libraries(villas-api PUBLIC ${LIBRARIES})

View file

@ -1,7 +1,7 @@
# CMakeLists.
#
# @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
# @copyright 2017, Institute for Automation of Complex Power Systems, EONERC
# @copyright 2018, Institute for Automation of Complex Power Systems, EONERC
# @license GNU General Public License (version 3)
#
# VILLASnode
@ -29,8 +29,6 @@ set(FORMAT_SRC
raw.c
)
find_package(openssl REQUIRED)
set(INCLUDE_DIRS
${OPENSSL_INCLUDE_DIR}
)
@ -40,7 +38,6 @@ set(LIBRARIES
)
# Enable Google Protobuf format
find_package(Protobuf)
if(Protobuf_FOUND)
list(APPEND FORMAT_SRC
protobuf.c
@ -73,10 +70,6 @@ if(Protobuf_FOUND)
)
endif()
add_library(villas-formats STATIC ${FORMAT_SRC})
add_library(villas-formats SHARED ${FORMAT_SRC})
target_include_directories(villas-formats PUBLIC ${INCLUDE_DIRS})
target_link_libraries(villas-formats PUBLIC ${LIBRARIES})
if(Protobuf_FOUND)
# add_dependencies(villas-formats villas.pb-c.c villas.pb-c.h)
endif()

View file

@ -1,7 +1,7 @@
# CMakeLists.
#
# @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
# @copyright 2017, Institute for Automation of Complex Power Systems, EONERC
# @copyright 2018, Institute for Automation of Complex Power Systems, EONERC
# @license GNU General Public License (version 3)
#
# VILLASnode
@ -20,8 +20,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
###################################################################################
pkg_check_modules(JANSSON IMPORTED_TARGET REQUIRED jansson)
set(INCLUDE_DIRS
${JANSSON_INCLUDE_DIRS}
)
@ -52,6 +50,6 @@ if(WITH_IO)
)
endif()
add_library(villas-hooks STATIC ${HOOK_SRC})
add_library(villas-hooks SHARED ${HOOK_SRC})
target_include_directories(villas-hooks PUBLIC ${INCLUDE_DIRS})
target_link_libraries(villas-hooks PUBLIC ${LIBRARIES})

View file

@ -1,7 +1,7 @@
# CMakeLists.
#
# @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
# @copyright 2017, Institute for Automation of Complex Power Systems, EONERC
# @copyright 2018, Institute for Automation of Complex Power Systems, EONERC
# @license GNU General Public License (version 3)
#
# VILLASnode
@ -20,8 +20,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
###################################################################################
pkg_check_modules(JANSSON IMPORTED_TARGET REQUIRED jansson)
set(INCLUDE_DIRS
${JANSSON_INCLUDE_DIRS}
)
@ -33,9 +31,22 @@ set(LIBRARIES
set(NODE_SRC
influxdb.c
stats.c
file.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
@ -43,6 +54,75 @@ if(HAS_EVENTFD)
)
endif()
add_library(villas-nodes STATIC ${NODE_SRC})
# 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})

54
packaging/CMakeLists.txt Normal file
View file

@ -0,0 +1,54 @@
# CMakeLists.txt.
#
# @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/>.
###################################################################################
if (NOT DEFINED DEPLOY_USER)
set(DEPLOY_USER deploy)
endif()
if (NOT DEFINED DEPLOY_HOST)
set(DEPLOY_USER acs-os-fein-website)
endif()
if (NOT DEFINED DEPLOY_PATH)
set(DEPLOY_USER /var/www/villas/node)
endif()
add_custom_target(deploy-dist
COMMAND rsync ${CMAKE_BINARY_DIR}/*.tar.gz ${DEPLOY_USER}@${DEPLOY_HOST}:${DEPLOY_PATH}/src
)
add_custom_target(deploy-rpm
COMMAND rsync -a --progress ${CMAKE_BINARY_DIR}/*.rpm ${DEPLOY_USER}@${DEPLOY_HOST}:/var/www/packages/redhat/
COMMAND ssh ${DEPLOY_USER}@${DEPLOY_HOST} createrepo /var/www/packages/redhat
)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/libvillas.pc.in
${CMAKE_CURRENT_BINARY_DIR}/libvillas.pc
)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/libvillas.pc
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig
)
add_subdirectory(docker)

View file

@ -0,0 +1,66 @@
# CMakeLists.txt.
#
# @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(DOCKER_FILE Dockerfile)
set(DOCKER_IMAGE villas/node)
set(DOCKER_TAG ${GIT_BRANCH})
set(DOCKER_RUN_OPTS "--interactive --tty --publish 80:80 --publish 443:443 --publish 12000:12000/udp --publish 12001:12001/udp --privileged --security-opt seccomp:unconfined --volume \"${CMAKE_SOURCE_DIR}:/villas\"")
foreach(SUFFIX app dev dev-centos dev-ubuntu)
add_custom_target(deploy-docker-${SUFFIX}
COMMAND docker push ${DOCKER_IMAGE}-${SUFFIX}:${DOCKER_TAG}
COMMAND docker push ${DOCKER_IMAGE}-${SUFFIX}:latest
DEPENDS docker-${SUFFIX}
)
add_custom_target(run-docker-${SUFFIX}
COMMAND docker run ${DOCKER_RUN_OPTS} ${DOCKER_IMAGE}-${SUFFIX}:${DOCKER_TAG}
DEPENDS docker-${SUFFIX}
)
add_custom_target(docker-${SUFFIX}
COMMAND docker build
--file ${CMAKE_CURRENT_SOURCE_DIR}/Dockerfile.${SUFFIX}
--tag ${DOCKER_IMAGE}-${SUFFIX}:${DOCKER_TAG}
--tag ${DOCKER_IMAGE}-${SUFFIX}:latest
--build-arg BUILDER_IMAGE=${DOCKER_IMAGE}-dev:${DOCKER_TAG}
--build-arg DOCKER_TAG=${DOCKER_TAG}
--build-arg GIT_BRANCH=${GIT_BRANCH}
--build-arg GIT_REV=${GIT_REV}
--build-arg VERSION=${PROJECT_VERSION}
--build-arg VARIANT=${VARIANT}
${DOCKER_BUILD_OPTS} ${CMAKE_SOURCE_DIR}
)
endforeach()
# Special cases for 'docker'target
add_custom_target(docker DEPENDS docker-app
COMMAND docker tag ${DOCKER_IMAGE}-app:${DOCKER_TAG} ${DOCKER_IMAGE}:${DOCKER_TAG}
COMMAND docker tag ${DOCKER_IMAGE}-app:${DOCKER_TAG} ${DOCKER_IMAGE}:latest
)
add_custom_target(deploy-docker DEPENDS docker-app
COMMAND docker push ${DOCKER_IMAGE}:${DOCKER_TAG}
COMMAND docker push ${DOCKER_IMAGE}:latest
)
add_custom_target(run-docker DEPENDS run-docker-app)

32
plugins/CMakeLists.txt Normal file
View file

@ -0,0 +1,32 @@
# CMakeLists.txt.
#
# @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/>.
###################################################################################
# Plugins
link_libraries(villas)
include_directories("${CMAKE_SOURCE_DIR}/include")
add_definitions("-DVILLAS")
add_library(simple_circuit SHARED models/simple_circuit.c)
if(WITH_HOOKS)
add_library(example_hook SHARED hooks/example_hook.c)
endif()

View file

@ -1,3 +1,26 @@
# 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/>.
###################################################################################
# All executables link against libvillas
link_libraries(villas)
add_executable(villas-node node.c)
@ -6,11 +29,20 @@ add_executable(villas-test-shmem test-shmem.c)
if(WITH_IO)
add_executable(villas-test-cmp test-cmp.c)
add_executable(villas-convert convert.c)
add_executable(villas-pipe pipe.c)
target_link_libraries(villas-pipe PUBLIC pthread)
add_executable(villas-signal signal.c)
endif()
if(WITH_IO AND WITH_HOOKS)
add_executable(villas-hook hook.c)
endif()
install(
TARGETS ${BUILDSYSTEM_TARGETS}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

46
tests/CMakeLists.txt Normal file
View file

@ -0,0 +1,46 @@
# Makefile.
#
# @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/>.
###################################################################################
add_subdirectory(unit)
add_subdirectory(integration)
if(CMAKE_BUILD_TYPE STREQUAL "Coverage")
#include tests/unit/Makefile.gcov.inc
endif()
add_custom_target(tests
DEPENDS unit-tests integration-tests
)
add_custom_target(run-tests
DEPENDS run-unit-tests run-integration-tests
)
set(VALGRIND "valgrind --leak-check=full --show-leak-kinds=all --suppressions=${CMAKE_CURRENT_SOURCE_DIR}/valgrind.supp")
add_custom_target(run-valgrind
COMMAND ${VALGRIND} $<TARGET_FILE:villas-node> & sleep 2; kill %1
COMMAND ${VALGRIND} $<TARGET_FILE:villas-pipe> -t 2 ${CMAKE_SOURCE_DIR}/etc/websocket-loopback.conf ws1
COMMAND ${VALGRIND} $<TARGET_FILE:villas-signal> mixed -v 4 -l 10
COMMAND ${VALGRIND} $<TARGET_FILE:villas-hook> stats < <($<TARGET_FILE:villas-signal> mixed -l 5)
DEPENDS villas-node villas-pipe villas-signal villas-hook
)

View file

@ -0,0 +1,33 @@
# CMakeLists.txt.
#
# @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/>.
###################################################################################
add_custom_target(run-integration-tests
COMMAND
SRCDIR=${CMAKE_SOURCE_DIR}
BUILDDIR=${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/tools/integration-tests.sh
DEPENDS
villas-node
villas-pipe
villas-signal
villas-hook
)

50
tests/unit/CMakeLists.txt Normal file
View file

@ -0,0 +1,50 @@
# CMakeLists.txt.
#
# @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(TEST_SRC
advio.c
bitset.c
config_json.c
hist.c
io.c
json.c
kernel.c
list.c
log.c
main.c
mapping.c
memory.c
pool.c
queue.c
queue_signalled.c
task.c
timing.c
utils.c
)
add_executable(unit-tests ${TEST_SRC})
target_link_libraries(unit-tests PUBLIC villas criterion pthread)
add_custom_target(run-unit-tests
COMMAND $<TARGET_FILE:unit-tests> ${CRITERION_OPTS}
DEPENDS unit-tests
)

View file

@ -1,7 +1,7 @@
# CMakeLists.
#
# @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
# @copyright 2017, Institute for Automation of Complex Power Systems, EONERC
# @copyright 2018, Institute for Automation of Complex Power Systems, EONERC
# @license GNU General Public License (version 3)
#
# VILLASnode
@ -20,9 +20,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
###################################################################################
if(WITH_CONFIG)
if(LIBCONFIG_FOUND)
list(APPEND TOOLS conf2json)
add_executable(conf2json conf2json.c)
target_link_libraries(conf2json PUBLIC villas)
endif()
@ -34,9 +34,14 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
target_link_libraries(rmsem PUBLIC pthread rt)
endif()
pkg_check_modules(ZMQ IMPORTED_TARGET REQUIRED libzmq)
if(ZMQ_FOUND)
if(LIBZMQ_FOUND)
add_executable(zmq-keygen zmq-keygen.c)
target_include_directories(zmq-keygen PUBLIC ${ZMQ_INCLUDE_DIRS})
target_link_libraries(zmq-keygen PUBLIC PkgConfig::ZMQ)
target_include_directories(zmq-keygen PUBLIC ${LIBZMQ_INCLUDE_DIRS})
target_link_libraries(zmq-keygen PUBLIC PkgConfig::LIBZMQ)
endif()
install(
PROGRAMS villas.sh
DESTINATION ${CMAKE_INSTALL_BINDIR}
RENAME villas
)

View file

@ -25,13 +25,11 @@
SCRIPT=$(realpath ${BASH_SOURCE[0]})
SCRIPTPATH=$(dirname $SCRIPT)
VARIANTS=${VARIANTS:-"release"}
VARIANT=${VARIANT:-$(uname -s)-$(uname -m)-$(echo ${VARIANTS} | tr ' ' '_')}
SRCDIR=${SRCDIR:-$(realpath ${SCRIPTPATH}/..)}
BUILDDIR=${BUILDDIR:-${SRCDIR}/build/${VARIANT}}
BUILDDIR=${BUILDDIR:-${SRCDIR}/build}
LOGDIR=${BUILDDIR}/tests/integration
PATH=${BUILDDIR}:${PATH}
PATH=${BUILDDIR}/src:${PATH}
export PATH SRCDIR BUILDDIR LOGDIR

27
web/CMakeLists.txt Normal file
View file

@ -0,0 +1,27 @@
# CMakeLists.txt.
#
# @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/>.
###################################################################################
install(
DIRECTORY socket/
DESTINATION share/villas/node/web
COMPONENT runtime
)