-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCMakeLists.txt
239 lines (183 loc) · 7.19 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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
################################################################################
#
# (c) 2020 Copyright, Real-Time Innovations, Inc. (RTI) All rights reserved.
#
# RTI grants Licensee a license to use, modify, compile, and create derivative
# works of the Software solely in combination with RTI Connext DDS. Licensee
# may redistribute copies of the Software provided that all such copies are
# subject to this License. The Software is provided "as is", with no warranty
# of any type, including any warranty for fitness for any purpose. RTI is
# under no obligation to maintain or support the Software. RTI shall not be
# liable for any incidental or consequential damages arising out of the use or
# inability to use the Software. For purposes of clarity, nothing in this
# License prevents Licensee from using alternate versions of DDS, provided
# that Licensee may not combine or link such alternate versions of DDS with
# the Software.
#
################################################################################
cmake_minimum_required(VERSION 3.9)
################################################################################
project(nano-agent
LANGUAGES C
VERSION 0.1.0
DESCRIPTION "An XRCE Agent built with RTI Connext DDS")
################################################################################
include(nano-client/core/resource/cmake/nano-build.cmake)
################################################################################
nano_project()
################################################################################
nano_project_option(
ENABLE_CLIENT
"Build XRCE Client API (all APIs)"
ON
"Include nano-client in build")
nano_project_option(
ENABLE_CLIENT_C
"Build XRCE Client API (C API)"
${${PROJECT_NAME}_ENABLE_CLIENT}
"Include nano-client C API in build")
nano_project_option(
ENABLE_CLIENT_CPP
"Build XRCE Client API (C++ API)"
${${PROJECT_NAME}_ENABLE_CLIENT}
"Include nano-client C++ API in build")
nano_project_option(
ENABLE_CLIENT_ARDUINO
"Build XRCE Client API (Arduino-compatible API)"
${${PROJECT_NAME}_ENABLE_CLIENT_CPP}
"Include nano-client Arduino-compatible API in build")
nano_project_option(
BUILD_UNIT_TESTS
"Build included unit tests"
OFF
"Build various unit tests. Requires client APIs to be built")
################################################################################
nano_project_load_connextdds()
################################################################################
function(build_nanocoreagent)
set(BUILD_DOCS OFF)
set(BUILD_DOCS_API OFF)
set(BUILD_DOCS_MANUAL OFF)
set(BUILD_LIBRARIES ${${PROJECT_NAME}_BUILD_LIBRARIES})
set(BUILD_EXECUTABLES OFF)
set(ENABLE_EXAMPLES OFF)
set(ENABLE_XRCE_AGENT true)
add_subdirectory(nano-client/core core)
endfunction()
if(NOT TARGET nano::nanocoreagent)
build_nanocoreagent()
endif()
################################################################################
function(build_ddsagent)
add_subdirectory(dds-agent)
endfunction()
if(NOT TARGET RTIConnextDDS::ddsagent)
build_ddsagent()
endif()
################################################################################
# "agent" component
################################################################################
set(NANO_AGENT_INCLUDE_FILES_PUBLIC
include/nano/nano_agent.h
include/nano/nano_agent_config.h
include/nano/nano_agent_service.h
include/nano/nano_agent_transport.h
include/nano/nano_agent_transport_udpv4.h
include/nano/nano_agent_transport_serial.h)
set(NANO_AGENT_INCLUDE_FILES_PRIVATE
src/service/Agent.h
src/service/AgentTransportSerial.h
src/service/AgentTransportUdpv4.h
src/service/ProxyClient.h
src/service/StreamStorage.h)
set(NANO_AGENT_INCLUDE_DIRS_PRIVATE
src/service)
set(NANO_AGENT_SOURCE_FILES
src/service/Agent.c
src/service/AgentIntf.c
src/service/AgentTransport.c
src/service/AgentTransportSerial.c
src/service/AgentTransportUdpv4.c
src/service/ProxyClient.c
src/service/MessageBufferPool.c)
set(NANO_AGENT_DEFINES -DNANO_FEAT_AGENT=1)
set(NANO_AGENT_LIBS nano::nanocoreagent
nano::nanotransportserialagent
RTIConnextDDS::nddsagent
RTIConnextDDS::c_api)
set(NANO_AGENT_LIBRARY agent)
nano_component(NANO_AGENT)
nano_component_library(NANO_AGENT)
nano_component_install(NANO_AGENT)
unset(NANO_AGENT_INCLUDE_FILES_PUBLIC)
################################################################################
# "daemon" executable
################################################################################
set(NANO_AGENT_nanoagentd_SOURCE_FILES
src/daemon/AgentDaemonMain.c
src/daemon/AgentDaemon.c)
set(NANO_AGENT_nanoagentd_HEADER_FILES
src/daemon/AgentDaemon.h
src/daemon/AgentDaemonArgs.h)
set(NANO_AGENT_nanoagentd_INCLUDE_DIRS
src/daemon)
nano_component_executable(NANO_AGENT nanoagentd)
################################################################################
function(build_nanoclient_c)
set(ENABLE_XRCE_AGENT false)
add_subdirectory(nano-client client-c)
endfunction()
function(build_nanoclient_cpp)
set(ENABLE_XRCE_AGENT false)
add_subdirectory(nano-client/extras/nano-client-cpp client-cpp)
endfunction()
function(build_nanoclient_arduino)
set(ENABLE_XRCE_AGENT false)
add_subdirectory(nano-client/extras/nano-client-arduino client-arduino)
endfunction()
if(${PROJECT_NAME}_ENABLE_CLIENT_C)
build_nanoclient_c()
endif()
if(${PROJECT_NAME}_ENABLE_CLIENT_CPP)
build_nanoclient_cpp()
endif()
if(${PROJECT_NAME}_ENABLE_CLIENT_ARDUINO)
build_nanoclient_arduino()
endif()
################################################################################
function(build_nanoclient_docs)
set(BUILD_LIBRARIES false)
set(BUILD_EXECUTABLES false)
set(BUILD_DOCS true)
if (NOT TARGET nano-client-docs)
build_nanoclient_c()
endif()
if (NOT TARGET nano-client-cpp-docs)
build_nanoclient_cpp()
endif()
if (NOT TARGET nano-client-arduino-docs)
build_nanoclient_arduino()
endif()
endfunction()
if (${PROJECT_NAME}_BUILD_DOCS)
build_nanoclient_docs()
set(DOC_SOURCES index.rst
installation.rst
building.rst
xrce.rst
vars.rst
svc_manual.rst
quickstart.rst)
set(DOC_DEPS nano-client)
# set(DOC_ROOT_INDEX index.html)
nano_project_docs()
endif()
################################################################################
if(BUILD_UNIT_TESTS)
add_subdirectory(nano-tests)
endif()
################################################################################
nano_project_install()
################################################################################
nano_project_summary()
################################################################################