-
Notifications
You must be signed in to change notification settings - Fork 22
/
CMakeLists.txt
155 lines (125 loc) · 4.81 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
cmake_minimum_required(VERSION 2.8.12)
# automagically detect if we should cross-compile
if(DEFINED ENV{TOOLCHAIN})
set(CMAKE_C_COMPILER $ENV{TOOLCHAIN}gcc)
set(CMAKE_CXX_COMPILER $ENV{TOOLCHAIN}g++)
set(CMAKE_AR "$ENV{TOOLCHAIN}ar" CACHE FILEPATH "CW archiver" FORCE)
endif()
project(iec61850-open-server)
ENABLE_TESTING()
set(PROJECT_VERSION_MAJOR "0")
set(PROJECT_VERSION_MINOR "9")
set(PROJECT_VERSION_PATCH "0")
set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
set(CMAKE_EXECUTABLE_ENABLE_EXPORTS, TRUE)
# feature checks
include(CheckLibraryExists)
check_library_exists(rt clock_gettime "time.h" CONFIG_SYSTEM_HAS_CLOCK_GETTIME)
# check if we are on a little or a big endian
include (TestBigEndian)
test_big_endian(PLATFORM_IS_BIGENDIAN)
option(DEBUG "Enable debugging" ON)
#option(DEBUG "Enable debugging" ON)
option(BUILD_PLUGINS "Build the plugins" ON)
include_directories(
./inc
)
set(open_server_SRCS
input/inputs.c
model/config_file_parser_extensions.c
model/dynamic_model_extensions.c
LNs/SMVPublisher.c
LNs/LNParse.c
LNs/CILO.c
LNs/CSWI.c
LNs/MMXU.c
LNs/PTOC.c
LNs/PIOC.c
LNs/PDIF.c
LNs/PDIS.c
LNs/PTRC.c
LNs/RADR.c
LNs/RBDR.c
LNs/RDRE.c
LNs/XCBR.c
LNs/XSWI.c
LNs/LLN0.c
LNs/TVTR.c
LNs/TCTR.c
LNs/RREC.c
open_server.c
)
if(DEBUG)
set(CMAKE_BUILD_TYPE Debug)
endif(DEBUG)
if(BUILD_PLUGINS)
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/plugin_src)
endif(BUILD_PLUGINS)
add_executable(open_server
${open_server_SRCS}
)
set_target_properties( open_server
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
)
target_link_libraries(open_server
libiec61850.so
libiec61850.a
libhal.a
libhal-shared.a
pthread
dl
m
)
# NOTE: this project uses a dual license scheme, as libiec61850 is covered by GPL 3.0
# this means that any software that incorporates this library should adhere to GPL 3.0 as well
# however, the circuit-simulator does not use libiec61850, and therefore this is apache licensed
# the circuit-simulator should normally be run on a separate, non-realtime test machine, and is
# therefore ommitted from the install script
install ( TARGETS open_server DESTINATION ${CMAKE_PROJECT_NAME} COMPONENT Applications)
install ( FILES Dockerfile.libiec61850_server DESTINATION ${CMAKE_PROJECT_NAME} COMPONENT Data)
install ( FILES make_model.sh DESTINATION ${CMAKE_PROJECT_NAME}
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
COMPONENT Data
)
install ( FILES make_compose.sh DESTINATION ${CMAKE_PROJECT_NAME}
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
COMPONENT Data
)
install ( FILES README.md DESTINATION ${CMAKE_PROJECT_NAME} COMPONENT Data )
install ( FILES COPYING DESTINATION ${CMAKE_PROJECT_NAME} COMPONENT Data )
install ( FILES model_input_generator/genconfig.jar
DESTINATION ${CMAKE_PROJECT_NAME}/model_input_generator
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ GROUP_WRITE WORLD_READ
COMPONENT Data
)
install ( FILES model_input_generator/genconfig_input.jar
DESTINATION ${CMAKE_PROJECT_NAME}/model_input_generator
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ GROUP_WRITE WORLD_READ
COMPONENT Data
)
install ( FILES model_input_generator/gendocker.jar
DESTINATION ${CMAKE_PROJECT_NAME}/model_input_generator
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ GROUP_WRITE WORLD_READ
COMPONENT Data
)
install ( DIRECTORY cfg DESTINATION ${CMAKE_PROJECT_NAME} COMPONENT Data )
install ( DIRECTORY scd DESTINATION ${CMAKE_PROJECT_NAME} COMPONENT Data )
install ( DIRECTORY schema DESTINATION ${CMAKE_PROJECT_NAME} COMPONENT Data )
set(CPACK_PACKAGE_DESCRIPTION "IEC 61850 open server")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "IEC 61850 open server")
set(CPACK_PACKAGE_VENDOR "https://github.com/robidev")
set(CPACK_PACKAGE_CONTACT "[email protected]")
set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}")
set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}_${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}_${CMAKE_SYSTEM_PROCESSOR}")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}_${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
set(CPACK_COMPONENTS_ALL Applications Data)
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CMAKE_INSTALL_PREFIX}/${CMAKE_PROJECT_NAME}")
if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
include(InstallRequiredSystemLibraries)
include(CPack)
endif(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")