-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-sim.sh
More file actions
executable file
·35 lines (31 loc) · 1.65 KB
/
Copy pathbuild-sim.sh
File metadata and controls
executable file
·35 lines (31 loc) · 1.65 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
#!/usr/bin/env bash
#
# Regenerate the OMNeT++ Makefile for the core-hosted simulation and build it.
#
# The simulation runs entirely on loti-core: this build compiles core/ +
# adapters/sim/ (the port adapters) + app/sim/ (the thin Node-hosting OMNeT++
# modules). Everything is C++20 (see makefrag). The Makefile is generated, not
# checked in (it is gitignored), so this script is the source of truth for how the
# simulation is built.
#
# Requires the OMNeT++, INET, and loti setenv scripts to have been sourced first:
# source <omnetpp>/setenv -q && source <inet>/setenv && source ./setenv -f
#
# Usage: scripts/build-sim.sh [release|debug] (default: release)
set -euo pipefail
: "${INET_ROOT:?source the INET setenv first (INET_ROOT unset)}"
command -v opp_makemake >/dev/null || { echo "source the OMNeT++ setenv first"; exit 1; }
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$root"
mode="${1:-release}"
# The sim is built ONLY from src/core/ + src/adapters/sim/ + src/app/sim/ (+ sim/).
# Everything else is excluded so --deep doesn't sweep in a .cpp that doesn't belong:
# the production runtime `src/adapters/os` (WallClock, reactor, UDP, the Ed25519
# keystore on OpenSSL) and the production apps `src/app/lotid` (has its own main() +
# links libcrypto) / `src/app/loti` — any would pull an unresolved symbol into libloti.so.
opp_makemake -f --deep -e cpp --make-so -o loti -O out \
-X test -X build -X scripts -X plan -X doc -X bin -X third_party \
-X src/adapters/os -X src/app/lotid -X src/app/loti \
-KINET_PROJ="$INET_ROOT" -DINET_IMPORT \
-Isrc -Isrc/core '-I$(INET_PROJ)/src' '-L$(INET_PROJ)/src' '-lINET$(D)'
make MODE="$mode" -j"$(nproc)"