-
Notifications
You must be signed in to change notification settings - Fork 5
/
CMakeLists.txt
144 lines (135 loc) · 5.66 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
# NIST-developed software is provided by NIST as a public service. You may use,
# copy and distribute copies of the software in any medium, provided that you
# keep intact this entire notice. You may improve,modify and create derivative
# works of the software or any portion of the software, and you may copy and
# distribute such modifications or works. Modified works should carry a notice
# stating that you changed the software and should note the date and nature of
# any such change. Please explicitly acknowledge the National Institute of
# Standards and Technology as the source of the software.
#
# NIST-developed software is expressly provided "AS IS." NIST MAKES NO
# WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF
# LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT
# AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE
# OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT
# ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY
# REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF,
# INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY,
# OR USEFULNESS OF THE SOFTWARE.
#
# You are solely responsible for determining the appropriateness of using and
# distributing the software and you assume all risks associated with its use,
# including but not limited to the risks and costs of program errors,
# compliance with applicable laws, damage to or loss of data, programs or
# equipment, and the unavailability or interruption of operation. This
# software is not intended to be used in any situation where a failure could
# cause risk of injury or damage to property. The software developed by NIST
# employees is not subject to copyright protection within the United States.
option(NETSIMULYZER_PRE_NS3_41_ENUM_VALUE "Force compatibility with ns-3 versions before ns-3.41" OFF)
# ns-3.41 is tagged at e5039092b3bb5d7942d973cc1016eaa60bdce51c
#
# Note: This doesn't handle squash merges, or some other
# way out there out of tree stuff
# See: `NETSIMULYZER_PRE_NS3_41_ENUM_VALUE` option for that
execute_process(COMMAND "git" "merge-base" "--is-ancestor" "e5039092b3bb5d7942d973cc1016eaa60bdce51c" "HEAD"
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
RESULT_VARIABLE NETSIMULYZER_USE_ENUM_COMPAT
)
# Handling for if `git` is not installed
# Hope this string is well defined...
#
# `128` is the `git` return code for a non-git repo
if (${NETSIMULYZER_USE_ENUM_COMPAT} STREQUAL "no such file or directory" OR ${NETSIMULYZER_USE_ENUM_COMPAT} EQUAL 128)
# Huge hack for tar ball ns-3 installs
# If they don't have `grep` either,
# then I'm out of options
execute_process(COMMAND "grep" "-w" "EnumValue(int value)" "src/core/model/enum.h"
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
RESULT_VARIABLE NETSIMULYZER_USE_ENUM_COMPAT_GREP)
# `grep` returns `0` on match
if (${NETSIMULYZER_USE_ENUM_COMPAT_GREP} EQUAL 0)
set(NETSIMULYZER_USE_ENUM_COMPAT 1)
endif ()
endif ()
if (${NETSIMULYZER_PRE_NS3_41_ENUM_VALUE} OR ${NETSIMULYZER_USE_ENUM_COMPAT} EQUAL 1)
add_compile_definitions(NETSIMULYZER_PRE_NS3_41_ENUM_VALUE)
endif ()
build_lib(
LIBNAME netsimulyzer
SOURCE_FILES
helper/area-helper.cc
helper/building-configuration-container.cc
helper/building-configuration-helper.cc
helper/logical-link-helper.cc
helper/node-configuration-container.cc
helper/node-configuration-helper.cc
helper/throughput-sink-helper.cc
model/node-configuration.cc
model/building-configuration.cc
model/category-axis.cc
model/category-value-series.cc
model/color.cc
model/color-palette.cc
model/decoration.cc
model/ecdf-sink.cc
model/log-stream.cc
model/logical-link.cc
model/netsimulyzer-version.cc
model/orchestrator.cc
model/rectangular-area.cc
model/series-collection.cc
model/state-transition-sink.cc
model/value-axis.cc
model/xy-series.cc
model/throughput-sink.cc
HEADER_FILES
helper/area-helper.h
helper/building-configuration-container.h
helper/building-configuration-helper.h
helper/logical-link-helper.h
helper/node-configuration-container.h
helper/node-configuration-helper.h
helper/throughput-sink-helper.h
library/json.hpp
model/event-message.h
model/log-stream.h
model/logical-link.h
model/netsimulyzer-3D-models.h
model/netsimulyzer-version.h
model/node-configuration.h
model/optional.h
model/building-configuration.h
model/category-axis.h
model/category-value-series.h
model/color.h
model/color-palette.h
model/decoration.h
model/ecdf-sink.h
model/orchestrator.h
model/rectangular-area.h
model/series-collection.h
model/state-transition-sink.h
model/value-axis.h
model/xy-series.h
model/throughput-sink.h
LIBRARIES_TO_LINK
${libbuildings}
${libcore}
${libnetwork}
${libmobility}
${libpoint-to-point}
${libapplications}
TEST_SOURCES
test/test-buildings.cc
test/netsimulyzer-test-utils.h
test/test-node-events.cc
test/test-orchestrator-outputs.cc
)
target_compile_definitions(${libnetsimulyzer} PUBLIC HAS_NETSIMULYZER)
option(NETSIMULYZER_CRASH_HANDLER "Adds a crash handler that writes NetSimulyzer output on an irregular exit of the program" ON)
if (NETSIMULYZER_CRASH_HANDLER)
add_compile_definitions(NETSIMULYZER_CRASH_HANDLER) # TODO: target_compile_definitions _should_ work here, but it doesn't
endif ()
# This seems to only work with core modules if it's a cached value
set(HAS_NETSIMULYZER TRUE CACHE BOOL "NetSimulyzer ns-3 module")