This repository has been archived by the owner on Jul 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists_uavcan_dsdl.txt
203 lines (178 loc) · 7.6 KB
/
CMakeLists_uavcan_dsdl.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
# Copyright (C) 2018 Adolfo E. García
#
# This file is part of STG-8nn-Scaffold.
#
# STG-8nn-Scaffold is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# STG-8nn-Scaffold 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with STG-8nn-Scaffold. If not, see <https://www.gnu.org/licenses/>.
cmake_minimum_required(VERSION 3.20)
##
## DSDL SOURCE FILES
##
if(DEFINED SCAFFOLD_DIR)
set(DSDL_DIR ${SCAFFOLD_DIR}/dependencies/dsdl)
else()
set(DSDL_DIR dependencies/dsdl)
endif()
set(DSDL_SOURCE_FILES
${DSDL_DIR}/uavcan/Timestamp.uavcan
)
list(APPEND DSDL_SOURCE_FILES
${DSDL_DIR}/uavcan/protocol/1.GetNodeInfo.uavcan
${DSDL_DIR}/uavcan/protocol/2.GetDataTypeInfo.uavcan
${DSDL_DIR}/uavcan/protocol/4.GetTransportStats.uavcan
${DSDL_DIR}/uavcan/protocol/4.GlobalTimeSync.uavcan
${DSDL_DIR}/uavcan/protocol/5.Panic.uavcan
${DSDL_DIR}/uavcan/protocol/5.RestartNode.uavcan
${DSDL_DIR}/uavcan/protocol/6.AccessCommandShell.uavcan
${DSDL_DIR}/uavcan/protocol/341.NodeStatus.uavcan
${DSDL_DIR}/uavcan/protocol/CANIfaceStats.uavcan
${DSDL_DIR}/uavcan/protocol/DataTypeKind.uavcan
${DSDL_DIR}/uavcan/protocol/HardwareVersion.uavcan
${DSDL_DIR}/uavcan/protocol/SoftwareVersion.uavcan
)
list(APPEND DSDL_SOURCE_FILES
${DSDL_DIR}/uavcan/protocol/debug/16370.KeyValue.uavcan
${DSDL_DIR}/uavcan/protocol/debug/16383.LogMessage.uavcan
${DSDL_DIR}/uavcan/protocol/debug/LogLevel.uavcan
)
list(APPEND DSDL_SOURCE_FILES
${DSDL_DIR}/uavcan/protocol/dynamic_node_id/1.Allocation.uavcan
)
list(APPEND DSDL_SOURCE_FILES
${DSDL_DIR}/uavcan/protocol/enumeration/15.Begin.uavcan
${DSDL_DIR}/uavcan/protocol/enumeration/380.Indication.uavcan
)
list(APPEND DSDL_SOURCE_FILES
${DSDL_DIR}/uavcan/protocol/file/40.BeginFirmwareUpdate.uavcan
${DSDL_DIR}/uavcan/protocol/file/45.GetInfo.uavcan
${DSDL_DIR}/uavcan/protocol/file/46.GetDirectoryEntryInfo.uavcan
${DSDL_DIR}/uavcan/protocol/file/47.Delete.uavcan
${DSDL_DIR}/uavcan/protocol/file/48.Read.uavcan
${DSDL_DIR}/uavcan/protocol/file/49.Write.uavcan
${DSDL_DIR}/uavcan/protocol/file/EntryType.uavcan
${DSDL_DIR}/uavcan/protocol/file/Error.uavcan
${DSDL_DIR}/uavcan/protocol/file/Path.uavcan
)
list(APPEND DSDL_SOURCE_FILES
${DSDL_DIR}/uavcan/protocol/param/10.ExecuteOpcode.uavcan
${DSDL_DIR}/uavcan/protocol/param/11.GetSet.uavcan
${DSDL_DIR}/uavcan/protocol/param/Empty.uavcan
${DSDL_DIR}/uavcan/protocol/param/NumericValue.uavcan
${DSDL_DIR}/uavcan/protocol/param/Value.uavcan
)
# Note: this variable is the source directory passed to the DSDL compiler, so you should
# use the full path.
set(DSDL_SOURCE_DIRECTORIES ${DSDL_DIR}/uavcan)
##
## DSDL GENERATED FILES
##
set(DSDL_OUT_DIR dsdl-gen)
set(DSDL_GENERATED_FILES
${DSDL_OUT_DIR}/uavcan/Timestamp.h
${DSDL_OUT_DIR}/uavcan/uavcan_Timestamp.c
)
list(APPEND DSDL_GENERATED_FILES
${DSDL_OUT_DIR}/uavcan/protocol/AccessCommandShell.h
${DSDL_OUT_DIR}/uavcan/protocol/protocol_AccessCommandShell.c
${DSDL_OUT_DIR}/uavcan/protocol/CANIfaceStats.h
${DSDL_OUT_DIR}/uavcan/protocol/protocol_CANIfaceStats.c
${DSDL_OUT_DIR}/uavcan/protocol/DataTypeKind.h
${DSDL_OUT_DIR}/uavcan/protocol/protocol_DataTypeKind.c
${DSDL_OUT_DIR}/uavcan/protocol/GetDataTypeInfo.h
${DSDL_OUT_DIR}/uavcan/protocol/protocol_GetDataTypeInfo.c
${DSDL_OUT_DIR}/uavcan/protocol/GetNodeInfo.h
${DSDL_OUT_DIR}/uavcan/protocol/protocol_GetNodeInfo.c
${DSDL_OUT_DIR}/uavcan/protocol/GetTransportStats.h
${DSDL_OUT_DIR}/uavcan/protocol/protocol_GetTransportStats.c
${DSDL_OUT_DIR}/uavcan/protocol/GlobalTimeSync.h
${DSDL_OUT_DIR}/uavcan/protocol/protocol_GlobalTimeSync.c
${DSDL_OUT_DIR}/uavcan/protocol/HardwareVersion.h
${DSDL_OUT_DIR}/uavcan/protocol/protocol_HardwareVersion.c
${DSDL_OUT_DIR}/uavcan/protocol/NodeStatus.h
${DSDL_OUT_DIR}/uavcan/protocol/protocol_NodeStatus.c
${DSDL_OUT_DIR}/uavcan/protocol/Panic.h
${DSDL_OUT_DIR}/uavcan/protocol/protocol_Panic.c
${DSDL_OUT_DIR}/uavcan/protocol/RestartNode.h
${DSDL_OUT_DIR}/uavcan/protocol/protocol_RestartNode.c
${DSDL_OUT_DIR}/uavcan/protocol/SoftwareVersion.h
${DSDL_OUT_DIR}/uavcan/protocol/protocol_SoftwareVersion.c
)
list(APPEND DSDL_GENERATED_FILES
${DSDL_OUT_DIR}/uavcan/protocol/debug/KeyValue.h
${DSDL_OUT_DIR}/uavcan/protocol/debug/debug_KeyValue.c
${DSDL_OUT_DIR}/uavcan/protocol/debug/LogLevel.h
${DSDL_OUT_DIR}/uavcan/protocol/debug/debug_LogLevel.c
${DSDL_OUT_DIR}/uavcan/protocol/debug/LogMessage.h
${DSDL_OUT_DIR}/uavcan/protocol/debug/debug_LogMessage.c
)
list(APPEND DSDL_GENERATED_FILES
${DSDL_OUT_DIR}/uavcan/protocol/dynamic_node_id/Allocation.h
${DSDL_OUT_DIR}/uavcan/protocol/dynamic_node_id/dynamic_node_id_Allocation.c
)
list(APPEND DSDL_GENERATED_FILES
${DSDL_OUT_DIR}/uavcan/protocol/enumeration/Begin.h
${DSDL_OUT_DIR}/uavcan/protocol/enumeration/enumeration_Begin.c
${DSDL_OUT_DIR}/uavcan/protocol/enumeration/Indication.h
${DSDL_OUT_DIR}/uavcan/protocol/enumeration/enumeration_Indication.c
)
list(APPEND DSDL_GENERATED_FILES
${DSDL_OUT_DIR}/uavcan/protocol/file/BeginFirmwareUpdate.h
${DSDL_OUT_DIR}/uavcan/protocol/file/file_BeginFirmwareUpdate.c
${DSDL_OUT_DIR}/uavcan/protocol/file/Delete.h
${DSDL_OUT_DIR}/uavcan/protocol/file/file_Delete.c
${DSDL_OUT_DIR}/uavcan/protocol/file/EntryType.h
${DSDL_OUT_DIR}/uavcan/protocol/file/file_EntryType.c
${DSDL_OUT_DIR}/uavcan/protocol/file/Error.h
${DSDL_OUT_DIR}/uavcan/protocol/file/file_Error.c
${DSDL_OUT_DIR}/uavcan/protocol/file/GetDirectoryEntryInfo.h
${DSDL_OUT_DIR}/uavcan/protocol/file/file_GetDirectoryEntryInfo.c
${DSDL_OUT_DIR}/uavcan/protocol/file/GetInfo.h
${DSDL_OUT_DIR}/uavcan/protocol/file/file_GetInfo.c
${DSDL_OUT_DIR}/uavcan/protocol/file/Path.h
${DSDL_OUT_DIR}/uavcan/protocol/file/file_Path.c
${DSDL_OUT_DIR}/uavcan/protocol/file/Read.h
${DSDL_OUT_DIR}/uavcan/protocol/file/file_Read.c
${DSDL_OUT_DIR}/uavcan/protocol/file/Write.h
${DSDL_OUT_DIR}/uavcan/protocol/file/file_Write.c
)
list(APPEND DSDL_GENERATED_FILES
${DSDL_OUT_DIR}/uavcan/protocol/param/Empty.h
${DSDL_OUT_DIR}/uavcan/protocol/param/param_Empty.c
${DSDL_OUT_DIR}/uavcan/protocol/param/ExecuteOpcode.h
${DSDL_OUT_DIR}/uavcan/protocol/param/param_ExecuteOpcode.c
${DSDL_OUT_DIR}/uavcan/protocol/param/GetSet.h
${DSDL_OUT_DIR}/uavcan/protocol/param/param_GetSet.c
${DSDL_OUT_DIR}/uavcan/protocol/param/NumericValue.h
${DSDL_OUT_DIR}/uavcan/protocol/param/param_NumericValue.c
${DSDL_OUT_DIR}/uavcan/protocol/param/Value.h
${DSDL_OUT_DIR}/uavcan/protocol/param/param_Value.c
)
##
## CUSTOM COMMAND
##
if(DEFINED SCAFFOLD_DIR)
set(DSDLC_DIR ${SCAFFOLD_DIR}/dependencies/dsdl_compiler)
else()
set(DSDLC_DIR dependencies/dsdl_compiler)
endif()
add_custom_command(
OUTPUT ${DSDL_GENERATED_FILES}
COMMAND python3 ${DSDLC_DIR}/libcanard_dsdlc --outdir ${PROJECT_BINARY_DIR}/${DSDL_OUT_DIR} ${DSDL_SOURCE_DIRECTORIES}
MAIN_DEPENDENCY ${DSDLC_DIR}/libcanard_dsdlc
DEPENDS ${DSDL_SOURCE_FILES}
)
##
## SET SOURCES AND HEADERS
##
set(DSDL_C_INCLUDE ${PROJECT_BINARY_DIR}/${DSDL_OUT_DIR})
set(DSDL_C_SOURCES ${DSDL_GENERATED_FILES})