2018-06-21 09:36:49 +02:00
|
|
|
# CMakeLists.
|
|
|
|
#
|
|
|
|
# @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
|
2020-01-20 17:17:00 +01:00
|
|
|
# @copyright 2014-2020, Institute for Automation of Complex Power Systems, EONERC
|
2018-06-21 09:36:49 +02:00
|
|
|
# @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/>.
|
|
|
|
###################################################################################
|
|
|
|
|
2018-07-03 18:25:15 +02:00
|
|
|
add_compile_options(-fPIC)
|
|
|
|
|
2018-07-16 20:16:14 +02:00
|
|
|
list(APPEND INCLUDE_DIRS
|
2018-08-23 13:10:59 +02:00
|
|
|
${PROJECT_BINARY_DIR}/include
|
|
|
|
${PROJECT_SOURCE_DIR}/include
|
2018-06-21 09:36:49 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
set(LIBRARIES
|
2020-06-14 15:02:16 +02:00
|
|
|
villas-common
|
2018-06-21 09:36:49 +02:00
|
|
|
PkgConfig::JANSSON
|
2019-10-30 02:38:56 +01:00
|
|
|
PkgConfig::UUID
|
2018-10-04 00:45:21 +02:00
|
|
|
m
|
2018-10-25 17:03:57 +01:00
|
|
|
stdc++
|
2018-06-21 09:36:49 +02:00
|
|
|
)
|
|
|
|
|
2020-07-01 14:36:18 +02:00
|
|
|
# For shmem_unlink
|
|
|
|
if(UNIX AND NOT APPLE)
|
|
|
|
list(APPEND LIBRARIES "rt")
|
|
|
|
endif()
|
|
|
|
|
2018-10-25 17:03:57 +01:00
|
|
|
if(CMAKE_CXX_COMPILER_ID STREQUAL GNU)
|
2020-07-01 14:36:18 +02:00
|
|
|
list(APPEND LIBRARIES "-lstdc++fs")
|
2018-10-25 17:03:57 +01:00
|
|
|
endif()
|
|
|
|
|
2018-06-21 09:36:49 +02:00
|
|
|
set(LIB_SRC
|
2019-03-26 07:01:10 +01:00
|
|
|
config_helper.cpp
|
2019-03-26 07:03:57 +01:00
|
|
|
config.cpp
|
2020-10-12 15:26:03 +02:00
|
|
|
dumper.cpp
|
2019-04-07 15:13:40 +02:00
|
|
|
mapping.cpp
|
|
|
|
memory.cpp
|
|
|
|
memory/heap.cpp
|
|
|
|
memory/managed.cpp
|
2019-10-26 13:35:40 +02:00
|
|
|
memory/mmap.cpp
|
2019-04-07 15:13:40 +02:00
|
|
|
node_direction.cpp
|
|
|
|
node_type.cpp
|
|
|
|
node.cpp
|
|
|
|
path_destination.cpp
|
|
|
|
path_source.cpp
|
|
|
|
path.cpp
|
|
|
|
plugin.cpp
|
|
|
|
pool.cpp
|
|
|
|
queue_signalled.cpp
|
|
|
|
queue.cpp
|
|
|
|
sample.cpp
|
|
|
|
shmem.cpp
|
|
|
|
signal.cpp
|
2020-07-04 18:16:03 +02:00
|
|
|
signal_data.cpp
|
|
|
|
signal_list.cpp
|
|
|
|
signal_type.cpp
|
2019-04-07 15:13:40 +02:00
|
|
|
stats.cpp
|
2019-03-26 07:13:02 +01:00
|
|
|
super_node.cpp
|
2019-04-07 15:13:40 +02:00
|
|
|
socket_addr.cpp
|
|
|
|
io.cpp
|
|
|
|
format_type.cpp
|
2018-06-21 09:36:49 +02:00
|
|
|
)
|
|
|
|
|
2019-06-26 23:32:19 +02:00
|
|
|
if(WITH_WEB)
|
|
|
|
list(APPEND LIB_SRC
|
|
|
|
web.cpp
|
|
|
|
)
|
2020-12-04 13:36:46 +01:00
|
|
|
|
|
|
|
list(APPEND LIBRARIES PkgConfig::LIBWEBSOCKETS)
|
2019-06-26 23:32:19 +02:00
|
|
|
endif()
|
|
|
|
|
2020-03-04 13:59:46 +01:00
|
|
|
if(WITH_GRAPHVIZ)
|
2020-06-08 02:37:49 +02:00
|
|
|
list(APPEND LIBRARIES PkgConfig::CGRAPH PkgConfig::GVC)
|
2020-03-04 13:59:46 +01:00
|
|
|
endif()
|
|
|
|
|
2021-02-19 06:39:23 +01:00
|
|
|
if(WITH_LUA)
|
|
|
|
list(APPEND LIBRARIES PkgConfig::LUA)
|
|
|
|
endif()
|
|
|
|
|
2019-04-05 20:57:34 +02:00
|
|
|
if(WITH_NODE_INFINIBAND)
|
2019-04-07 15:13:40 +02:00
|
|
|
list(APPEND LIB_SRC memory/ib.cpp)
|
2018-07-04 17:50:26 +02:00
|
|
|
endif()
|
|
|
|
|
2018-06-21 09:36:49 +02:00
|
|
|
add_subdirectory(nodes)
|
2018-07-03 18:25:15 +02:00
|
|
|
list(APPEND WHOLE_ARCHIVES nodes)
|
2018-06-21 09:36:49 +02:00
|
|
|
|
2019-04-05 10:47:24 +02:00
|
|
|
add_subdirectory(formats)
|
|
|
|
list(APPEND WHOLE_ARCHIVES formats)
|
|
|
|
|
2019-04-05 11:01:49 +02:00
|
|
|
if(WITH_CONFIG)
|
2018-06-25 09:44:58 +02:00
|
|
|
list(APPEND INCLUDE_DIRS ${LIBCONFIG_INCLUDE_DIRS})
|
|
|
|
list(APPEND LIBRARIES PkgConfig::LIBCONFIG)
|
2018-06-21 09:36:49 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(WITH_HOOKS)
|
|
|
|
list(APPEND LIB_SRC
|
2019-03-26 15:33:47 +01:00
|
|
|
hook.cpp
|
2019-03-16 10:11:26 +01:00
|
|
|
hook_list.cpp
|
2018-06-21 09:36:49 +02:00
|
|
|
)
|
2018-06-25 09:44:58 +02:00
|
|
|
|
2018-06-21 09:36:49 +02:00
|
|
|
add_subdirectory(hooks)
|
2018-07-03 18:25:15 +02:00
|
|
|
list(APPEND WHOLE_ARCHIVES hooks)
|
2018-06-21 09:36:49 +02:00
|
|
|
endif()
|
|
|
|
|
2020-08-17 17:09:03 +02:00
|
|
|
if(WITH_API AND WITH_WEB)
|
2018-06-21 09:36:49 +02:00
|
|
|
list(APPEND LIB_SRC
|
2018-10-20 14:20:06 +02:00
|
|
|
api.cpp
|
2018-06-21 09:36:49 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
add_subdirectory(api)
|
2018-07-03 18:25:15 +02:00
|
|
|
list(APPEND WHOLE_ARCHIVES api)
|
2018-06-21 09:36:49 +02:00
|
|
|
endif()
|
|
|
|
|
2018-06-25 09:44:58 +02:00
|
|
|
# libnl3 is optional but required for network emulation and IRQ pinning
|
|
|
|
if(LIBNL3_ROUTE_FOUND)
|
|
|
|
list(APPEND LIB_SRC
|
2019-04-07 15:13:40 +02:00
|
|
|
kernel/nl.cpp
|
|
|
|
kernel/tc.cpp
|
|
|
|
kernel/tc_netem.cpp
|
|
|
|
kernel/if.cpp
|
2018-06-25 09:44:58 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
list(APPEND INCLUDE_DIRS ${LIBNL3_ROUTE_INCLUDE_DIRS})
|
|
|
|
list(APPEND LIBRARIES PkgConfig::LIBNL3_ROUTE)
|
|
|
|
endif()
|
|
|
|
|
2020-08-28 15:11:43 +02:00
|
|
|
if(WITH_FPGA)
|
|
|
|
list(APPEND LIBRARIES villas-fpga)
|
|
|
|
endif()
|
|
|
|
|
2018-06-21 09:36:49 +02:00
|
|
|
add_library(villas SHARED ${LIB_SRC})
|
|
|
|
|
|
|
|
target_include_directories(villas PUBLIC ${INCLUDE_DIRS})
|
2020-06-14 15:02:16 +02:00
|
|
|
target_link_libraries(villas PUBLIC ${LIBRARIES})
|
2018-06-25 09:44:58 +02:00
|
|
|
|
2018-07-03 18:25:15 +02:00
|
|
|
if(APPLE)
|
|
|
|
target_link_libraries(villas PRIVATE -Wl,-all_load ${WHOLE_ARCHIVES} -Wl,-noall_load)
|
|
|
|
else()
|
|
|
|
target_link_libraries(villas PRIVATE -Wl,--whole-archive ${WHOLE_ARCHIVES} -Wl,--no-whole-archive)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set_target_properties(villas PROPERTIES
|
2018-08-23 17:34:00 +02:00
|
|
|
VERSION ${CMAKE_PROJECT_VERSION}
|
|
|
|
SOVERSION 1
|
2018-07-03 18:25:15 +02:00
|
|
|
)
|
2018-06-30 01:29:45 +02:00
|
|
|
|
|
|
|
install(
|
|
|
|
TARGETS villas
|
|
|
|
EXPORT VILLASNodeConfig
|
|
|
|
COMPONENT lib
|
|
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
2018-06-25 09:44:58 +02:00
|
|
|
)
|
|
|
|
|
2018-06-30 01:29:45 +02:00
|
|
|
install(
|
2018-09-08 00:04:50 +02:00
|
|
|
DIRECTORY ${PROJECT_SOURCE_DIR}/include/villas/
|
|
|
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/villas
|
|
|
|
COMPONENT devel
|
|
|
|
FILES_MATCHING
|
|
|
|
PATTERN "*.h"
|
2019-01-13 00:43:41 +01:00
|
|
|
PATTERN "*.hpp"
|
2018-09-08 00:04:50 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
install(
|
|
|
|
DIRECTORY ${PROJECT_BINARY_DIR}/include/villas/
|
2018-06-30 01:29:45 +02:00
|
|
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/villas
|
|
|
|
COMPONENT devel
|
|
|
|
FILES_MATCHING
|
|
|
|
PATTERN "*.h"
|
2019-01-13 00:43:41 +01:00
|
|
|
PATTERN "*.hpp"
|
2018-06-30 01:29:45 +02:00
|
|
|
)
|