-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathbuild-list.cmake
More file actions
234 lines (206 loc) · 6.75 KB
/
Copy pathbuild-list.cmake
File metadata and controls
234 lines (206 loc) · 6.75 KB
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
#
# Build list for ION-Core - CMake
#
######################
# ION-DTN Version
######################
# Read ION-DTN version from ION_DTN_VERSION file
set(ION_DTN_VERSION_FILE "${CMAKE_SOURCE_DIR}/ION_DTN_VERSION")
if(EXISTS "${ION_DTN_VERSION_FILE}")
file(STRINGS "${ION_DTN_VERSION_FILE}" ION_DTN_TAG_LINES)
foreach(line IN LISTS ION_DTN_TAG_LINES)
# Strip whitespace first
string(STRIP "${line}" line_stripped)
# Skip empty lines and comment lines
if(NOT "${line_stripped}" STREQUAL "" AND NOT "${line_stripped}" MATCHES "^#")
set(ION_DTN_TAG "${line_stripped}")
break()
endif()
endforeach()
message(STATUS "ION-DTN Tag: ${ION_DTN_TAG}")
else()
message(WARNING "ION_DTN_VERSION file not found at ${ION_DTN_VERSION_FILE}")
set(ION_DTN_TAG "unknown")
endif()
######################
# Set version number
######################
# Derive ION-CORE version from ION-DTN tag
# Extract version number from tag (e.g., "ion-open-source-4.1.3s" -> "4.1.3s")
if(NOT "${ION_DTN_TAG}" STREQUAL "unknown")
string(REGEX REPLACE "^ion-open-source-" "" ION_VERSION "${ION_DTN_TAG}")
set(VER "-DVNAME=ION-CORE-${ION_VERSION}")
message(STATUS "ION-CORE Version: ${ION_VERSION}")
else()
# Fallback if ION_DTN_VERSION file is missing
set(VER "-DVNAME=ION-CORE-unknown")
message(WARNING "Using fallback version name")
endif()
######################
# ION-CORE Build Flag
# (enables conditional compilation in ION-DTN)
######################
set(ION_CORE_FLAG "-DION_CORE_BUILD")
######################
# Architecture and OS_FLAGS
# CMake's built-in variables simplify this.
######################
# Reset OS_FLAGS to ensure it's clean before setting
set(OS_FLAGS "")
# Detect the OS and architecture using CMake's built-in variables
# CMAKE_SYSTEM_NAME: Linux, Darwin, FreeBSD
# CMAKE_SIZEOF_VOID_P: Size of a void pointer (e.g., 4 for 32-bit, 8 for 64-bit)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(OS_FLAGS "-Dlinux -DSPACE_ORDER=3 -fno-strict-aliasing")
else()
set(OS_FLAGS "-Dlinux -DSPACE_ORDER=2 -fno-strict-aliasing")
endif()
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(OS_FLAGS "-D__unix__ -Dunix -Ddarwin -DSPACE_ORDER=3") # -m64 is handled by CMAKE_C_FLAGS
else()
set(OS_FLAGS "-D__unix__ -Dunix -Ddarwin -DSPACE_ORDER=2") # -m32 is handled by CMAKE_C_FLAGS
endif()
elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(OS_FLAGS "-Dfreebsd -DSPACE_ORDER=3") # -m64 is handled by CMAKE_C_FLAGS
else()
set(OS_FLAGS "-Dfreebsd -DSPACE_ORDER=2") # -m32 is handled by CMAKE_C_FLAGS
endif()
endif()
# Output for debugging (similar to Makefile's info messages)
# CMAKE_SIZEOF_VOID_P is in bytes, so multiply by 8 to get bits
math(EXPR BITS "${CMAKE_SIZEOF_VOID_P} * 8")
message(STATUS "OS: ${BITS}-bit ${CMAKE_SYSTEM_NAME}; HW ARCH: ${CMAKE_SYSTEM_PROCESSOR}")
message(STATUS "OS_FLAGS set to: ${OS_FLAGS}")
##################
# FLAGS for Extension for Locally Sourced Bundles
##################
# Use CMake options for user-configurable flags, and set default values.
# This makes it easier for users to enable/disable extensions via CMake-GUI or -D
# For flags that are always active by default in Makefile, set them ON here.
# Initializing EXT_FLAGS list
set(EXT_FLAGS "")
# Ensure these options are set in the main CMakeLists.txt or here.
# For now, we'll mimic the Makefile by directly setting the flags.
# In CMake, it's better to use `add_definitions` or `target_compile_definitions`
# directly rather than accumulating a string `EXT_FLAGS`.
# However, to strictly mimic, we'll collect the flags here.
# As per your build-list.mk, BPQ_EXT and IMC_EXT are enabled by default.
# ENABLE_IMC (added in ION 4.2.0): gates the IMC handler table in bpextensions.c
# and the IMC forwarding path in libbpP.c. It replaced the unconditional IMC
# inclusion of 4.1.x; without it the IMC block handlers are compiled but never
# registered, silently disabling multicast. IMC_EXT still gates the auto-attach
# extensionSpecs entry, so both are set.
# If you wish to make them configurable by the user, you'd use `option()` in CMakeLists.txt
# and check if they are ON.
# For direct translation, we'll append to EXT_FLAGS string.
# Note: In CMake, it's often better to use `add_definitions(-DBPQ_EXT)` directly
# in the main CMakeLists.txt where compilation flags are applied.
# This `EXT_FLAGS` variable here would then only serve as documentation or for
# a very specific concatenation logic.
# For the purpose of *this* build-list.cmake, we'll define it as a string
# that *could* be passed to add_definitions later.
set(EXT_FLAGS "-DBPQ_EXT -DIMC_EXT -DENABLE_IMC") # Matches your Makefile: EXT_FLAGS += -DBPQ_EXT -DIMC_EXT -DENABLE_IMC
##################
# PART I: Mandatory Functions
##################
# Use `set()` to define the PROGRAMS list.
set(PROGRAMS
# ICI
ionadmin
ionwarn
rfxclock
ionrestart
# BPv7
bpadmin
bpclm
bpclock
bptransit
ipnadmin
ipnadminep
ipnfw
# Utility Programs
bpsink
bpsource
bpecho
bping
bpstats
bptrace
)
##################
# PART II: Optional Feature List
##################
# Append to the PROGRAMS list for optional features.
list(APPEND PROGRAMS
# ICI utilities
psmwatch
sdrwatch
ionwatch
# BPv7 utilities
# bpversion # Removed in ION 4.1.4 stable
bpinspect
cbrcustodytest
bptracker
bpwatch
# Load-and-Go Command
lgagent
lgsend
# CLA: must include at least one of STCP, UDP, or LTP
# STCP CLA
stcpcli
stcpclo
# UDP CLA
udpcli
udpclo
# LTP CLA
ltpcli
ltpclo
udplsi
udplso
ltpclock
ltpdeliv
ltpmeter
ltpadmin
ltpwatch
ltpstats
# CFDP Class 1
bputa
cfdpclock
cfdptest
cfdpadmin
bpcp
bpcpd
# Utility Programs
bprecvfile
bpsendfile
bpchat
bpcounter
bpdriver
bplist
bpcancel
owltsim
)
# If you had conditional compilation for these in Makefile (e.g., ifdefs),
# you would wrap these `list(APPEND PROGRAMS ...)` calls in `if()` statements
# based on CMake options set in CMakeLists.txt.
# Example: if(ENABLE_PSMWATCH) ... endif()
##################
# PART IV: Testing Mapping
##################
# Define COMBINATION_TESTS as a list of strings.
# Each string is "program1+program2:test_suite_1+test_suite_2".
# Escaping semicolons might be necessary if they are part of the value.
# For clean reading, each entry on a new line.
set(COMBINATION_TESTS
"cfdpadmin+ltpcli+owltsim:../demos/bench-cfdp/"
"stcpcli:../demos/bench-stcp/"
"ltpcli:../demos/bench-ltp/"
"bptrace+bpsink+ltpcli:bptrace_terminal_test/"
"bping+bpecho+udpcli:bping/"
"cfdpadmin+ltpcli:issue-352-bpcp-ltp/"
"cfdpadmin+stcpcli:issue-352-bpcp-stcp/"
"cbrcustodytest+ltpcli:cbr-ct-orange-book/custody-simple/"
"cbrcustodytest+ltpcli:cbr-ct-orange-book/crs-simple/"
)